# Kimi Code CLI 2.7 Native Bedrock Provider: Use AWS SSO Instead of an API Key

> Source: <https://explainx.ai/blog/kimi-code-cli-2-7-native-bedrock-provider-aws-credentials-setup-guide-2026?utm_source=rss&utm_medium=feed&utm_campaign=blog>
> Published: 2026-11-20 00:00:00+00:00

**Key takeaway:** Kimi Code CLI v2.7.0's `bedrock` provider resolves credentials from the standard AWS chain and mints short-lived Bedrock tokens via `@aws/bedrock-token-generator`, so no AWS access key goes in `config.toml`; an explicitly configured Bedrock API key still takes precedence.

**Kimi Code CLI v2.7.0 can now talk to Amazon Bedrock with your normal AWS login instead of a separate API key.** Moonshot AI added a native `bedrock` provider, and AWS published a walkthrough on November 19, 2026 in [Use Kimi Code CLI with models on Amazon Bedrock](https://aws.amazon.com/blogs/machine-learning/use-kimi-code-cli-with-models-on-amazon-bedrock/?ref=explainx). The example model is Kimi K3.1 Pro Highspeed.

This guide explains what changed, gives the config and IAM policy from the AWS post, and flags the traps AWS itself lists. It builds on our earlier [Kimi K3.1 Pro on Bedrock with OpenCode](https://explainx.ai/blog/kimi-k3-1-pro-amazon-bedrock-highspeed-opencode-guide-2026) post, which covered model IDs, caching and the Flex tier.

## TL;DR: what you need to know

| Question | Answer | 
|---|---|
| What is new? | A native `bedrock` provider in Kimi Code CLI v2.7.0 | 
| Do I need a Bedrock API key? | No, unless you want one; an explicit key takes precedence | 
| Which auth works? | Default AWS chain, named profiles, SSO, `aws login` (CLI v2.32.0 or later) | 
| Which model in the example? | `global.moonshotai.kimi-k3.1` (Kimi K3.1 Pro Highspeed) | 
| Key lifetime? | Up to 12 hours or your session length, whichever is shorter | 
| Where do I configure it? | `~/.kimi-code/config.toml` , not the desktop or web UI | 
| Is billing per token? | Yes, AWS says Bedrock inference is charged per token | 

## What was the old setup and why change it?

Before v2.7.0, you connected Kimi Code to Bedrock through a provider with `type = "openai"` or `type = "openai_responses"`. Those use the OpenAI-compatible Chat Completions or Responses APIs. You had to set the regional `base_url` and supply a Bedrock API key, short-term or long-term. AWS notes this meant one more credential to obtain and protect.

The native provider removes that step. It follows the same credential chain as the AWS CLI. If your company already signs people in with IAM Identity Center, the coding agent inherits that sign-in. That matters for security teams who prefer to avoid long-lived keys sitting in dotfiles. We saw why in [the OpenCode console breach that exposed stored API keys](https://explainx.ai/blog/opencode-console-breach-stored-api-keys-distillation-attack-what-to-do-2026).

## How does the provider work?

AWS describes four steps:

1. **Resolve credentials.** Unless you configure a Bedrock key, the provider uses the standard AWS credential chain. Set`AWS_PROFILE` to pick a named profile.
2. **Mint a short-lived token.** It uses`@aws/bedrock-token-generator` to create a short-term Bedrock key and renews it when necessary. You do not place any AWS access key in`config.toml` .
3. **Build the regional endpoint.** It reads`AWS_REGION` or`AWS_DEFAULT_REGION` and builds the`bedrock-runtime` endpoint. For Kimi models this resolves to the recommended OpenAI-compatible Chat Completions path.
4. **Call the inference profile.** The model alias maps to a Bedrock model or inference profile ID.

Terminal prompt with a block cursor for running Kimi Code CLI against Amazon Bedrock

## What do I need before starting?

- An AWS account with access to the target model and inference profile in a supported source Region (check the Kimi K3.1 Pro Highspeed model card).
- Kimi Code CLI v2.7.0 or later; check with `kimi --version` .
- The AWS CLI. The optional `aws login` flow needs v2.32.0 or later.
- An IAM identity with permission to invoke the model and profile.

AWS's example policy has five statements: `bedrock:CallWithBearerToken` limited to short-term tokens, `bedrock:GetInferenceProfile` on the Kimi inference profile, and `InvokeModel` plus `InvokeModelWithResponseStream` on the global profile and on the foundation model. A fifth statement, allowing `InvokeModel` on the `default` project, is only needed for the `openai_responses` protocol, not the default Chat Completions. The foundation-model ARN with no Region or account ID is deliberate and required for global cross-Region routing. AWS recommends least privilege and a dedicated IAM role for Kimi Code.

## Step by step setup

**Step 1: sign in.** For SSO, run `aws configure sso --profile YOUR_PROFILE_NAME` and then `aws sso login --profile YOUR_PROFILE_NAME`. Verify with `aws sts get-caller-identity --profile YOUR_PROFILE_NAME`. A Region set in your AWS CLI profile does not carry over to Kimi Code.

**Step 2: edit `~/.kimi-code/config.toml`** (or `$KIMI_CODE_HOME/config.toml`). Back up any existing file and merge:

```
default_model = "bedrock-kimi-k3-1"

[providers.bedrock]
type = "bedrock"

[providers.bedrock.env]
AWS_REGION = "YOUR_SOURCE_REGION"
# AWS_PROFILE = "YOUR_PROFILE_NAME"

[models.bedrock-kimi-k3-1]
provider = "bedrock"
model = "global.moonshotai.kimi-k3.1"
max_context_size = 1000000
capabilities = ["always_thinking", "thinking", "image_in", "tool_use"]
```

**Step 3: test.** Run a small non-interactive request:

```
kimi --model bedrock-kimi-k3-1 --prompt "Write a Python function that checks whether a string is a palindrome. Include a short usage example."
```

If it streams a response without authentication, authorisation, Region, model-access or network errors, start a session in a project with `kimi`. Review proposed file changes and shell commands before approving them.

## What are the gotchas?

AWS lists several at the time of writing.

Vault door and key representing scoped AWS credentials for Kimi Code CLI on Bedrock

- **Edit the file, not the UI.** The desktop and web provider-creation interfaces do not expose all the environment fields for this setup.
- **Declare capabilities.** Kimi Code does not auto-detect them for most Bedrock models. Declare only what the model supports, and test tool and image workflows yourself.
- **Set the Region explicitly.** The provider cannot infer a Region from`~/.aws/config` . With an inference-profile prefix such as`global.` ,`us.` or`in.` , the Kimi Region sets the source Region that receives requests.
- **Status is not proof.** The desktop and web apps may show the bedrock provider as connected. That does not validate credentials, permissions, Region, model access or the network path.
- **Cleanup.** Delete any IAM identity you created for testing. Deleting local config does not by itself revoke permissions or an active session.

## Cost: why global is the default suggestion

AWS recommends starting with the global inference profile for workloads without data-residency requirements. It says this model, like many others, is priced 10% lower for global inference than through geographic profiles. We did not re-check the rates, so read the Bedrock pricing page. Bedrock bills per token, so there is no standing infrastructure to remove. For how Bedrock's four inference choices compare on cost, see [Bedrock cache and Flex tier choices](https://explainx.ai/blog/aws-bedrock-four-inference-choices-cost-cache-flex-guide-2026).

## Using a VPC endpoint or a different protocol

If auto-detection picks the wrong API format or URL, you can override the model entry with a `protocol` of `openai`, `openai_responses` or `anthropic`, and a `base_url` that includes the API path such as `/openai/v1` or `/anthropic`. AWS shows a VPC endpoint example with `protocol = "openai_responses"` and a `vpce-` URL. VPC endpoints and Mantle endpoints are the cases where you will need it. The extra `default` project IAM statement applies if you choose `openai_responses`.

## How does this compare with other coding agents on Bedrock?

Kimi Code is one of several agents that can reach Bedrock models with AWS identity. We have walked through [Codex with Bedrock SSO and AgentCore Gateway](https://explainx.ai/blog/openai-codex-amazon-bedrock-sso-agentcore-gateway-setup-guide-2026) and the cost side in [AI coding tools per-user cost with IAM Identity Center](https://explainx.ai/blog/amazon-bedrock-ai-coding-tools-per-user-cost-iam-identity-center-2026). The pattern is the same: tie the agent's access to your identity provider so you can revoke it centrally and attribute spend. For the model's own capabilities and open weights, read [Kimi K3.1 Pro: open weights, benchmarks and price](https://explainx.ai/blog/kimi-k3-1-pro-open-weights-benchmarks-price-terminal-bench-nov-4-2026).

## What searchers are asking

**Can I use Kimi Code CLI with AWS SSO?** Yes, per AWS: set up an SSO profile, log in, and set `AWS_PROFILE` in the provider env table.

**Do I still need a Bedrock API key?** Not unless you want one. If you set `api_key`, `api_key_env` or `AWS_BEARER_TOKEN_BEDROCK`, that key wins.

**Is my code sent outside AWS?** AWS says Bedrock processing stays within the AWS data boundary, as described in its User Guide. Check which Region your profile routes to if residency matters.

## Troubleshooting checklist

When the first request fails, AWS's list of required conditions is the best map: authentication, authorisation, model access and network connectivity must all succeed. Work through them in order.

1. **Authentication.** Run`aws sts get-caller-identity` with the same profile. If it fails, your SSO session expired; run`aws sso login` again.
2. **Region.** Confirm`AWS_REGION` is set in the provider env table or your shell. A Region that lives only in`~/.aws/config` is ignored by Kimi Code.
3. **Model access.** Check the Bedrock model card for your source Region and confirm your account has access to the model and the inference profile.
4. **Authorisation.** Compare your IAM policy with the five statements above. The most common gap is the foundation-model ARN without a Region or account ID, which global routing needs.
5. **Network.** If you use a VPC endpoint, confirm the`base_url` includes the API path and that the`protocol` matches what the model supports.

## Security review before a team rollout

A native provider reduces key handling, but it does not remove the agent's reach. The agent can propose shell commands and file edits, and AWS tells you to review them before approving. Before rolling this out to a team, decide who can assume the dedicated IAM role, how long sessions last, and who sees the Bedrock invocation logs. If a developer's laptop is compromised during the 12-hour token window, the token is usable until it expires, so keep the policy narrow. Our post on the [litellm PyPI compromise](https://explainx.ai/blog/litellm-1-107-0-pypi-compromise-credential-stealer-wheels-what-to-do-2026) shows how stolen cloud credentials get used in practice.

For the launch details of the model itself, AWS has a separate post, [Introducing Kimi K3.1 Pro on Amazon Bedrock](https://aws.amazon.com/blogs/machine-learning/introducing-kimi-k3-1-pro-on-amazon-bedrock/?ref=explainx), and Moonshot AI describes the release in its own [Kimi K3.1 Pro announcement](https://www.kimi.ai/blog/kimi-k3-1-pro?ref=explainx).

## What is not covered

AWS's post does not give benchmark results for the Kimi model through Bedrock, and it does not state a price per token in the walkthrough. It is a setup guide, so judge model quality on your own repository.

## Related reading

*Versions, model IDs and prices are as stated in AWS's November 19, 2026 post and may change.*
