Kimi Code CLI is an open supply coding agent from Moonshot AI, the creator of the Kimi sequence of open-weight basis fashions. Beforehand, utilizing Kimi Code with fashions on Amazon Bedrock meant configuring a generic connection “supplier” with an Amazon Bedrock API key. For a lot of AWS clients, this meant introducing an additional credential to acquire and defend.
With v2.7.0, Moonshot AI provides a local bedrock supplier to the CLI. Now you can configure the agent to make use of your normal AWS credential chain, together with named profiles and single sign-on (SSO), as an alternative of making and managing a separate API key.
On this publish, we present you how you can join Kimi Code CLI to fashions on Amazon Bedrock utilizing your present AWS credentials. We use Kimi K3.1 Professional Highspeed for instance, which helps streaming, configurable reasoning, picture enter, and client-side software calling.
What’s new
Amazon Bedrock offers pay-per-token inference for a variety of open and proprietary fashions from main suppliers, obtainable via normal APIs. Processing stays inside the AWS information boundary, as detailed within the Knowledge safety part of the Person Information. The mannequin playing cards element which APIs and options are supported for every mannequin.
In older variations of the Kimi Code CLI, you might hook up with Amazon Bedrock via a supplier with kind = "openai" or kind = "openai_responses". These use the OpenAI-compatible Chat Completions or Responses APIs, respectively. This method required you to set the regional base_url and supply an Amazon Bedrock API key. The important thing may very well be short-term or long-term, but it surely was a separate credential so that you can acquire and handle.
The native supplier modifications that setup:
- Use your present AWS authentication workflow. The
bedrocksupplier can resolve momentary credentials via the usual AWS Command Line Interface (AWS CLI) credential chain. You should use the default chain or choose a named profile, together with a profile backed by SSO. - Override the protocol for every mannequin, if wanted. The supplier infers an API format and regional endpoint from the mannequin ID, however you possibly can change them as detailed within the “Override endpoint URL and protocol” part of this publish.
AWS recommends short-term credentials over long-term credentials. This new path reduces reliance on manually managed API keys, but it surely doesn’t change your accountability to guard AWS credentials and scope permissions appropriately.
The way it works
The native supplier handles authentication and request routing in 4 steps:
- Resolve AWS credentials. Until you configure an Amazon Bedrock API key, the bedrock supplier makes use of the usual AWS credential chain in your atmosphere. You may set
AWS_PROFILEto pick a selected named profile. - Generate a short-lived bearer token. The supplier makes use of @aws/bedrock-token-generator to create a short-term Amazon Bedrock API key, and renews it when essential. You don’t want to position any AWS entry key or manually generated Amazon Bedrock key within the Kimi Code
config.toml. Nonetheless, an specific key given viaapi_keyorapi_key_envtakes priority when you present it. - Construct the regional endpoint. The supplier resolves
AWS_REGIONorAWS_DEFAULT_REGIONand constructs the suitablebedrock-runtimeendpoint for the mannequin’s inferred API. For Kimi fashions, this resolves to the beneficial OpenAI-compatible Chat Completions path. - Name the chosen inference profile. The mannequin alias maps to an Amazon Bedrock mannequin or inference profile ID. This instance makes use of the worldwide inference profile
world.moonshotai.kimi-k3.1. Theworld.prefix selects the profile, whereasAWS_REGIONdetermines the regional endpoint that receives your request.
The CLI then streams the mannequin response and might use the mannequin’s client-side tool-calling help throughout coding duties. Authentication, authorization, mannequin entry, and community connectivity should all succeed for a request to finish. The ephemeral API keys generated by the supplier are legitimate for as much as 12 hours or your AWS session size, whichever is shorter.
Stipulations
For this walkthrough, we use Kimi K3.1 Professional Highspeed for instance mannequin, accessed via world cross-Area inference for broadest availability and lowest price. Evaluate the Amazon Bedrock pricing to know anticipated prices earlier than utilizing the mannequin.
To observe alongside, you want:
- An AWS account with entry to the goal mannequin and inference profile in a supported supply AWS Area. Test the Kimi K3.1 Professional Highspeed mannequin card for present Area and inference-profile help.
- Kimi Code CLI v2.7.0 or later. Comply with the Kimi Code CLI set up information and run
kimi --versionto verify your set up. - The AWS CLI, to observe the profile and identity-check instructions on this publish. The non-compulsory
aws loginworkflow requires AWS CLI v2.32.0 or later. - An AWS Identification and Entry Administration (IAM) identification (person or assumed position) with permissions to invoke the goal mannequin and inference profile in your chosen AWS Area.
The next instance IAM coverage grants the permissions utilized by this walkthrough, for the Kimi K3.1 Professional Highspeed mannequin and world inference profile solely. Exchange ${AWS_REGION} along with your supply Area (for instance, us-west-2 for US West Oregon) and ${AWS_ACCOUNT_ID} along with your 12-digit AWS account ID:
The muse-model ARN and not using a Area or account ID is intentional and required for world cross-Area routing. The BedrockInvokeKimiK31DefaultProject assertion is just required if utilizing the openai_responses protocol, not with the default openai (Chat Completions).
Safety of your AWS atmosphere is a shared accountability. Evaluate and grant IAM permissions in keeping with the precept of least privilege, notably for manufacturing environments. Think about using a devoted IAM position for Kimi Code CLI, separate out of your common AWS actions.
Get began with the bedrock supplier
After your conditions are prepared, observe these steps to configure AWS authentication, add the supplier and mannequin, and ship a take a look at request.
Step 1: Configure AWS credentials
There are other ways to authenticate with the AWS CLI, relying in your group’s setup. With Named profiles, you possibly can configure a number of AWS contexts and change between them.
For instance:
- In case you use SSO via AWS IAM Identification Middle, run
aws configure sso --profile YOUR_PROFILE_NAMEto arrange a profile, then runaws sso login --profile YOUR_PROFILE_NAMEto authenticate. - To make use of AWS Administration Console credentials with AWS CLI v2.32.0 or later, run
aws login --profile YOUR_PROFILE_NAME. The console-credential login information additionally describes acredential_processconfiguration for instruments that don’t help the cached login session straight. - Omit the
--profilearguments to make use of your default AWS profile as an alternative of a named one.
Whichever method you select, your session resolves to an IAM identification (person or position) that wants the Amazon Bedrock permissions from the conditions. A Area configured in an AWS CLI profile applies to AWS CLI instructions, however you will need to nonetheless set the Area explicitly for Kimi Code in Step 2.
Confirm that the AWS CLI resolves your supposed identification. Omit --profile YOUR_PROFILE_NAME when you use the default profile:
Step 2: Add the supplier and mannequin
- Open or create
~/.kimi-code/config.tomlin a textual content editor. In case you setKIMI_CODE_HOME, use$KIMI_CODE_HOME/config.tomlas an alternative. In case you have an present file, again it up and merge these entries along with your present settings moderately than overwriting unrelated suppliers or fashions. - Exchange
YOUR_SOURCE_REGIONalong with your supported supply Area (for instance,us-west-2). To make use of a named profile, substituteYOUR_PROFILE_NAMEand uncomment theAWS_PROFILEline:The mannequin alias
bedrock-kimi-k3-1is a neighborhood identify utilized by Kimi Code CLI. The mannequin worth is the Amazon Bedrock world inference-profile ID. The instance declares a 1-million-token context window and specific reasoning, image-input, and tool-use capabilities. It omitsapi_key,api_key_env, andAWS_BEARER_TOKEN_BEDROCK, so the supplier makes use of ambient AWS credentials. A configured Amazon Bedrock key would take priority. - Save the file. The
[providers.bedrock.env]desk provides configuration to the supplier. It doesn’t export variables into your shell.
Step 3: Ship a request and begin a coding session
- Run a small non-interactive coding request:
- Verify that the CLI streams a response with out an authentication, authorization, Area, model-access, or community error. This request offers a extra significant connectivity verify than a supplier standing indicator.
- Begin an interactive session in a challenge listing:
Since you set
default_model, the session selectsbedrock-kimi-k3-1routinely. Ask the agent to clarify the repository or suggest a small change. Evaluate its proposed file modifications and shell instructions earlier than approving them.
Configuration greatest practices
On the time of writing, the native bedrock supplier has a number of configuration concerns. These practices enable you to keep away from ambiguous standing data and mismatched settings.
Use the configuration file to arrange the supplier
On the time of writing, Kimi Code’s desktop and net provider-creation interfaces don’t expose all of the supplier atmosphere fields utilized by this credential-chain setup. Edit config.toml on to arrange the Amazon Bedrock supplier. For additional particulars, seek advice from Mannequin suppliers within the Kimi Code documentation.
Declare mannequin capabilities explicitly
Kimi Code doesn’t auto-detect the capabilities of most fashions on Amazon Bedrock, together with Kimi fashions. Test the Amazon Bedrock mannequin card for every goal mannequin and explicitly declare its capabilities to let Kimi Code make use of them.
For instance, Kimi K3.1 Professional Highspeed helps always_thinking, pondering, image_in, and tool_use, however not audio_in or video_in, as mirrored within the config.toml instance proven earlier.
These declarations describe shopper habits. You need to solely embrace capabilities which might be supported for every goal mannequin and Amazon Bedrock API endpoint. Validate software and picture workflows on your software moderately than counting on the potential labels alone.
Maintain Area settings constant and like cross-Area inference the place doable
The bedrock supplier requires an specific AWS_REGION or AWS_DEFAULT_REGION in Kimi Code’s config.toml or the shell atmosphere. It may well’t infer a Area configured solely in ~/.aws/config or via aws configure.
Whenever you use cross-Area inference profiles (with prefixes equivalent to world., us., or in.), the configured Kimi Code Area controls the supply Area that receives your requests. For extra data, seek advice from cross-Area inference within the Amazon Bedrock Person Information.
For workloads with out data-residency necessities, begin with the worldwide inference profile. This mannequin, like many others, is priced 10% decrease for world inference than via geographic profiles. Evaluate Amazon Bedrock pricing for present charges and geographic options.
Override endpoint URL and protocol the place wanted
In some instances, the supplier’s auto-detection may mistake the API protocol or goal URL you wish to use for a selected mannequin. For instance, you will have to set a unique URL to make use of Amazon Bedrock via a VPC endpoint or the Mantle endpoints.
Within the Kimi Code config.toml, you possibly can:
- Set the
protocolsubject toopenai(Chat Completions),openai_responses, oranthropic(Messages) to configure a mannequin to make use of a selected supported wire protocol. See the mannequin playing cards for which fashions help which APIs. - Set the
base_urlsubject to vary the goal URL, which should embrace any connected API path like/openai/v1or/anthropic.
Within the following instance, we present a configuration to connect with the identical mannequin however utilizing the OpenAI Responses API via an Amazon Bedrock VPC endpoint you’ve arrange:
Deal with connectivity standing as a configuration indicator
Within the Kimi Code desktop and net apps, the supplier record can present linked for a bedrock supplier. That standing doesn’t validate the configured AWS credentials, IAM permissions, Area, mannequin entry, or community path. Don’t deal with it as proof of a profitable mannequin request. Use the non-interactive immediate to check the entire path, and diagnose the precise response if it fails.
Cleanup
In case you created a brand new AWS IAM identification or assigned new permissions to experiment with Kimi K3.1 Professional on Amazon Bedrock, bear in mind to delete them once you’re completed testing.
You may additionally wish to revert any native Kimi Code CLI supplier configurations or AWS CLI profiles you arrange. You may even uninstall the CLIs altogether in the event that they’re now not required. See the uninstall guides for Kimi Code and AWS CLI for particulars. Do not forget that deleting the native AWS configuration or CLI doesn’t by itself revoke IAM permissions or an energetic AWS session.
Amazon Bedrock inference for the fashions we confirmed is charged on a per-token foundation, so there’s no persistent cloud infrastructure deployment to scrub up.
Conclusion
We confirmed how Moonshot AI’s native bedrock supplier in Kimi Code CLI v2.7.0 connects to Kimi K3.1 Professional Highspeed on Amazon Bedrock via the usual AWS credential chain. You now not want a individually managed Amazon Bedrock API key.
Amazon Bedrock offers you entry to open and proprietary AI fashions from main suppliers, via normal APIs. Its governance controls and compliance validation packages can help even strictly regulated workloads.
In case you’re already utilizing Kimi Code CLI and wish to run inference on AWS, improve in the present day and provides the brand new streamlined authentication a strive.
For extra details about Kimi K3.1 Professional on Amazon Bedrock, see our launch weblog publish and the Moonshot AI on AWS samples repository. To discover supported APIs and options by mannequin, see the mannequin playing cards within the Amazon Bedrock Person Information. To debate your use case with the Amazon Bedrock crew, join with us.
Concerning the authors

