Provider guide

AWS Bedrock through one OpenAI-compatible gateway

Put Bedrock behind the same OpenAI-compatible endpoint as every other provider, with fallback, guardrails, and region-locked routing — and keep the AWS region as a first-class residency signal.

Routeplane’s Bedrock adapter targets Bedrock’s OpenAI-compatible layer: you point it at a region-specific endpoint and it sends ordinary OpenAI-shaped chat completions with a bearer token. This keeps Bedrock on the same surface and fallback chains as every other provider.

Because a Bedrock endpoint is inherently region-scoped, it slots directly into sovereign routing — declare the region and the gateway can hard-lock regulated traffic to it.

Drop in your OpenAI client

Point your existing OpenAI SDK at the gateway and add two headers — your virtual key and the provider. Nothing else about your code changes.

bashcurl
curl https://api.routeplane.ai/v1/chat/completions \
  -H "content-type: application/json" \
  -H "x-routeplane-api-key: rp_your_gateway_key" \
  -H "x-routeplane-provider: bedrock" \
  -d '{"model":"anthropic.claude-3-5-sonnet","messages":[{"role":"user","content":"Hello!"}]}'
pythonopenai SDK
import openai

client = openai.OpenAI(
    api_key="rp_your_gateway_key",
    base_url="https://api.routeplane.ai/v1",
    default_headers={
        "x-routeplane-api-key": "rp_your_gateway_key",
        "x-routeplane-provider": "bedrock",   # route to AWS Bedrock
    },
)

resp = client.chat.completions.create(
    model="anthropic.claude-3-5-sonnet",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)
typescriptopenai SDK
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: 'rp_your_gateway_key',
  baseURL: 'https://api.routeplane.ai/v1',
  defaultHeaders: {
    'x-routeplane-api-key': 'rp_your_gateway_key',
    'x-routeplane-provider': 'bedrock', // route to AWS Bedrock
  },
});

const completion = await client.chat.completions.create({
  model: 'anthropic.claude-3-5-sonnet',
  messages: [{ role: 'user', content: 'Hello!' }],
});
console.log(completion.choices[0]?.message.content);

Or use the Routeplane SDK

The Routeplane SDKs subclass the official OpenAI clients, wire up the x-routeplane-* headers for you, and add typed access to routing metadata and the non-OpenAI surfaces.

bashinstall
pip install routeplane
pythonrouteplane SDK
from routeplane import Routeplane

client = Routeplane(
    api_key="rp_your_gateway_key",
    provider="bedrock",   # route to AWS Bedrock
)

resp = client.chat.completions.create(
    model="anthropic.claude-3-5-sonnet",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)
bashinstall
npm i @routeplane/sdk
typescript@routeplane/sdk
import { Routeplane } from '@routeplane/sdk';

const client = new Routeplane({
  apiKey: process.env.ROUTEPLANE_API_KEY!, // rp_...
  provider: 'bedrock',                 // route to AWS Bedrock
});

const completion = await client.chat.completions.create({
  model: 'anthropic.claude-3-5-sonnet',
  messages: [{ role: 'user', content: 'Hello!' }],
});
console.log(completion.choices[0]?.message.content);

Add a fallback chain

Try Bedrock first; fall back to Anthropic’s direct API. Make the provider header a comma-separated list and the gateway walks it in order, skipping any provider whose circuit is open.

bashcurl
curl https://api.routeplane.ai/v1/chat/completions \
  -H "content-type: application/json" \
  -H "x-routeplane-api-key: rp_your_gateway_key" \
  -H "x-routeplane-provider: bedrock,anthropic" \
  -d '{"model":"anthropic.claude-3-5-sonnet","messages":[{"role":"user","content":"Hello!"}]}'

AWS Bedrock on the gateway

The adapter supports chat completions and native streaming. Model ids match whatever your Bedrock OpenAI-compatible endpoint exposes and pass through verbatim.

Configured from the environment

Set BEDROCK_BASE_URL to your region-specific Bedrock OpenAI-compatible endpoint and BEDROCK_REGION to the AWS region (e.g. ap-south-1). If the endpoint is unset the adapter returns a clean configuration error rather than failing opaquely.

OpenAI-compatible layer

The adapter authenticates with a bearer token against Bedrock’s OpenAI-compatible layer. For deployments that require full AWS SigV4, front Bedrock with an API-gateway or proxy that terminates SigV4 and exposes the OpenAI shape, then point BEDROCK_BASE_URL at that.

Sovereign routing

Sovereign routing works with AWS Bedrock the same way it works everywhere: add x-routeplane-residency to a request, and when the gateway classifies regulated personal data in it, only providers resident in the requested region stay eligible — a hard constraint that overrides the provider header. Declare where AWS Bedrock runs by setting BEDROCK_REGION.

Keep reading

Frequently asked questions

Is Routeplane a drop-in replacement for calling AWS Bedrock directly?

Yes. The gateway is OpenAI-compatible, so switching is a base-URL change — point your existing OpenAI SDK at https://api.routeplane.ai/v1 and set the x-routeplane-provider header to bedrock. You keep your code and gain automatic fallback, in-data-plane PII guardrails, sovereign routing, and per-team cost attribution.

Which AWS Bedrock models can I use through Routeplane?

Any model your AWS Bedrock endpoint exposes — model ids pass through the gateway verbatim.

Can I enforce data residency on AWS Bedrock requests?

Yes. Add the x-routeplane-residency header (for example IN) and, when a request carries regulated personal data, the gateway restricts routing to providers eligible in that region — overriding the provider header if it has to. The AWS Bedrock adapter reads BEDROCK_REGION to declare where it is resident.

Route your first request this week.

Point your existing OpenAI-compatible client at Routeplane, set one header, and get fallback, guardrails, and sovereign routing across every provider.