Skip to main content

Bedrock

The gateway speaks Bedrock natively and does the SigV4 signing itself.

PropertyValue
Provider idbedrock
Gateway speaksBedrock Runtime (InvokeModel for Claude on /v1/messages; Converse for chat completions and other models)
CredentialAn AWS workload role, or a static access key and secret, plus a region
SigningThe gateway signs SigV4 itself
Client base URLOPENAI_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​

1
Enable model access in AWS

AWS console → Bedrock → Model access in your region. Anthropic models need the one-time use-case form.

2
Grant the gateway access to Bedrock

Attach to the gateway workload's role (applies within seconds, no redeploy):

bedrock-invoke.json
{
"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.

3
Configure the provider

Console → Providers → add bedrock, set the region. Leave both key fields blank to use the workload role, or fill both. Session token is optional.

4
Point your clients at the gateway
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.

5
Send one request
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.

Include both hosts in an egress allowlist

Allowing only bedrock-runtime silently breaks discovery. VPC endpoints: Bedrock reference.

Model ids​

SendResult
claude-sonnet-4-5-20250929us.anthropic.claude-sonnet-4-5-20250929-v1:0
Native Bedrock idUsed as is
claude-opus-5-5, claude-sonnet-5-5, claude-haiku-5-5Discovery only; needs the List actions
Undated id, dated-only familyNewest 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: CLAUDE_CODE_USE_BEDROCK bypasses the gateway

CLAUDE_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):

Scoped resource
"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 seeCause 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.
AccessDeniedExceptionModel access not granted in that region, or the policy lacks the inference-profile ARN.
ValidationException on the model idMissing 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 formSubmit the form as the calling IAM principal (how).
Requests succeed, nothing in the consoleClient signs to AWS directly. Unset CLAUDE_CODE_USE_BEDROCK, restart.
Bedrock worked, then stopped after a stack updateInline 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.