AWS Machine Learning5h agoenergy 108

Introducing India-based inference for Kimi K3 on Amazon Bedrock

image: AWS Machine Learning

Kimi K3 is a multi-modal, open-weight foundation model (FM) that provider Moonshot AI reported achieved frontier-level coding and general agentic intelligence at release. In addition to global and US-based inference, Amazon Bedrock now supports in-country inference in India for Kimi K3: unblocking local workloads with strict data residency requirements. Customers like Ultrahuman are already seeing the benefits in production: “Jade, an AI Health and Wellness assistant in the Ultrahuman app, answers questions in plain language using each person’s own Ring and glucose data, across more than 14,000 conversations a day. Kimi K3 on Amazon Bedrock let us add a leading open-weight model through the API we already use, with health data staying inside AWS and Mumbai as a fallback Region. With prompt caching, we’ve cut LLM costs by 80 percent and made multi-turn chats 85 percent faster.” — Aditya Patawari, VP Engineering, Ultrahuman In this post, we explain the different global and geographic inference options available, and share code for an example use case: optical character recognition (OCR) and understanding of Indic-language documents, with follow-up question answering in code-mixed Hinglish. Choose where inference can run Kimi K3 on Amazon Bedrock is offered through cross-Region inference profiles . You can invoke the model from any of a wide range of AWS Regions (the “source”). Amazon Bedrock then securely processes your request in one of multiple possible “destination” Regions. Cross-Region inference is fully managed by AWS: Data is encrypted in transit between Regions and remains on the AWS network, never traversing the public internet or requiring you to set up any multi-Region virtual private cloud (VPC) infrastructure. The inference profile ID you invoke controls which destination Regions are eligible: Profile Model ID When to choose it Global global.moonshotai.kimi-k3 Recommended for most use cases: lowest cost and most broadly available India geographic in.moonshotai.kimi-k3 Inference processing must stay within Mumbai and Hyderabad Regions See the Amazon Bedrock Kimi K3 model card for up-to-date information on available inference profiles, which AWS Regions they can be called from, and what destination Regions they can use for inference. Example walkthrough: Indic-language document understanding Let’s consider an example use case: reading a scanned Hindi document, extracting structured data, and answering follow-up questions in mixed Hindi and English (Hinglish). This need is common in Indian financial services and public sector workflows where know your customer (KYC) forms, utility bills, and similar documents must often be digitized. Kimi K3 on Amazon Bedrock can directly read and reason about images, including those containing multilingual text. It offers a potential solution with no separate OCR or translation service required. Prerequisites The full source code for this example is available on GitHub . To follow along, you need: An AWS account . Python 3.11 or later installed, with internet access to install the required PyPI packages . The AWS Command Line Interface (AWS CLI) installed, with credentials configured with sufficient AWS Identity and Access Management (IAM) permissions to invoke the Kimi K3 model through the India inference profile. For example, to use Kimi K3 through the ap-south-1 Mumbai Region with India geographic inference, the following IAM policy grants sufficient access. Replace the {ACCOUNT_ID} placeholders with your AWS account ID: { "Version": "2012-10-17", "Statement": [ { "Sid": "BedrockCallWithBearerToken", "Effect": "Allow", "Action": ["bedrock:CallWithBearerToken"], "Resource": ["*"] }, { "Sid": "BedrockKimiK3India", "Effect": "Allow", "Action": [ "bedrock:InvokeModel", "bedrock:InvokeModelWithResponseStream" ], "Resource": [ "arn:aws:bedrock:ap-south-1::foundation-model/moonshotai.kimi-k3", "arn:aws:bedrock:ap-south-2::foundation-model/moonshotai.kimi-k3", "arn:aws:bedrock:ap-south-1:{ACCOUNT_ID}:inference-profile/in.moonshotai.kimi-k3", "arn:aws:bedrock:ap-south-1:{ACCOUNT_ID}:project/default" ] } ] } For more information about permissions, see Prerequisites for running model inference in the Amazon Bedrock User Guide. If your organization restricts AWS Regions, ask your administrator to review the geographic cross-Region inference IAM and SCP guidance . Keep the source Region permitted and allow routing to both India destinations, using a profile-scoped exception where appropriate. The Responses API guide also describes required default-project access. Get started with the inference APIs As detailed on the model card , Amazon Bedrock supports multiple APIs for invoking Kimi K3, all under the Bedrock Runtime endpoint: API Request and response format Chat Completions OpenAI-compatible messages input and assistant-message output. Responses OpenAI-compatible input and structured output items. Converse Standardized messages, content blocks, and inference parameters across supported models. InvokeModel Model-specific JSON request and response bodies. Because the OpenAI-compatible APIs are recommended for this model, we use those in this example and connect through the openai Python Library . Amazon Bedrock supports generating API keys for integrations that require them. However, AWS recommends using short-lived credentials instead where possible. The AWS token generator Python library derives a short-term API key-like token from the standard AWS CLI credential chain. If you use a named profile for your AWS CLI, you might need to set the AWS_PROFILE environment variable first. After CLI credentials are set up, you can invoke the model with the following code: from aws_bedrock_token_generator import provide_token from openai import OpenAI region = "ap-south-1" model_id = "in.moonshotai.kimi-k3" client = OpenAI( base_url=f"https://bedrock-runtime.{region}.amazonaws.com/openai/v1", api_key=provide_token(region=region), ) response = client.chat.completions.create( model=model_id, messages=[{ "role": "user", "content": "Classify this ticket as billing, technical, or account: I was charged twice." }], max_completion_tokens=2048, ) print(response.choices[0].message.content) Here, region ( ap-south-1 Mumbai) specifies the source Region to which the request is made. The inference profile in.moonshotai.kimi-k3 ensures that inference is processed in Indian Regions only. A broad range of features like streaming, tool calling, and structured outputs are supported across both the Chat Completions and Responses APIs. See the OpenAI Python API Reference for more examples. Analyze images Kimi K3 on Amazon Bedrock supports images as well as PDFs and a range of other file types. You can send input files to the model directly by base64-encoding. For OCR or other use cases where small details are important, consider setting the image detail parameter to high . This improves accuracy, at the cost of more input tokens consumed per image. In some cases, we’ve seen higher output quality for Kimi K3 when images are provided before text inputs. We suggest experimenting with request ordering. Consider the following example code: from base64 import b64encode image_path = "sample_data/electricity_bill_hi.png" with open(image_path, "rb") as f: image_base64 = b64encode(f.read()).decode("ascii") response = client.chat.completions.create( model=model_id, messages=[ { "role": "user", "content": [ # The model card recommends placing images before text: { "type": "image_url", "image_url": { "url": f"data:image/png;base64,{image_base64}", "detail": "high" } }, {"type": "text", "text": QUESTION_PROMPT}, ] }, ], max_completion_tokens=16384, ) print(response.choices[0].message.content) To demonstrate, we generated an image of a synthetic electricity bill in Hindi. Figure 1: A synthetic Hindi electricity bill from the sample (all sample documents are fictional) Given this image input, the model can answer questions by pulling data directly from the docu

read the original at AWS Machine Learning →