Skip to main content
kRouter
All posts
How kRouter works

How to route Claude through AWS Bedrock with kRouter

kRouter has no built-in Bedrock provider, but Bedrock's Anthropic Messages endpoint works as a custom one. Setup, model IDs and the limits.

Kodelyth · The team behind kRouter
· Updated
6 min read

If you work at a company with AWS as the primary cloud, your compliance team probably wants you to reach Claude through Amazon Bedrock rather than calling Anthropic directly. Bedrock gives you:

  • Region-pinned model invocations (data residency)
  • PrivateLink, so traffic from inside your VPC stays on the AWS network
  • Inclusion in your AWS bill (one invoice, one procurement)
  • IAM-based access control

What changed in this guide

An earlier version of this post described a built-in "AWS Bedrock" provider in kRouter that signed requests with SigV4 and decoded Bedrock's binary event stream. That provider does not exist. If you went looking for it in the dashboard, that is why you did not find it.

What does work is simpler. Bedrock now serves the Anthropic Messages API itself for its newer Claude models, and accepts a Bedrock API key on it. kRouter can talk to any Anthropic-compatible endpoint as a custom provider. Put the two together and you get Claude on Bedrock behind kRouter, with no SigV4 and no event-stream translation in the router at all.

The rest of this guide is that setup.

First: you may not need a router

If Claude Code is your only client and Bedrock is your only backend, skip kRouter. Claude Code supports Bedrock natively: pick Amazon Bedrock at its login prompt (or run /setup-bedrock later), or set CLAUDE_CODE_USE_BEDROCK=1 with your AWS credentials or a Bedrock API key in AWS_BEARER_TOKEN_BEDROCK. Anthropic's Claude Code docs cover it in full.

A router earns its place when you want several clients on one endpoint, or Bedrock as one entry in a fallback chain alongside other providers.

Step 1: Enable Claude in your AWS account

In the Amazon Bedrock console, open the Model catalog, pick an Anthropic model and submit the use case form. Anthropic's Claude Code docs say access is granted immediately after submission, once per AWS account.

Step 2: Create a Bedrock API key

Create a Bedrock API key in the console. The IAM identity behind it still needs permission to invoke the models. This is the invoke part of the policy Anthropic's Claude Code docs give for Bedrock:

{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Action": [
      "bedrock:InvokeModel",
      "bedrock:InvokeModelWithResponseStream"
    ],
    "Resource": [
      "arn:aws:bedrock:*:*:inference-profile/*",
      "arn:aws:bedrock:*:*:foundation-model/*"
    ]
  }]
}

Narrow the Resource list to the specific models or inference profiles you allow, and treat AWS's own documentation as the final word on which actions your endpoint checks.

Step 3: Add Bedrock as an Anthropic-compatible provider

Open http://localhost:20128/dashboard, go to Providers and choose Add Anthropic Compatible:

  1. Name: anything, for example Bedrock us-east-1
  2. Prefix: bedrock -- this becomes the first part of every model name
  3. Base URL: https://bedrock-runtime.us-east-1.amazonaws.com/anthropic/v1 (swap in your region)

Then add a connection to it with your Bedrock API key.

kRouter appends /messages to the base URL and sends the key in the x-api-key header (and as a Bearer token) with anthropic-version: 2023-06-01. That matches the API-key example in AWS's own Messages API documentation for the bedrock-runtime endpoint.

This is a configuration, not a built-in integration, so check it with one short request before you depend on it:

curl http://localhost:20128/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model": "bedrock/us.anthropic.claude-opus-4-8",
       "messages": [{"role": "user", "content": "Reply with one word."}]}'

Step 4: Use the right model IDs

Model names are bedrock/<Bedrock model ID>. On bedrock-runtime, Claude models are usually called through a cross-region inference profile, such as us.anthropic.claude-opus-4-8 in the us-* regions (eu., jp., au. or global. elsewhere, depending on the model). Copy the exact IDs your account can invoke from the Bedrock console rather than guessing them.

Not every Claude model is on this route. Each model card in AWS's Bedrock documentation has an "APIs supported" table, and only models with Messages ticked for bedrock-runtime work here. In October 2026 that includes Claude Opus 4.8 and Claude Sonnet 5.5, but not Claude Sonnet 4.6, which Bedrock serves only through Invoke and Converse. Check the card before you add a model.

AWS also serves the same API on its bedrock-mantle endpoint (https://bedrock-mantle.<region>.api.aws/anthropic/v1), which takes plain anthropic. model IDs such as anthropic.claude-opus-4-8, is available in fewer regions, and is governed by its own IAM actions (bedrock-mantle:CreateInference for inference). The kRouter setup is identical apart from the base URL. AWS itself recommends bedrock-runtime for new applications.

Then point your tools at kRouter. Any OpenAI-compatible client uses http://localhost:20128/v1 and the model name above. Claude Code uses ANTHROPIC_BASE_URL=http://localhost:20128/v1, as described in the ANTHROPIC_BASE_URL guide.

What kRouter does, and does not do, here

It translates the request format. An OpenAI-format client sends Chat Completions; kRouter converts that to the Messages format Bedrock's endpoint expects, and converts the reply back, streaming included. A Claude-format client such as Claude Code needs no conversion.

It does not sign with SigV4. Authentication is the Bedrock API key. If your organization forbids API keys and requires IAM role credentials, this setup does not fit, and Claude Code's native Bedrock support (or the AWS SDK) is the route.

It does not call InvokeModel or Converse. Models and features that Bedrock offers only on those APIs are outside this path.

PrivateLink only applies where kRouter runs. If kRouter is on your laptop, requests to Bedrock cross the public internet like any other HTTPS call. To keep traffic on the AWS network, run kRouter inside the VPC that has the Bedrock interface endpoint.

A fallback chain across regions

Add one Anthropic-compatible provider per region, each with its own prefix, then put them in a fallback combo:

1. bedrock-use1/us.anthropic.claude-opus-4-8   # Primary, US
2. bedrock-euw1/eu.anthropic.claude-opus-4-8   # Second region
3. cc/claude-opus-4-8                          # Last resort, outside Bedrock

A fallback combo tries the entries in order and moves on when one fails. Be deliberate about the last line: anything outside Bedrock is outside your compliance boundary, so leave it out if the reason you use Bedrock is that data must stay there.

Why route Bedrock through kRouter at all?

  • One endpoint for all providers. Your tools see localhost:20128/v1 whether a request goes to Bedrock, Anthropic, OpenAI or Copilot. Switching is a model-name change.
  • Token savings on input. RTK, the only token saver on by default, compresses tool output such as git diff and grep results before the request leaves your machine. kRouter's README estimates 20-40% fewer input tokens per request; that is an estimate, not a benchmark, and Bedrock bills per input token either way.
  • PII redaction. If compliance is the reason you are on Bedrock, redacting PII before the request leaves is worth a look too. It is off by default.

Install

npm install -g @sifxprime/krouter
krouter -t

Then open http://localhost:20128/dashboard. The provider catalog lists everything that is built in.

Common questions

Does kRouter have a built-in AWS Bedrock provider?

No. Bedrock is reached through a custom Anthropic Compatible provider pointed at Bedrock's Messages API endpoint, authenticated with a Bedrock API key. The only AWS service with a built-in provider is AWS Polly, for text to speech.

Do I need kRouter to use Claude Code with Bedrock?

No. Claude Code supports Bedrock natively through /setup-bedrock or CLAUDE_CODE_USE_BEDROCK=1. kRouter is useful when you want other clients on the same endpoint, or Bedrock inside a fallback chain with other providers.

Can kRouter use my IAM access key and secret instead of a Bedrock API key?

Not for chat. kRouter does not sign chat requests with SigV4, so it needs an endpoint that accepts an API key, which Bedrock's Messages API route does.

Which model ID do I use?

The Bedrock ID your account can invoke, prefixed with the provider prefix you chose. For Claude on bedrock-runtime that is usually a cross-region inference profile ID such as us.anthropic.claude-opus-4-8. Copy it from the Bedrock console, and check that the model's card lists the Messages API.

Why does Claude Sonnet 4.6 fail through this setup?

Because Bedrock serves Sonnet 4.6 only through its Invoke and Converse APIs, not through the Anthropic Messages route this setup uses, and kRouter does not speak Invoke or Converse. Use a model whose Bedrock model card lists Messages, such as Claude Opus 4.8, or use Claude Code's native Bedrock support for Sonnet 4.6.

Kodelyth · The team behind kRouter

Published by Kodelyth, the team that builds kRouter. Posts are drafted with AI assistance and reviewed by a person before they go out. kRouter is free and MIT licensed.

Install kRouter