The latest Kimi Code CLI release (v2.7.0) introduces a native bedrock provider that automatically uses the AWS CLI credential chain—named profiles, SSO, or default credentials—so you no longer have to provision a separate Bedrock API key. For anyone building or operating AI‑assisted tooling on Amazon Bedrock, this removes an extra secret to store, rotate, and protect.
What’s New in Kimi Code CLI
The new provider changes the connection model in three concrete ways:
- Credential source. The CLI now reads
AWS_PROFILE,AWS_REGION, or the default environment chain, just like any other AWS SDK call. - Automatic token generation. Internally it invokes
@aws/bedrock-token-generatorto create a short‑lived Bedrock bearer token, refreshing it as needed. - Endpoint inference. The provider derives the correct regional
bedrock-runtimeendpoint from the model identifier, with an override option for custom URLs.
How the Native Provider Works
- Resolve AWS credentials. If no explicit
api_keyis set, the provider follows the standard AWS credential resolution order, allowing you to select a profile viaAWS_PROFILEor rely on SSO‑backed credentials. - Generate a short‑lived bearer token. Using the
@aws/bedrock-token-generatorpackage, the CLI creates a temporary Bedrock token that supersedes any manually supplied API key. An explicitapi_keystill wins if provided. - Build the regional endpoint. The provider reads
AWS_REGION(orAWS_DEFAULT_REGION) and constructs the appropriatebedrock-runtimeURL for the model’s API format. For Moonshot Kimi models this resolves to the OpenAI‑compatible Chat Completions path. - Invoke the inference profile. The model alias (e.g.,
global.moonshotai.kimi-k3.1) maps to a Bedrock model or inference profile. Theglobal.prefix selects the profile, while the region determines the endpoint that receives the request.
Operational and Security Considerations
Switching to the native provider has several practical implications:
- Reduced secret surface. You no longer need to store a long‑term Bedrock API key, which lowers the risk of credential leakage.
- Short‑term token lifecycle. Generated tokens are valid for up to 12 hours or the length of the underlying AWS session, matching AWS’s recommendation to prefer temporary credentials.
- IAM permission scope. The AWS identity used must have the Bedrock runtime permissions required for the chosen model or inference profile. Review and tighten policies accordingly.
- Automation impact. CI/CD pipelines that previously injected a Bedrock key can now rely on the existing AWS credential chain, simplifying pipeline configuration and secret management.
- Region awareness. Because the provider builds the endpoint from
AWS_REGION, ensure the region matches the model’s availability; otherwise requests will fail.
Related CloudNinjas coverage: AWS.
What This Means For Practitioners
Adopt the native bedrock provider to align Kimi Code CLI with your organization’s AWS authentication strategy. Verify that the IAM role or user running the CLI has the necessary Bedrock permissions, and confirm that your profile or SSO setup resolves to the correct region. Monitor token expiration in long‑running sessions and be prepared to refresh credentials automatically. By eliminating a separate API key, you reduce operational overhead and improve the security posture of AI‑driven development workflows.


