Route Amazon Bedrock requests through the Inference Catalyst 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.
Prefer automatic setup? Run
inf instrument to instrument your codebase in seconds.
Learn more
This 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 Catalyst 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-v1
Update 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.import OpenAI from "openai";
const bedrockApiKey = process.env.AWS_BEARER_TOKEN_BEDROCK;
const bedrockBaseUrl =
process.env.BEDROCK_BASE_URL ?? "https://bedrock-mantle.us-east-1.api.aws/v1";
if (!bedrockApiKey) {
console.log("Set AWS_BEARER_TOKEN_BEDROCK to run this example.");
process.exit(0);
}
const client = new OpenAI({
baseURL: "https://api.inference.net/v1",
apiKey: process.env.INFERENCE_API_KEY,
defaultHeaders: {
"x-inference-provider-api-key": bedrockApiKey,
"x-inference-provider-url": bedrockBaseUrl,
"x-inference-environment": process.env.NODE_ENV,
},
});
const response = await client.chat.completions.create({
model: process.env.BEDROCK_MODEL ?? "openai.gpt-oss-120b",
messages: [{ role: "user", content: "Reply with exactly OK." }],
max_tokens: 32,
}, {
headers: { "x-inference-task-id": "default" },
});
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 Catalyst to use Anthropic Messages extraction and forward your Bedrock API key as downstream x-api-key.
Set environment variables
Reuse the same Catalyst 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-v1
Update your code
Point the Anthropic SDK at the Catalyst gateway. Keep the Bedrock key in the SDK apiKey for SDK compatibility, and also pass it as x-inference-provider-api-key so Catalyst can forward it to Bedrock as downstream x-api-key.const bedrockApiKey = process.env.AWS_BEARER_TOKEN_BEDROCK;
const bedrockAnthropicBaseUrl =
process.env.BEDROCK_ANTHROPIC_BASE_URL ??
"https://bedrock-mantle.us-east-1.api.aws/anthropic";
if (!bedrockApiKey) {
console.log("Set AWS_BEARER_TOKEN_BEDROCK to run this example.");
process.exit(0);
}
const { default: Anthropic } = await import("@anthropic-ai/sdk");
const client = new Anthropic({
baseURL: "https://api.inference.net",
apiKey: bedrockApiKey,
defaultHeaders: {
"Authorization": `Bearer ${process.env.INFERENCE_API_KEY}`,
"x-inference-provider": "anthropic",
"x-inference-provider-api-key": bedrockApiKey,
"x-inference-provider-url": bedrockAnthropicBaseUrl,
"x-inference-environment": process.env.NODE_ENV,
},
});
const response = await client.messages.create({
model: process.env.BEDROCK_ANTHROPIC_MODEL ?? "anthropic.claude-sonnet-4-6-v1",
max_tokens: 1024,
messages: [{ role: "user", content: "Reply with exactly OK." }],
}, {
headers: { "x-inference-task-id": "default" },
});