AWS Bedrock OpenAI-Compatible API: Setup & Endpoints (2026)
Does AWS Bedrock have an OpenAI-compatible API?
Yes. Amazon Bedrock exposes OpenAI-compatible Chat Completions and Responses APIs, so you can point the official OpenAI SDK at Bedrock by changing the base URL and the API key. For new applications AWS recommends the bedrock-runtime endpoint:
https://bedrock-runtime.{region}.amazonaws.com/openai/v1A second endpoint, bedrock-mantle, offers the same OpenAI-compatible surface plus a few features that are only available there. Everything below comes from the Amazon Bedrock user guide and OpenAI's "OpenAI on Amazon Bedrock" guide, read on November 27, 2026. Model lists and Region availability change often, so check the model card before you deploy.
The two OpenAI-compatible endpoints
|
|
|
|
|---|---|---|
|
Base URL |
|
|
|
OpenAI-compatible APIs |
Chat Completions, Responses |
Chat Completions, Responses |
|
Also supports |
InvokeModel, Converse, Anthropic Messages API |
Anthropic Messages API |
|
Authentication |
Bedrock API key (Bearer) or AWS SigV4 |
Bedrock API key or AWS credentials |
|
|
Not implemented |
Available |
|
Server-side tools (e.g. hosted web search), background mode |
Not available |
Available |
AWS notes that both endpoints run on the same underlying inference engine; the name identifies the API surface, not a different model. Use bedrock-runtime unless you need a model or feature that only Mantle offers. On Mantle, check each model's card for the correct path prefix: a request on the wrong prefix fails with "model isn't supported on this route".
Step 1: Get a Bedrock API key
Bedrock API keys let you send a Bearer token instead of signing every request with SigV4. There are two kinds:
- Short-term keys last up to 12 hours (or your session, whichever is shorter), inherit the permissions of the IAM principal that created them, and only work in the Region where they were generated. AWS recommends them for production. The
aws-bedrock-token-generatorpackage (Python, JavaScript, Java) creates and refreshes them. - Long-term keys last until an expiration date you choose and create an IAM user behind the scenes. AWS recommends them only for exploration.
Store the key in AWS_BEARER_TOKEN_BEDROCK or pass it as Authorization: Bearer <key>. Administrators can block key usage with an IAM policy that denies bedrock:CallWithBearerToken.
Step 2: Call Chat Completions with the OpenAI SDK
Python, using the bedrock-runtime endpoint:
import os
from openai import OpenAI
client = OpenAI(
base_url="https://bedrock-runtime.us-east-1.amazonaws.com/openai/v1",
api_key=os.environ["AWS_BEARER_TOKEN_BEDROCK"],
)
resp = client.chat.completions.create(
model="openai.gpt-oss-120b-1:0",
messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)The same request with curl:
curl -X POST "https://bedrock-runtime.us-east-1.amazonaws.com/openai/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $AWS_BEARER_TOKEN_BEDROCK" \
-d '{"model":"openai.gpt-oss-120b-1:0","messages":[{"role":"user","content":"Hello"}]}'If you prefer IAM credentials, curl can sign the request with --aws-sigv4 "aws:amz:us-east-1:bedrock" and --user "$AWS_ACCESS_KEY_ID:$AWS_SECRET_ACCESS_KEY" instead of the Bearer header.
Step 3: Use the Responses API (optional)
OpenAI's guide shows the newer SDKs shipping a Bedrock provider that derives the regional base URL for you:
import os
from openai import OpenAI
from openai.providers import bedrock
client = OpenAI(provider=bedrock(region="us-east-2",
api_key=os.environ["AWS_BEARER_TOKEN_BEDROCK"]))
resp = client.responses.create(model="openai.gpt-5.6-terra",
input="Write a haiku about cloud infrastructure.")
print(resp.output_text)Not every model supports both APIs on both endpoints. AWS's own example: GPT OSS models support Chat Completions on bedrock-runtime, but their Responses API is only on bedrock-mantle. Check the API table on the model card first.
Model IDs and Regions
Bedrock model IDs differ from OpenAI's. OpenAI models carry an openai. prefix (for example openai.gpt-6-sol), and on bedrock-runtime you often call an inference profile instead, such as us.openai.gpt-6-sol or global.openai.gpt-6-sol. Availability is per Region: OpenAI's guide lists GPT-6 Sol and GPT-6 Luna in us-east-1 and GPT-6 Astra in us-west-2.
Because bedrock-runtime does not implement GET /models, client.models.list() fails there. List models with the Bedrock ListFoundationModels and ListInferenceProfiles APIs or the "Models at a glance" tables.
The OpenAI-compatible endpoints are not limited to OpenAI's own models; the model cards show which other providers' models accept Chat Completions or Responses.
Common errors and what they mean
|
Symptom |
Likely cause |
|---|---|
|
|
|
|
"model isn't supported on this route" |
Wrong path prefix on Mantle ( |
|
403 / access denied |
IAM principal lacks Bedrock permissions, model access not enabled, or |
|
Key works in one Region but not another |
Short-term keys are Region-bound; generate one in the target Region |
|
Responses API call fails for a model that supports Chat Completions |
That model's Responses API is only on the other endpoint |
|
Hosted web search unavailable |
Server-side tools need |
Pricing and data handling
Bedrock usage is billed by AWS, not by OpenAI. OpenAI's guide states that Bedrock pricing in commercial Regions matches OpenAI direct pricing for equivalent services. For current OpenAI list prices, see our OpenAI API pricing breakdown. AWS also states that for OpenAI models on Bedrock it does not share request or response content with OpenAI under the default or "none" retention modes.
When Bedrock is the right OpenAI-compatible provider
Bedrock fits teams that already run on AWS and want IAM, CloudTrail logging, VPC controls and a single AWS bill. If you need to switch between many vendors' models with one key, an aggregation gateway can be simpler; see LLM API providers: the four types and OpenRouter vs LiteLLM. For wiring any OpenAI-compatible endpoint into the Vercel AI SDK, see OpenAI-compatible API with the AI SDK.
FAQ
What is the Bedrock OpenAI-compatible base URL?
https://bedrock-runtime.{region}.amazonaws.com/openai/v1 for the recommended runtime endpoint, or https://bedrock-mantle.{region}.api.aws/v1 for Mantle.
Can I use the OpenAI Python SDK with Bedrock?
Yes. Set base_url to the Bedrock endpoint and api_key to a Bedrock API key, then call chat.completions.create or responses.create with a Bedrock model ID.
Does Bedrock support the OpenAI Responses API?
Yes, on both endpoints for supported models. Some models only support it on one endpoint, and server-side tools and background mode require Mantle.
Why does client.models.list() fail on Bedrock?
The bedrock-runtime endpoint does not implement GET /models. Use ListFoundationModels or ListInferenceProfiles instead.
Is Bedrock more expensive than the OpenAI API?
According to OpenAI, Bedrock pricing in commercial Regions matches OpenAI direct pricing for equivalent services, billed through AWS.
Summary
Amazon Bedrock's OpenAI-compatible API lets existing OpenAI SDK code run on AWS with two changes: the base URL (bedrock-runtime.{region}.amazonaws.com/openai/v1) and a Bedrock API key. Use short-term keys in production, check each model card for endpoint and API support, use Bedrock model IDs or inference profiles, and switch to bedrock-mantle only when you need features that live there.