Automationscribe.com
  • Home
  • AI Scribe
  • AI Tools
  • Artificial Intelligence
  • Contact Us
No Result
View All Result
Automation Scribe
  • Home
  • AI Scribe
  • AI Tools
  • Artificial Intelligence
  • Contact Us
No Result
View All Result
Automationscribe.com
No Result
View All Result

Use Kimi Code CLI with fashions on Amazon Bedrock

admin by admin
November 27, 2026
in Artificial Intelligence
0
Use Kimi Code CLI with fashions on Amazon Bedrock
399
SHARES
2.3k
VIEWS
Share on FacebookShare on Twitter


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 bedrock supplier 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:

  1. 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_PROFILE to pick a selected named profile.
  2. 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 via api_key or api_key_env takes priority when you present it.
  3. Construct the regional endpoint. The supplier resolves AWS_REGION or AWS_DEFAULT_REGION and constructs the suitable bedrock-runtime endpoint for the mannequin’s inferred API. For Kimi fashions, this resolves to the beneficial OpenAI-compatible Chat Completions path.
  4. 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. The world. prefix selects the profile, whereas AWS_REGION determines 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 --version to verify your set up.
  • The AWS CLI, to observe the profile and identity-check instructions on this publish. The non-compulsory aws login workflow 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:

{
  "Model": "2012-10-17",
  "Assertion": [
    {
      "Sid": "BedrockShortTermBearerToken",
      "Effect": "Allow",
      "Action": "bedrock:CallWithBearerToken",
      "Resource": "*",
      "Condition": {
        "StringEquals": {
          "bedrock:bearerTokenType": "SHORT_TERM"
        }
      }
    },
    {
      "Sid": "BedrockReadKimiK31InferenceProfile",
      "Effect": "Allow",
      "Action": "bedrock:GetInferenceProfile",
      "Resource": "arn:aws:bedrock:${AWS_REGION}:${AWS_ACCOUNT_ID}:inference-profile/global.moonshotai.kimi-k3.1"
    },
    {
      "Sid": "BedrockInvokeKimiK31GlobalProfile",
      "Effect": "Allow",
      "Action": [
        "bedrock:InvokeModel",
        "bedrock:InvokeModelWithResponseStream"
      ],
      "Useful resource": "arn:aws:bedrock:${AWS_REGION}:${AWS_ACCOUNT_ID}:inference-profile/world.moonshotai.kimi-k3.1"
    },
    {
      "Sid": "BedrockInvokeKimiK31ModelsThroughGlobalProfile",
      "Impact": "Permit",
      "Motion": [
        "bedrock:InvokeModel",
        "bedrock:InvokeModelWithResponseStream"
      ],
      "Useful resource": [
        "arn:aws:bedrock:${AWS_REGION}::foundation-model/moonshotai.kimi-k3.1",
        "arn:aws:bedrock:::foundation-model/moonshotai.kimi-k3.1"
      ],
      "Situation": {
        "StringEquals": {
          "bedrock:InferenceProfileArn": "arn:aws:bedrock:${AWS_REGION}:${AWS_ACCOUNT_ID}:inference-profile/world.moonshotai.kimi-k3.1"
        }
      }
    },
    {
      "Sid": "BedrockInvokeKimiK31DefaultProject",
      "Impact": "Permit",
      "Motion": [
        "bedrock:InvokeModel"
      ],
      "Useful resource": "arn:aws:bedrock:${AWS_REGION}:${AWS_ACCOUNT_ID}:challenge/default",
      "Situation": {
        "StringEquals": {
          "bedrock:ModelArn": "arn:aws:bedrock:${AWS_REGION}:${AWS_ACCOUNT_ID}:inference-profile/world.moonshotai.kimi-k3.1"
        }
      }
    }
  ]
}

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_NAME to arrange a profile, then run aws sso login --profile YOUR_PROFILE_NAME to 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 a credential_process configuration for instruments that don’t help the cached login session straight.
  • Omit the --profile arguments 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:

aws sts get-caller-identity --profile YOUR_PROFILE_NAME

Step 2: Add the supplier and mannequin

  1. Open or create ~/.kimi-code/config.toml in a textual content editor. In case you set KIMI_CODE_HOME, use $KIMI_CODE_HOME/config.toml as 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.
  2. Exchange YOUR_SOURCE_REGION along with your supported supply Area (for instance, us-west-2). To make use of a named profile, substitute YOUR_PROFILE_NAME and uncomment the AWS_PROFILE line:
    default_model = "bedrock-kimi-k3-1"
    
    [providers.bedrock]
    kind = "bedrock"
    
    [providers.bedrock.env]
    AWS_REGION = "YOUR_SOURCE_REGION"
    # AWS_PROFILE = "YOUR_PROFILE_NAME"
    
    [models.bedrock-kimi-k3-1]
    supplier = "bedrock"
    mannequin = "world.moonshotai.kimi-k3.1"
    max_context_size = 1000000
    capabilities = ["always_thinking", "thinking", "image_in", "tool_use"]

    The mannequin alias bedrock-kimi-k3-1 is 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 omits api_key, api_key_env, and AWS_BEARER_TOKEN_BEDROCK, so the supplier makes use of ambient AWS credentials. A configured Amazon Bedrock key would take priority.

  3. 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

  1. Run a small non-interactive coding request:
    kimi --model bedrock-kimi-k3-1 --prompt "Write a Python operate that checks whether or not a string is a palindrome. Embrace a brief utilization instance."

  2. 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.
  3. Begin an interactive session in a challenge listing:
    cd /path/to/your/challenge
    kimi

    Since you set default_model, the session selects bedrock-kimi-k3-1 routinely. 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 protocol subject to openai (Chat Completions), openai_responses, or anthropic (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_url subject to vary the goal URL, which should embrace any connected API path like /openai/v1 or /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:

[models.bedrock-kimi-k3-1]
supplier = "bedrock"
mannequin = "world.moonshotai.kimi-k3.1"
max_context_size = 1000000
capabilities = ["always_thinking", "thinking", "image_in", "tool_use"]
protocol = "openai_responses"
base_url = "https://vpce-EXAMPLE-VPCEID.bedrock-runtime.us-west-2.vpce.amazonaws.com/openai/v1"

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

Alex Thewsey

Alex Thewsey

Alex is an AI Specialist Options Architect at AWS. He focuses on how open supply applied sciences and open weight fashions will help clients all over the world to construct progressive AI options and deal with AI governance challenges.

Saurabh Trikande

Saurabh Trikande

Saurabh is a Senior Product Supervisor for Amazon Bedrock and Amazon SageMaker Inference. He focuses on serving to clients deploy generative AI purposes, with an emphasis on multi-tenant inference and price optimization. In his spare time, he enjoys mountaineering and studying about new applied sciences.

Aris Tsakpinis

Aris Tsakpinis

Aris is a Senior Specialist Options Architect for Generative AI specializing in open-weight fashions on Amazon Bedrock and the broader generative AI open supply neighborhood. Alongside his skilled position, he’s pursuing a PhD in Machine Studying Engineering on the College of Regensburg, the place his analysis focuses on utilized pure language processing in scientific domains.

Tags: AmazonBedrockCLIcodeKimiModels
Previous Post

Introducing enhanced infrastructure observability in Amazon SageMaker HyperPod

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Popular News

  • Speed up edge AI improvement with SiMa.ai Edgematic with a seamless AWS integration

    Speed up edge AI improvement with SiMa.ai Edgematic with a seamless AWS integration

    409 shares
    Share 164 Tweet 102
  • The Journey from Jupyter to Programmer: A Fast-Begin Information

    407 shares
    Share 163 Tweet 102
  • Greatest practices for Amazon SageMaker HyperPod activity governance

    407 shares
    Share 163 Tweet 102
  • Context Engineering — A Complete Fingers-On Tutorial with DSPy

    407 shares
    Share 163 Tweet 102
  • Construct a serverless audio summarization resolution with Amazon Bedrock and Whisper

    406 shares
    Share 162 Tweet 102

About Us

Automation Scribe is your go-to site for easy-to-understand Artificial Intelligence (AI) articles. Discover insights on AI tools, AI Scribe, and more. Stay updated with the latest advancements in AI technology. Dive into the world of automation with simplified explanations and informative content. Visit us today!

Category

  • AI Scribe
  • AI Tools
  • Artificial Intelligence

Recent Posts

  • Use Kimi Code CLI with fashions on Amazon Bedrock
  • Introducing enhanced infrastructure observability in Amazon SageMaker HyperPod
  • Asserting Amazon Textract Insights: Verifiable generative AI for paperwork
  • Home
  • Contact Us
  • Disclaimer
  • Privacy Policy
  • Terms & Conditions

© 2024 automationscribe.com. All rights reserved.

No Result
View All Result
  • Home
  • AI Scribe
  • AI Tools
  • Artificial Intelligence
  • Contact Us

© 2024 automationscribe.com. All rights reserved.