Home / Blog / Use Kimi Code CLI with models on Amazon Bedrock
Tech News

Use Kimi Code CLI with models on Amazon Bedrock

Kimi Code CLI v2.7.0 adds a native Amazon Bedrock provider, allowing developers to connect open foundation models via standard AWS credential chains.

By Dillip Chowdary • Nov 20, 2026 • Source: AWS Machine Learning Blog

Use Kimi Code CLI with models on Amazon Bedrock
Image: AWS Machine Learning Blog

At a glance

Product
Kimi Code CLI
Version
v2.7.0
Provider
Amazon Bedrock
Token lifetime
Up to 12 hours
Inference profile
global.moonshotai.kimi-k3.1
AWS CLI requirement
v2.32.0 or later for aws login

Moonshot AI released Kimi Code CLI v2.7.0, adding a native Amazon Bedrock provider to the open-source coding assistant. According to AWS Machine Learning Blog's report, the integration eliminates the need for separate, manually created Amazon Bedrock API keys by resolving credentials directly through the standard AWS CLI credential chain, including single sign-on profiles and temporary role assumptions.

This update focuses on configuring and routing developer workflows to foundation models such as Kimi K3.1 Pro Highspeed within an existing AWS security boundary. The guide serves software engineers, platform architects, and cloud administrators who require model streaming, client-side tool execution, and local CLI agent workflows without distributing long-lived tokens across developer machines.

01Native provider and credential chains

Moonshot AI replaced the requirement for custom API tokens by integrating standard AWS authentication into Kimi Code CLI v2.7.0. In earlier releases, connecting the agent to Amazon Bedrock required configuring generic connection blocks using OpenAI-compatible or OpenAI Responses API types alongside explicit access keys. The native provider directly connects to the local AWS environment, discovering default profiles, environment variables, or named single sign-on accounts.

Request handling operates within the AWS data protection boundary without transmitting secrets across unverified external endpoints. The client infers the correct regional endpoint and API wire format from the requested model identifier, while allowing users to override protocols when necessary. Engineering teams no longer need to manage static credentials or issue individual keys to every developer terminal running the agent.

Note: Ephemeral bearer tokens created by the provider remain valid for up to 12 hours or the active AWS session duration, whichever duration is shorter.

02Authentication routing and request pipeline

The native provider processes each model request through a four-stage execution pipeline. First, the CLI inspects local environment variables and resolves credentials via the standard AWS chain or a designated profile set in the AWS_PROFILE environment variable. Second, the runtime invokes @aws/bedrock-token-generator to mint a short-lived Amazon Bedrock bearer token that refreshes automatically before expiration.

Third, the client reads AWS_REGION or AWS_DEFAULT_REGION to construct the regional bedrock-runtime endpoint. For Kimi foundation models, this resolves to the standard OpenAI-compatible Chat Completions interface. Finally, the agent submits the prompt to the designated inference profile, such as global.moonshotai.kimi-k3.1, enabling response streaming and client-side tool calling during local coding workflows.

If a developer explicitly sets api_key or api_key_env inside config.toml, that static value takes precedence over the automated generator. However, relying on temporary bearer tokens aligns with recommended security practices by removing plain-text access tokens from user home directories.

03Configuration changes and credential differences

Older versions required manual API key minting and base URL management, whereas v2.7.0 automates token generation through native Bedrock libraries.

FeatureLegacy SetupNative Bedrock Provider
Provider Typeopenai or openai_responsesbedrock
AuthenticationManual Bedrock API KeyStandard AWS Credential Chain
Token HandlingLong-term or manual short-termAutomated via @aws/bedrock-token-generator
Token ValidityStatic or manual expiryUp to 12 hours or AWS session limit
SSO SupportExternal / manual syncNative AWS IAM Identity Center
Endpoint SelectionManual regional base_urlInferred regional runtime endpoint

The transition from manual key configurations to AWS CLI resolution reduces credential management overhead while maintaining full compatibility with global cross-region inference profiles.

04IAM policies and least privilege permissions

Advertisement

Tech Pulse Daily

Get tomorrow's pulse first

Join engineers who read Tech Pulse before stand-up. Free, weekday mornings.

Connecting the agent requires an AWS account with access to the target model in a supported region, alongside an IAM identity configured with explicit Bedrock actions. Administrators must grant permissions for short-term bearer token generation, inference profile discovery, and model invocation.

  1. Step name Assign bedrock:CallWithBearerToken with a string condition matching bedrock:bearerTokenType to SHORT_TERM.
  2. Step name Grant bedrock:GetInferenceProfile for arn:aws:bedrock:${AWS_REGION}:${AWS_ACCOUNT_ID}:inference-profile/global.moonshotai.kimi-k3.1.
  3. Step name Enable bedrock:InvokeModel and bedrock:InvokeModelWithResponseStream against the global inference profile ARN.
  4. Step name Add invocation rights for foundation model ARNs arn:aws:bedrock:${AWS_REGION}::foundation-model/moonshotai.kimi-k3.1 and arn:aws:bedrock:::foundation-model/moonshotai.kimi-k3.1 scoped to the inference profile condition.
  5. Step name Grant bedrock:InvokeModel on project/default if using the openai_responses protocol instead of standard chat completions.

Security teams should assign these permissions to dedicated IAM roles rather than broad administrative credentials to enforce least privilege access.

05Profile setup and configuration steps

Developers can update their CLI installation and initialize their AWS credentials through standard terminal commands.

To configure an IAM Identity Center profile and verify the resolved identity, execute:

Command
aws configure sso --profile dev-bedrock
aws sso login --profile dev-bedrock
aws sts get-caller-identity --profile dev-bedrock

For AWS Management Console credentials on AWS CLI v2.32.0 or later, authenticate directly using:

Command
aws login --profile dev-bedrock

To verify the CLI version and point execution to the new native provider, configure the config.toml file:

Command
kimi --version
Command
```toml
[providers.bedrock]
type = "bedrock"
region = "us-west-2"

[models.kimi-k3-1] provider = "bedrock" model = "global.moonshotai.kimi-k3.1" ```

To run tasks with the designated profile and model alias, export the environment variable and launch the agent:

Command
export AWS_PROFILE=dev-bedrock
kimi --model kimi-k3-1

Frequently asked questions

How does Kimi Code CLI v2.7.0 authenticate with Amazon Bedrock?

It uses the standard AWS CLI credential chain to generate temporary bearer tokens using @aws/bedrock-token-generator, supporting named profiles and single sign-on.

How long are the generated Bedrock bearer tokens valid?

The tokens remain valid for up to 12 hours or the lifetime of your active AWS session, whichever duration is shorter.

Do developers still need to store an Amazon Bedrock API key in config.toml?

No, the native bedrock provider resolves credentials dynamically, though explicit keys set via api_key or api_key_env can still override it.

Sources

Dillip Chowdary

Author

Dillip Chowdary

Writes Tech Bytes coverage of AI, engineering, and the tools that actually ship. Editor of Tech Pulse Daily.

Related on Tech Bytes

Advertisement

5-min tech signal

Weekday briefing for engineers who skip the noise.

No spam · Unsubscribe anytime

Advertisement

✈️ CareerPilot

Your AI job-search copilot

Match your resume against live Ashby, Greenhouse & Lever openings — fit scores, job-specific resume optimization and email alerts.

Find matching jobs →

Free Tools

Browse all tools →