Use Kimi Code CLI with models on Amazon Bedrock
The Kimi Code CLI v2.7.0 introduces a native Amazon Bedrock provider that eliminates the need for a separate Bedrock API key by leveraging the standard AWS credential chain (including named profiles and SSO). The provider generates short‑lived bearer tokens via **@aws/bedrock-token-generator**, builds the correct regional endpoint from the model ID, and routes requests to the chosen inference profile. This change simplifies credential management while still requiring proper AWS permission scoping. Engineers can now connect the Kimi Code CLI to models such as **Kimi K3.1 Pro Highspeed** using existing AWS credentials.
⚡ Key Takeaways
- v2.7.0 adds a native Bedrock provider to Kimi Code CLI, removing the need for a separate Bedrock API key.
- The provider resolves credentials through the AWS CLI credential chain and can select a named profile via the **AWS_PROFILE** environment variable.
- It generates short‑lived bearer tokens with **@aws/bedrock-token-generator**, renewing them automatically.
- Endpoint construction uses **AWS_REGION** or **AWS_DEFAULT_REGION** to form the appropriate Bedrock‑runtime URL, with optional overrides.
- An explicit `api_key` in `config.toml` still takes precedence, so existing key‑based setups remain compatible.
By reusing existing AWS authentication, teams reduce operational overhead and secret sprawl while maintaining secure, short‑lived access to Bedrock models, accelerating integration of coding agents into production pipelines.
✅ Practical Steps
- Set `AWS_PROFILE` (or rely on the default chain) to select the desired AWS credentials before running Kimi Code CLI.
- In `config.toml`, change the provider type to `"bedrock"` (or the appropriate native type) and omit `api_key` to let the CLI generate a short‑lived token automatically.
- (Optional) Override the endpoint URL or protocol in the config if a custom Bedrock endpoint is required.
Want the full story? Read the original article.
Read on AWS ML Blog ↗