Free Intensive Nov 21–22Free 2-day hands-on Vibecoding Intensive on Nov 21–22 at 16:00 MSK (Sat–Sun) · Live Cohort 3 starts Nov 23Join Free →Cohort 3 (Nov 23)
ReleaseAPI / Product · ActionableAWS Machine Learning Blog→ original

Kimi Code CLI now works with Amazon Bedrock without a separate API key

Kimi Code CLI used to connect to Amazon Bedrock with a separate API key that you had to issue and keep secret. Version 2.7.0 adds a bedrock provider. It uses standard AWS profiles and SSO and generates a temporary token valid for up to 12 hours. The AWS example uses Kimi K3.1 Pro Highspeed, which has a 1 million-token context window. For teams on AWS, that means one less secret in their configs.

AI-processed from AWS Machine Learning Blog; edited by Hamidun News
Kimi Code CLI now works with Amazon Bedrock without a separate API key
Source: AWS Machine Learning Blog. Collage: Hamidun News.
Listen to article
Article Fact Sheet & Key Figures
ParameterDetails
Primary sourceAWS Machine Learning Blog ↗
Editor-in-Chief
You must set the region explicitlyAWS_REGION in config.toml or in the shell
Key metric #2The global inference profile is 10% cheaper than the geographic ones
Key metric #3The "connected" status in the app does not verify access, so run a test prompt

If your company lives in AWS, every new developer tool runs into the same question: where do we get yet another key, and who is responsible for it? Kimi Code CLI, Moonshot AI's open-source coding agent, used to impose exactly that requirement for models on Amazon Bedrock. Version 2.7.0 removes it.

What changed in version 2.7.0

Previously, the connection went through a generic provider of type openai or openai_responses. You had to specify a regional base_url and paste in a Bedrock API key. The key could be short-term or long-term, but either way it was a separate secret that you had to obtain, store somewhere, and revoke on time.

The CLI now has a native bedrock provider. It uses the standard AWS credential chain: environment variables, named profiles, and SSO through IAM Identity Center. You can select a profile with the AWS_PROFILE variable. If you haven't set a key manually, the provider generates a short-term token itself through the @aws/bedrock-token-generator library and refreshes it as needed. The token is valid for up to 12 hours or until your AWS session ends, whichever is shorter. If you explicitly set api_key or api_key_env, your key takes priority.

AWS adds a reminder: this path reduces reliance on manually created keys, but you remain responsible for protecting your credentials and keeping permissions tight.

How to set it up

The AWS example uses Kimi K3.1 Pro Highspeed. The model supports streaming output, configurable reasoning, image input, and client-side tool calling. The steps are as follows.

First, check that the AWS CLI sees the right identity. For SSO, use aws configure sso and aws sso login; for console credentials, you need aws login (AWS CLI 2.32.0 or newer). You can verify the identity with aws sts get-caller-identity.

Next, edit ~/.kimi-code/config.toml. Create a provider with type = "bedrock", set AWS_REGION in its env section, and add AWS_PROFILE if needed. Define the model with the identifier global.moonshotai.kimi-k3.1, a context of 1 000 000 tokens, and a capabilities list: always_thinking, thinking, image_in, tool_use.

The IAM user needs permissions for bedrock:CallWithBearerToken (only for short-term tokens), for reading the inference profile, and for calling the model through InvokeModel and InvokeModelWithResponseStream. AWS advises creating a role dedicated to this tool and following the principle of least privilege. Permissions on the default project are needed only with the openai_responses protocol.

It is best to test the setup with a one-off request: kimi --model bedrock-kimi-k3-1 --prompt "…". If the response streams back, then authorization, permissions, region, and model access all work.

Pitfalls

First, the region. The provider does not read it from ~/.aws/config, so you must set AWS_REGION or AWS_DEFAULT_REGION in config.toml or in the environment. When you use a profile with the global., us., or in. prefix, this region becomes the source region for requests.

Second, model capabilities are not detected automatically. If you don't declare image_in or tool_use, the agent won't use them. List only what the model and the specific endpoint actually support. AWS recommends testing tools and images on your own tasks rather than trusting the labels alone.

Third, the interface. The Kimi Code desktop and web apps do not yet show all the environment fields for this provider, so you have to configure it directly in the file. The "connected" status in the provider list says nothing about permissions, region, or network, so a test request remains the real check.

Fourth, if you need a VPC endpoint or Mantle, automatic detection of the protocol and address won't work. In that case, set protocol (openai, openai_responses, or anthropic) and a base_url with the right path, such as /openai/v1, in the model definition.

Costs and housekeeping

Bedrock bills inference per token and has no permanent infrastructure, so after experiments there is nothing to tear down except test IAM permissions and profiles. Keep in mind that deleting the local config does not revoke an active session. For workloads without data-residency requirements, AWS advises starting with the global inference profile, which is 10% cheaper than the geographic ones.

The practical upshot: if you already have SSO and session rotation, you can now connect Kimi Code to Bedrock without a new secret. That simplifies auditing and removes the question of where the key is stored. But you still shouldn't give this agent broad permissions. It runs commands in your project, so you should review every file change and shell command before approving it.

Story

Key Questions Answered

What changed in version 2.7.0?

Previously, the connection went through a generic provider of type openai or openai_responses. You had to specify a regional base_url and paste in a Bedrock API key. The key could be short-term or long-term, but either way it was a separate secret that you had to obtain, store somewhere, and revoke on time. The CLI now has a native bedrock provider. It uses the standard AWS credential chain: environment variables, named profiles, and SSO through IAM Identity Center.

How to set it up?

The AWS example uses Kimi K3.1 Pro Highspeed. The model supports streaming output, configurable reasoning, image input, and client-side tool calling. The steps are as follows. First, check that the AWS CLI sees the right identity. For SSO, use aws configure sso and aws sso login; for console credentials, you need aws login (AWS CLI 2.32.0 or newer). You can verify the identity with aws sts get-caller-identity. Next, edit ~/.kimi-code/config.toml.

What are the key details on Pitfalls?

First, the region. The provider does not read it from ~/.aws/config, so you must set AWS_REGION or AWS_DEFAULT_REGION in config.toml or in the environment. When you use a profile with the global., us., or in. prefix, this region becomes the source region for requests. Second, model capabilities are not detected automatically. If you don't declare image_in or tool_use, the agent won't use them. List only what the model and the specific endpoint actually support.

ZK
Zhemal Khamidun — CPO at Alpina Digital, product manager of AlpinaGPT. Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Unified AI Workspace · Nomad

Test Frontier LLMs & Autonomous Agents in One Workspace

Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.

Try Nomad AI →Launch Nomad Agent
What do you think?
Loading comments…