Skip to content

AWS Bedrock

Description

The gateway translates the OpenAI chat-completions format to the AWS Bedrock InvokeModel API (the /model/<id>/invoke endpoint) and signs every request with AWS Signature Version 4 (SigV4). Calling applications send a normal OpenAI-format request; the gateway handles the conversion, the HMAC-SHA256 signing, and the upstream call.

Because each Bedrock model family expects a different request body, the gateway applies a per-family translation selected from the model identifier prefix: the Anthropic Messages body for anthropic., a Llama prompt string for meta., the Amazon Nova messages body for amazon., and a Mistral prompt string for mistral.. The cohere. prefix is recognised but is currently forwarded as a raw OpenAI body with no dedicated translation, so Cohere-on-Bedrock requests may be rejected by the upstream service. Other prefixes are routed as unknown and forwarded unchanged.

⚠️ Caution: Streaming is not implemented for AWS Bedrock. The Bedrock streaming response uses a binary event-stream protocol that the gateway does not yet decode. Requests with stream: true are silently downgraded — the upstream call is non-streaming and the response is returned as a single message.

Feature Limitation
Chat completions through the InvokeModel API —
Streaming responses Not implemented; silently downgraded to non-streaming.
Permanent IAM credentials —
Temporary STS credentials with session token —
Per-family body translation Anthropic, Llama (meta.), Amazon Nova, and Mistral only. cohere. is forwarded as a raw OpenAI body and may be rejected upstream.
Vision input Depends on the underlying model.
Tool use Not supported. No Bedrock family body builder serializes tools, so the tool loop never fires — the model answers in text even when tools are requested. MCP connectors: a connector reference (tools:[{"type":"mcp"}], which the web chat attaches automatically for every connected connector) cannot run on this provider either. In the web chat the turn is answered without the connectors and a notice says the connectors are not supported by this model; an API request is rejected with model_capability_mismatch (400) instead. To use the connectors, pick a model from a provider with a gateway tool loop (see MCP connectors from the API).

Required gateway configuration

Key Type Default Description
bedrock_region string us-east-1 AWS region used to construct the Bedrock URL https://bedrock-runtime.<REGION>.amazonaws.com.

Not EU data residency — in any region. AWS is a US-owned cloud, so Bedrock is not EU residency, whatever bedrock_region says: on a gateway with eu_region_routing: true (per gateway or the inherited organisation floor) every Bedrock request is rejected 403 data_residency_blocked before any network call — eu-central-1 and a bare single-region id included. bedrock_region only chooses which AWS endpoint the adapter dials. For EU residency use an EU-owned provider (Myra, Mistral, IONOS). See Data residency.

Model ids. A bare on-demand id is <vendor>.<model> (e.g. anthropic.claude-3-haiku-20240307-v1:0) and may carry a dotted version (deepseek.v3.2, minimax.minimax-m2.1, moonshotai.kimi-k2.5). A known geography prefix (us, eu, apac, au, jp, in, global) marks an AWS cross-region inference profile (eu.anthropic.*); the gateway serializes a profile id correctly. A model id containing a character outside A-Z a-z 0-9 . _ : -, or made only of dots (., ..), is rejected as configuration_error before the request is signed — for example an application-inference-profile ARN (arn:aws:bedrock:…:application-inference-profile/…).

The region is never part of a model id: it always comes from the gateway's bedrock_region setting. A catalogue id of the form bedrock/<region>/<id> or bedrock/invoke/<id> is refused when written (PUT /admin/v1/model-prices answers 400 invalid model id, and every other catalogue write path, including provider syncs, rejects it the same way).

Only the Anthropic Claude, Meta Llama, Amazon Titan and Mistral families have a Bedrock request builder; other families (DeepSeek, MiniMax, Moonshot Kimi, Qwen, …) are sent as a raw body and are not yet guaranteed to be accepted by Bedrock.

The bedrock_region key is not exposed in the gateway settings page of the SPA. Set it through the admin API:

curl -X PATCH "https://<your-gateway-host>/admin/v1/gateways/<ID>" \
  -H "Content-Type: application/json" \
  -d '{"config": {"bedrock_region": "us-west-2"}}'

BYOK key format

The BYOK value is the AWS access-key pair, in one of two forms.

For permanent credentials:

ACCESS_KEY_ID:SECRET_ACCESS_KEY

For temporary credentials issued by AWS Security Token Service (STS):

ACCESS_KEY_ID:SECRET_ACCESS_KEY:SESSION_TOKEN

The gateway parses the colon-separated string at request time and signs the upstream call with the credentials.


IAM requirements

The IAM principal associated with the credentials must have the bedrock:InvokeModel permission on the model ARNs the gateway calls:

{
  "Effect": "Allow",
  "Action": "bedrock:InvokeModel",
  "Resource": "arn:aws:bedrock:<REGION>::foundation-model/*"
}

Restrict the Resource to specific model ARNs for tighter access control:

"Resource": [
  "arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-3-5-sonnet-20241022-v2:0",
  "arn:aws:bedrock:us-east-1::foundation-model/amazon.nova-pro-v1:0"
]

💡 Note: Prefer short-lived STS credentials in production. Rotate credentials on a regular schedule.


Adding the key

The procedure for storing a BYOK key is the same for every provider. See Provider keys (BYOK). Select bedrock in the Provider drop-down list of the Add Model page and paste the colon-separated AWS credentials in the API Key field.

Through the API:

# Permanent credentials
curl -X POST "https://<your-gateway-host>/admin/v1/gateways/<ID>/keys" \
  -H "Content-Type: application/json" \
  -d '{
    "provider": "bedrock",
    "alias": "default",
    "key": "AKIAIOSFODNN7EXAMPLE:wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
  }'

# Temporary STS credentials
curl -X POST "https://<your-gateway-host>/admin/v1/gateways/<ID>/keys" \
  -H "Content-Type: application/json" \
  -d '{
    "provider": "bedrock",
    "alias": "sts",
    "key": "ASIA...EXAMPLE:secret...key:FwoGZXIvYXdzE..."
  }'

Inference endpoint

POST /v1/<TENANT>/<GATEWAY>/bedrock/chat/completions

The model field in the request body must be the full Bedrock model identifier, including the family prefix and version, for example anthropic.claude-3-5-sonnet-20241022-v2:0 or amazon.nova-pro-v1:0.


Request example

curl -X POST \
  "https://<your-gateway-host>/v1/myapp/production/bedrock/chat/completions" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <TOKEN>" \
  -d '{
    "model": "anthropic.claude-3-5-sonnet-20241022-v2:0",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user",   "content": "What is Amazon Bedrock?"}
    ],
    "max_tokens": 512,
    "temperature": 0.7
  }'

See also