Documentation

Get started with BedrockRouter

BedrockRouter gives you one API for every foundation model on AWS Bedrock. Call any model using the OpenAI SDK, Anthropic SDK, or native boto3 — through our unified proxy.

Architecture

BedrockRouter is a thin, OpenAI-compatible proxy that is a centralized proxy. Requests authenticate with an API key, get translated into the Bedrock InvokeModel / Converse protocol, and stream straight back to your client.

Your App

OpenAI / Anthropic SDK

Lambda + Function URL

BedrockRouter Proxy

AWS Bedrock

Claude / MiniMax / etc.

1. Authenticated request

Your client sends a standard chat completion request with an API key in the Authorization header.

2. Protocol translation

The Lambda verifies the key, translates OpenAI/Anthropic-shaped requests into Bedrock's native protocol, and calls Bedrock via its IAM role.

3. Streaming response

Tokens stream back over SSE, transformed into the response shape your SDK expects.

Secure & encrypted

All requests are encrypted and transmitted securely through our proxy. Your data is never logged or stored.

Virtual API keys

Create and revoke API keys with optional credit limits. Manage all keys from your dashboard.

Quickstart

Get a working request in under five minutes.

  1. 1

    Create an account

    Sign up at BedrockRouter to track your deployments and integrations.

    Create account →
  2. 2

    Deploy the CloudFormation stack

    Click Deploy, follow the AWS console wizard, and wait ~60 seconds for the stack to finish.

    Deploy stack →
  3. 3

    Get your proxy URL and API key

    Once the stack finishes, your proxy URL appears on your dashboard. Create an API key from the API Keys page — no AWS console needed.

  4. 4

    Use the BedrockRouter SDK

    Install the official SDK and start building in seconds:

    bash
    pip install bedrockrouter

    Then use it with your API key:

    python
    from bedrockrouter import BedrockOpenAI, Models
    
    client = BedrockOpenAI(api_key="YOUR_API_KEY")
    
    resp = client.chat.completions.create(
        model=Models.CLAUDE_SONNET_4_6,
        messages=[{"role": "user", "content": "Hello, Bedrock!"}],
    )
    print(resp.choices[0].message.content)

    See more SDK examples →

SDK examples

Use the official BedrockRouter SDK for the best experience with 100+ models and friendly aliases. Or use OpenAI-compatible and Anthropic-compatible SDKs by changing the base URL. Go native with boto3 if you prefer.

BedrockRouter Python SDK (Official)

The easiest way to use Bedrock models. Two compatible clients, 100+ models with friendly aliases, streaming support, and built-in cost tracking.

Install

bash
pip install bedrockrouter

OpenAI-compatible usage

python
from bedrockrouter import BedrockOpenAI, Models

client = BedrockOpenAI(
    api_key="YOUR_API_KEY",
)

response = client.chat.completions.create(
    model=Models.CLAUDE_SONNET_4_6,
    messages=[{"role": "user", "content": "Explain Bedrock in one sentence."}],
    max_tokens=1024,
)

print(response.choices[0].message.content)

Anthropic-compatible usage

python
from bedrockrouter import BedrockRouter, Models

client = BedrockRouter(
    api_key="YOUR_API_KEY",
)

message = client.messages.create(
    model=Models.CLAUDE_SONNET_4_6,
    messages=[{"role": "user", "content": "Explain Bedrock in one sentence."}],
    max_tokens=1024,
)

print(message.content[0].text)

Discover models with CLI

bash
bedrockrouter models list
bedrockrouter models list --provider anthropic
bedrockrouter models find "sonnet"

📦 What you get

  • 100+ Bedrock models with friendly aliases
  • Two SDK styles: OpenAI-compatible or Anthropic-compatible
  • Streaming support for both clients
  • CLI for model discovery (no AWS credentials needed)

OpenAI Python

python
from openai import OpenAI

client = OpenAI(
    base_url="https://YOUR_PROXY_URL/v1",
    api_key="YOUR_API_KEY",
)

response = client.chat.completions.create(
    model="us.anthropic.claude-haiku-4-5-20251001-v1:0",
    messages=[{"role": "user", "content": "Explain Bedrock in one sentence."}],
)

print(response.choices[0].message.content)

Anthropic TypeScript

typescript
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  baseURL: "https://YOUR_PROXY_URL",
  apiKey: "YOUR_API_KEY",
});

const message = await client.messages.create({
  model: "us.anthropic.claude-haiku-4-5-20251001-v1:0",
  max_tokens: 1024,
  messages: [{ role: "user", content: "Hello, Bedrock!" }],
});

console.log(message.content);

Vercel AI SDK

typescript
import { createOpenAI } from "@ai-sdk/openai";
import { generateText } from "ai";

const bedrock = createOpenAI({
  baseURL: "https://YOUR_PROXY_URL/v1",
  apiKey: process.env.BEDROCK_API_KEY,
});

const { text } = await generateText({
  model: bedrock("minimax.minimax-m2-v1:0"),
  prompt: "Write a haiku about distributed systems.",
});

boto3 (native Bedrock)

Use the AWS SDK directly with the bedrock-runtime client. Set endpoint_url to your proxy URL and pass your Bedrock API key as a bearer token.

python
import boto3, json

client = boto3.client(
    "bedrock-runtime",
    region_name="us-east-1",
    endpoint_url="https://YOUR_PROXY_URL",
    aws_access_key_id="x",       # placeholder — auth via bearer token
    aws_secret_access_key="x",   # placeholder
)

# Set the bearer token via the Bedrock API key env var
import os
os.environ["AWS_BEARER_TOKEN_BEDROCK"] = "YOUR_API_KEY"

response = client.converse(
    modelId="us.anthropic.claude-haiku-4-5-20251001-v1:0",
    messages=[
        {"role": "user", "content": [{"text": "Explain Bedrock in one sentence."}]}
    ],
)

print(response["output"]["message"]["content"][0]["text"])

BYOK Integrations

Bring your own vendor key (BYOK) to route traffic directly to OpenAI or Anthropic — with BedrockRouter handling telemetry and cost tracking. Use api_key for the third-party vendor secret and mach11_key for your BedrockRouter tracking key.

Two keys explained: api_key is your third-party vendor secret (OpenAI / Anthropic key). mach11_key is your BedrockRouter key used to group telemetry, track costs, and enforce spend limits.

1

OpenAI Integration

Route directly to OpenAI endpoints via BedrockOpenAI

Use the BedrockOpenAI class. Pass provider="openai" in the completions call to route directly to OpenAI.

python
from bedrockrouter import BedrockOpenAI

client = BedrockOpenAI(
    api_key="YOUR_OPENAI_API_KEY",       # Your OpenAI secret key
    mach11_key="YOUR_BEDROCKROUTER_KEY"  # Your BedrockRouter tracking key
)

resp = client.chat.completions.create(
    model="gpt-4o-mini",
    provider="openai",   # Required — tells the proxy to forward to OpenAI
    messages=[{"role": "user", "content": "Say 'OpenAI routing is working!'"}]
)

print(resp.choices[0].message.content)
2

Anthropic Integration

Route directly to Anthropic pipelines via BedrockRouter

Use the BedrockRouter class. Pass provider="anthropic"to route directly to Anthropic's API.

python
from bedrockrouter import BedrockRouter

client = BedrockRouter(
    api_key="YOUR_ANTHROPIC_API_KEY",    # Your Anthropic secret key
    mach11_key="YOUR_BEDROCKROUTER_KEY"  # Your BedrockRouter tracking key
)

msg = client.messages.create(
    model="claude-haiku-4-5",
    provider="anthropic",  # Required — tells the proxy to forward to Anthropic
    max_tokens=100,
    messages=[{"role": "user", "content": "Say 'Anthropic BYOK routing is working!'"}]
)

print(msg.content[0].text)
3

Native AWS Bedrock (Standard)

Default flow — your own AWS account via BedrockRouter

For standard Bedrock access through your deployed stack, pass only your BedrockRouter key as api_key. No provider needed — this is the default.

python
from bedrockrouter import BedrockRouter

client = BedrockRouter(
    api_key="YOUR_BEDROCKROUTER_KEY"  # Your BedrockRouter key — that's all
)

msg = client.messages.create(
    model="us.anthropic.claude-opus-4-7",  # Any Bedrock model ID
    max_tokens=512,
    messages=[{"role": "user", "content": "Hello!"}]
)

print(msg.content[0].text)

Integration comparison

ModeClass
OpenAI BYOKBedrockOpenAI
Anthropic BYOKBedrockRouter
Native BedrockBedrockRouter

Supported models

BedrockRouter does not restrict which models you can call. Pass any model ID available in your AWS Bedrock region and the proxy forwards the request as-is. The models listed on the Models page are a curated catalog with pricing — they are not a whitelist.

How to use any model

Find the model ID in the Models catalog or look it up in the AWS Bedrock documentation. Then pass it directly as the model field.

Any SDK — swap the model field
# Anthropic Claude Haiku 4.5
model = "us.anthropic.claude-haiku-4-5-20251001-v1:0"

# Amazon Nova Lite
model = "us.amazon.nova-lite-v1:0"

# DeepSeek R1
model = "deepseek.r1-v1:5"

# MiniMax M2
model = "minimax.minimax-m2"

# Any other model from your Bedrock region
model = "<bedrock-model-id>"

Cross-region inference

Prefix the model ID with us. (or eu. / ap.) to route through Bedrock's cross-region inference profiles for higher throughput.

Model availability

The models you can call depend on which models are enabled in your AWS account and region. Enable them once in the Bedrock Model Access console.

Authentication

BedrockRouter uses virtual API keys issued from your Mach11 dashboard. Pass your key in the Authorization header on every request.

http
Authorization: Bearer sk_m11_xxxxxxxxxxxxxxxxxxxx

Keys are created and revoked from your dashboard. Set optional credit limits per key. The Lambda verifies each key using HMAC — no AWS credentials are exposed to clients.

Pricing & billing

BedrockRouter charges zero markup. You pay AWS Bedrock's standard on-demand rates directly via your AWS bill. The Lambda proxy is metered separately under AWS Lambda — typically a few cents per million requests.

See full per-model pricing on the Models page.

FAQ

Does BedrockRouter see my prompts or responses?

No. Your data is encrypted and transmitted securely through our proxy. We never log or store your requests.

Which AWS regions are supported?

BedrockRouter supports all AWS Bedrock regions. Configure your preferred region during deployment.

Is streaming supported?

Yes. Server-Sent Events streaming is fully supported for both OpenAI and Anthropic API formats.

Can I use this with Claude Code, Cursor, or other tools?

Yes. Any tool that accepts an OpenAI- or Anthropic-compatible base URL and API key works out of the box.

How do I uninstall?

Open the AWS console, find the BedrockRouter stack under CloudFormation, and click Delete. Everything is removed cleanly in one step.

Ready to deploy?

Stand up the full proxy in your AWS account in under two minutes.

Deploy stack