Gateway
Amazon Bedrock
Route Amazon Bedrock model calls through Inference for full observability.
Route Amazon Bedrock requests through the Inference gateway to get cost tracking, latency monitoring, and analytics. Amazon Bedrock exposes OpenAI-compatible Chat Completions endpoints and Anthropic Messages endpoints on Bedrock Mantle, so you can keep using the OpenAI or Anthropic SDKs with the x-inference-provider-url header.
inf instrument to instrument your codebase in seconds. Learn moreThis guide covers Bedrock Mantle with a Bedrock bearer/API key. Bedrock Runtime
Converse, InvokeModel, and SigV4-only calls use different request formats
and are not covered by this Gateway setup.
OpenAI-compatible Chat Completions
Use this path for Bedrock models that support the OpenAI-compatible Chat Completions API.
Get your API keys
You need two keys:
- Inference project API key — from your dashboard under API Keys
- Amazon Bedrock API key — from your AWS account. Bedrock also recognizes this as
AWS_BEARER_TOKEN_BEDROCK.
Set environment variables
export INFERENCE_API_KEY=<your-project-api-key>
export AWS_BEARER_TOKEN_BEDROCK=<your-bedrock-api-key>
export AWS_REGION=us-east-1
export BEDROCK_BASE_URL=https://bedrock-mantle.${AWS_REGION}.api.aws/v1
export BEDROCK_MODEL=openai.gpt-oss-120b
export BEDROCK_ANTHROPIC_BASE_URL=https://bedrock-mantle.${AWS_REGION}.api.aws/anthropic
export BEDROCK_ANTHROPIC_MODEL=anthropic.claude-sonnet-4-6-v1Update your code
Point the SDK at the gateway. Your project API key goes in apiKey, and the x-inference-provider-url header tells the gateway to forward requests to Amazon Bedrock.
For the Bedrock Runtime OpenAI-compatible endpoint, set BEDROCK_BASE_URL to https://bedrock-runtime.${AWS_REGION}.amazonaws.com/v1.
Anthropic Messages on Bedrock
Use this path for Claude models on Bedrock that support the Anthropic Messages API. The key detail is x-inference-provider: anthropic: it tells Inference platform to use Anthropic Messages extraction and forward your Bedrock API key as downstream x-api-key.
Set environment variables
Reuse the same Inference platform and Bedrock keys from above, then set the Bedrock Anthropic endpoint and model:
export INFERENCE_API_KEY=<your-project-api-key>
export AWS_BEARER_TOKEN_BEDROCK=<your-bedrock-api-key>
export AWS_REGION=us-east-1
export BEDROCK_ANTHROPIC_BASE_URL=https://bedrock-mantle.${AWS_REGION}.api.aws/anthropic
export BEDROCK_ANTHROPIC_MODEL=anthropic.claude-sonnet-4-6-v1Update your code
Point the Anthropic SDK at Inference Gateway. Keep the Bedrock key in the SDK apiKey for SDK compatibility, and also pass it as x-inference-provider-api-key so Inference platform can forward it to Bedrock as downstream x-api-key.