Bedrock
The gateway speaks Bedrock natively and does the SigV4 signing itself.
| Property | Value |
|---|---|
| Provider id | bedrock |
| Gateway speaks | Bedrock Runtime (InvokeModel for Claude on /v1/messages; Converse for chat completions and other models) |
| Credential | An AWS workload role, or a static access key and secret, plus a region |
| Signing | The gateway signs SigV4 itself |
| Client base URL | OPENAI_BASE_URL, or ANTHROPIC_BASE_URL for Claude, pointed at :8787 |
| Network egress (443) | bedrock-runtime.<region>.amazonaws.com (inference, required); bedrock.<region>.amazonaws.com (model discovery via the List actions); bedrock-mantle.<region>.api.aws (token counts for Claude 5 and Opus 4.7+) |
Set it up
AWS console → Bedrock → Model access in your region. Anthropic models need the one-time use-case form.
Attach to the gateway workload's role (applies within seconds, no redeploy):
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "BedrockInvoke",
"Effect": "Allow",
"Action": [
"bedrock:InvokeModel",
"bedrock:InvokeModelWithResponseStream",
"bedrock:Converse",
"bedrock:ConverseStream",
"bedrock:CountTokens",
"bedrock:ListFoundationModels",
"bedrock:ListInferenceProfiles"
],
"Resource": "*"
},
{
"Sid": "BedrockMantleCountTokens",
"Effect": "Allow",
"Action": "bedrock-mantle:CountTokens",
"Resource": "arn:aws:bedrock-mantle:*:*:project/*"
},
{
"Sid": "BedrockUseCaseAttestation",
"Effect": "Allow",
"Action": [
"bedrock:GetUseCaseForModelAccess",
"bedrock:PutUseCaseForModelAccess",
"aws-marketplace:ViewSubscriptions",
"aws-marketplace:Subscribe"
],
"Resource": "*"
}
]
}
The List actions resolve ids not in the built-in table, such as claude-sonnet-5-5. The two
CountTokens actions answer Claude Code's token counts; without them it estimates instead.
Console → Providers → add bedrock, set the region. Leave both key fields blank to use
the workload role, or fill both. Session token is optional.
export OPENAI_BASE_URL=http://<gateway>:8787/v1
# Claude on Bedrock through Anthropic SDKs:
export ANTHROPIC_BASE_URL=http://<gateway>:8787
# requests carry: x-anyray-provider: bedrock
Default for all traffic: Routing → mode single, target bedrock.
curl http://<gateway>:8787/v1/chat/completions \
-H "Authorization: Bearer <your-anyray-key>" \
-H "x-anyray-provider: bedrock" \
-H "Content-Type: application/json" \
-d '{"model":"claude-sonnet-5-5","messages":[{"role":"user","content":"reply with the word ok"}]}'
It appears in Sessions under provider bedrock.
Allowing only bedrock-runtime silently breaks discovery. VPC endpoints:
Bedrock reference.
Model ids
| Send | Result |
|---|---|
claude-sonnet-4-5-20250929 | us.anthropic.claude-sonnet-4-5-20250929-v1:0 |
| Native Bedrock id | Used as is |
claude-opus-5-5, claude-sonnet-5-5, claude-haiku-5-5 | Discovery only; needs the List actions |
| Undated id, dated-only family | Newest snapshot from v1.10.269; earlier, send the dated id or a model alias |
Details: Bedrock reference.
How developers enrol
Developers use their gateway key on the org-account lane:
curl -fsSL https://app.anyray.ai/i/tnt_… | sh -s -- --org
Always pass --org: without it a personal Claude plan gets billed, and --subscription never
reaches Bedrock. Per user or team: mixing both lanes.
CLAUDE_CODE_USE_BEDROCK bypasses the gatewayCLAUDE_CODE_USE_BEDROCK (or CLAUDE_CODE_USE_VERTEX) ignores ANTHROPIC_BASE_URL. Connect clears
it in user settings; restart Claude Code. A managed-settings.json wins, so its admin must remove it
(details).
Scoping the policy Resource
Name both ARNs (Claude 4+ is profile-only in most regions):
"Resource": [
"arn:aws:bedrock:*::foundation-model/anthropic.*",
"arn:aws:bedrock:*:<account-id>:inference-profile/*anthropic*"
]
Where the credential comes from
Standard AWS chain: ECS/Fargate task role (not execution role), EC2 instance profile, EKS
IRSA, or env/shared-config credentials. On CloudFormation, attach to TaskRole as a managed
policy, never inline (why). Other account or
no workload identity:
static keys.
Troubleshooting
| What you see | Cause and fix |
|---|---|
AWS credentials were not found (500) | No key pair and no reachable role. Attach the policy to the gateway's role (ECS: task role), or set the key pair. |
AWS access key ID and secret access key must be configured together (400) | Set both fields, or clear both. |
AccessDeniedException | Model access not granted in that region, or the policy lacks the inference-profile ARN. |
ValidationException on the model id | Missing List actions, undated id before v1.10.269, or no profile in that region. Grant List, or alias the exact id. |
ResourceNotFoundException asking for the use-case form | Submit the form as the calling IAM principal (how). |
| Requests succeed, nothing in the console | Client signs to AWS directly. Unset CLAUDE_CODE_USE_BEDROCK, restart. |
| Bedrock worked, then stopped after a stack update | Inline policy reconciled away. Re-add as a managed policy. |
... is not supported by bedrock (400) on /v1/files, /v1/batches, /v1/fine_tuning/jobs or /v1/responses/{id} | Not served for Bedrock. Run batch and customization jobs in AWS directly. |
arbitrary provider paths are not forwarded for bedrock (400) | /v1/proxy/* and other unrouted paths are not forwarded on the org's key. Use a served route, or your own AWS credentials. |