Use Kimi Code CLI with models on Amazon Bedrock

In one sentence

Moonshot AI's Kimi Code CLI v2.7.0 adds a native Amazon Bedrock provider, allowing developers to authenticate via the standard AWS credential chain instead of managing separate API keys.

Key points

  • Kimi Code CLI v2.7.0 introduces a native bedrock provider, eliminating the need to manually configure separate Amazon Bedrock API keys.
  • The provider resolves temporary credentials via the standard AWS CLI credential chain, including named profiles and SSO, to automatically generate short-lived bearer tokens.
  • The provider infers the regional endpoint and API format from the model ID, while allowing protocol overrides per model.
  • The post demonstrates IAM permission setup and integration steps using Kimi K3.1 Pro Highspeed, which supports streaming and client-side tool calling.

In depth

An AI-written overview of the original article, not the article itself.

According to the AWS Machine Learning Blog, Moonshot AI has added a native bedrock provider to its open-source coding agent, Kimi Code CLI, starting in v2.7.0. Developers can now connect to models on Amazon Bedrock using their standard AWS credential chain instead of managing a separate API key. Using Kimi K3.1 Pro Highspeed as an example, the post explains how the integration works and how to configure it.

Native Integration and Benefits

Previously, connecting Kimi Code CLI to Amazon Bedrock required configuring a generic openai or openai_responses provider with a regional URL and a separate Amazon Bedrock API key. This added an extra credential for AWS customers to obtain and protect.

The native bedrock provider streamlines this setup by resolving temporary credentials through the standard AWS CLI credential chain, supporting both named profiles and single sign-on (SSO). Users can also override the inferred API protocol and endpoint URL for specific models when needed.

Authentication and Routing Workflow

The article outlines a four-step process handled by the native provider. First, it resolves ambient AWS credentials or a specified AWS_PROFILE, unless an explicit API key is provided. Second, it uses @aws/bedrock-token-generator to create and renew a short-lived bearer token valid for up to 12 hours, eliminating the need to store keys in config.toml.

Third, the provider reads AWS_REGION or AWS_DEFAULT_REGION to build the regional bedrock-runtime endpoint, defaulting to the OpenAI-compatible Chat Completions path for Kimi models. Finally, it calls the selected inference profile, such as global.moonshotai.kimi-k3.1, enabling streaming responses and client-side tool calling.

Configuration and Best Practices

Getting started requires Kimi Code CLI v2.7.0 or later, the AWS CLI, and an IAM identity with permissions to invoke the target model. Because the desktop and web interfaces do not yet expose all required environment fields, the post recommends editing config.toml directly.

The article also highlights three best practices: explicitly declare supported model capabilities such as thinking, image input, and tool use since Kimi Code does not auto-detect them on Bedrock; set AWS_REGION explicitly in config.toml or the shell; and use global cross-Region inference profiles when data residency is not required, as they are priced 10% lower than geographic profiles.

Read originalOpens aws.amazon.com

This summary was generated by AI from the original article and may contain errors; the original is authoritative. Copyright belongs to the original author.

Recent stories from this source