Appearance
Claude Code on Amazon Bedrock
Corveil is an AI gateway. Point ANTHROPIC_BEDROCK_BASE_URL at it and Claude Code's Bedrock traffic passes through one governed endpoint, where every call is logged, priced and held to your budgets while AWS keeps billing your account.
Claude Code can run in Bedrock mode (CLAUDE_CODE_USE_BEDROCK=1) against Corveil instead of AWS. Corveil serves Bedrock's own API under /v1/bedrock. It checks each request against your organization's catalog, the caller's key and your input guardrails. It then forwards the request to Amazon Bedrock unchanged, signed with your organization's AWS credential. AWS bills your AWS account for the tokens. Corveil writes a request log and a spend row for every model call, priced at Bedrock rates, and enforces your budgets.
Choosing a path
Claude Code can reach Corveil in two ways:
| Anthropic API (Claude Code) | Amazon Bedrock (this page) | |
|---|---|---|
| Claude Code setting | ANTHROPIC_BASE_URL | CLAUDE_CODE_USE_BEDROCK and ANTHROPIC_BEDROCK_BASE_URL |
| Who bills the tokens | Anthropic, on the organization's Anthropic key (Direct) or the person's own (Passthrough) | AWS, on the organization's AWS account |
| Model IDs | Anthropic model names | Bedrock inference profile IDs, such as us.anthropic.claude-opus-4-8 |
| Output guardrails | Applied | Logged only; output is not redacted |
Use Bedrock mode when the bill must stay on your AWS account: committed AWS spend, an AWS-only purchasing path, or engineers who already run Claude Code on Bedrock. Otherwise use the Anthropic API path. It needs no AWS setup, and Corveil can redact model output on it.
The Bedrock models you enable are not limited to Bedrock mode. A client on the Anthropic API path, such as Claude Code without Bedrock mode or Claude Desktop, can send a Bedrock model's ID (us.anthropic.claude-opus-4-8) to /v1/messages. Corveil sends that request to Bedrock on your organization's AWS credential, so AWS bills your AWS account, and output guardrails redact as they do for any Anthropic API call.
Prerequisites
An organization admin sets these up once. Each step in Corveil names the permission it needs. Owner and Admin hold all of them. A custom role needs the permission the step names. Roles has the full table.
- An IAM user with the policy below. Corveil takes static IAM access keys. It does not assume a role, and it does not take a Bedrock API key as the organization's credential.
- The AWS account can use Anthropic's models. Anthropic requires a one-time use case form per AWS account: in the Amazon Bedrock console, open the model catalog, select an Anthropic model, and submit the form. See Anthropic's Bedrock guide.
- A Bedrock credential in Corveil. Needs Manage credentials. Under AI Gateway → Providers → Credentials, click Add credential, pick AWS Bedrock, and enter the access key ID, secret access key and region. Test checks that the keys are valid with AWS STS. It does not call Bedrock, so it doesn't prove the policy is attached.
- The inference profiles you want are enabled. Needs Manage models. Catalog discovery runs with your credential and adds a row for each Anthropic Claude cross-region inference profile your region lists, named by its profile ID (
us.anthropic.claude-opus-4-8,global.anthropic.claude-sonnet-4-6). It starts as soon as you add the credential, and the models appear in Catalog a minute or so later. The Credentials tab shows Discovering until then. After that, discovery runs again when you rotate the credential, and once a day. Discovered models start off: enable the ones your engineers will use under AI Gateway → Providers → Catalog. Claude Code only sees, and can only call, the profiles that are enabled there. - A Corveil key per person. Each engineer needs their own Corveil virtual key (
sk-citadel-…). A Viewer can't create one, so check your engineers' roles first. See Who can use it.
Who can use it
Each engineer puts their own Corveil key in Claude Code. A person can create their own key if their organization role is Member, Gateway user, Admin or Owner, or a custom role that includes Manage own API keys. They create one under People & Access → API Keys, or run corveil login, which saves a key to the CLI's config profile. Running corveil login again on the same machine replaces that key, so a key created under API Keys suits Claude Code better.
Viewer, Billing admin, Budget viewer (all teams), Budget stakeholder, and custom roles without Manage own API keys can't create a key. corveil login shows No API key issued in the browser and stops with "Your role in … can't create API keys". To get such a person running, do one of these:
- Change their role to Member, or to Gateway user if they shouldn't write to the knowledge graph. An admin sets it under People & Access → Users. If a directory rule maps their group to Viewer, change that rule under Directory mappings, or the next sync sets them back to Viewer.
- Give them a key. Someone with Manage everyone's API keys can issue one or create one in their name. See Give each person a key.
A person can stay on Viewer and use a key someone gave them. They still can't create or change keys themselves.
What a key's limits do on Bedrock
A key's restrictions apply to Bedrock calls as they do on the Anthropic API path:
- Model allowlist. A key with no model list can call every profile enabled in Catalog. A key limited to certain models must name the Bedrock profile IDs, such as
us.anthropic.claude-opus-4-8. Each profile's catalog name is its profile ID. An Anthropic model name such asclaude-opus-4-8doesn't match a Bedrock profile, so the call gets a403"not allowed for this API key". The profile list shows only the profiles the key may call. - Budgets and spend limits. The key's Budget Limit, and any user, team or organization spend limit, count Bedrock spend and stop Bedrock calls when they are reached.
- Rate limits. A key's requests-per-minute and tokens-per-minute limits apply.
IAM policy
Attach this policy to the IAM user whose access keys you enter in Corveil. Replace:
<partition>withawsfor a commercial region, oraws-us-govfor GovCloud.<region>with the credential's region, such asus-east-1.<account-id>with the AWS account the keys belong to.
json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "CatalogDiscovery",
"Effect": "Allow",
"Action": [
"bedrock:ListFoundationModels",
"bedrock:ListInferenceProfiles"
],
"Resource": "*"
},
{
"Sid": "InferenceProfiles",
"Effect": "Allow",
"Action": [
"bedrock:GetInferenceProfile"
],
"Resource": "arn:<partition>:bedrock:<region>:<account-id>:inference-profile/*"
},
{
"Sid": "Inference",
"Effect": "Allow",
"Action": [
"bedrock:InvokeModel",
"bedrock:InvokeModelWithResponseStream",
"bedrock:CountTokens"
],
"Resource": [
"arn:<partition>:bedrock:*::foundation-model/*",
"arn:<partition>:bedrock:<region>:<account-id>:inference-profile/*"
]
}
]
}bedrock:ListInferenceProfilesis what adds the current Claude models to your catalog. Without it, only foundation models are listed.bedrock:InvokeModelWithResponseStreamserves every streamed turn.bedrock:CountTokensserves the exact counts in Claude Code's/context. Without it, Claude Code falls back to an estimate.- The foundation-model resource names every region (
*), because a cross-region profile can serve a request from any region in its geography.
Configure Claude Code
Set these in your shell, or in the env block of ~/.claude/settings.json:
bash
export CLAUDE_CODE_USE_BEDROCK=1
export ANTHROPIC_BEDROCK_BASE_URL=https://corveil.io/v1/bedrock
export AWS_BEARER_TOKEN_BEDROCK=sk-citadel-your-key-here
export AWS_REGION=us-east-1
export ANTHROPIC_DEFAULT_OPUS_MODEL=us.anthropic.claude-opus-5-5
export ANTHROPIC_DEFAULT_SONNET_MODEL=us.anthropic.claude-sonnet-5-5
export ANTHROPIC_DEFAULT_HAIKU_MODEL=us.anthropic.claude-haiku-5-5ANTHROPIC_BEDROCK_BASE_URLis your Corveil host followed by/v1/bedrock. On a self-hosted instance, replacecorveil.io.AWS_BEARER_TOKEN_BEDROCKholds your Corveil virtual key, not an AWS key. Claude Code sends it asAuthorization: Beareron every Bedrock call, and Corveil signs the call to AWS with the organization's credential. Your own AWS credentials andAWS_PROFILEare not used.AWS_REGION: use the region of the organization's Bedrock credential. Corveil always calls Bedrock in that region, whatever the client sets. Claude Code usesAWS_REGIONto pick its default profile prefix (us.,eu., …).- Model pins: the IDs must be inference profiles enabled in your catalog. See Pin enabled models.
Which credential variable
Use AWS_BEARER_TOKEN_BEDROCK, and leave CLAUDE_CODE_SKIP_BEDROCK_AUTH unset.
Anthropic's general gateway guide shows a different setup: CLAUDE_CODE_SKIP_BEDROCK_AUTH=1 with the gateway key in ANTHROPIC_AUTH_TOKEN, and AWS_BEARER_TOKEN_BEDROCK left unset. In Claude Code 2.1.295, that setup sends the key only on model calls. The inference-profile lookups and token-count calls go out with no credential, Corveil refuses them with a 401, and Claude Code falls back to its built-in model list and to estimated /context counts. Chat still works. With the key in AWS_BEARER_TOKEN_BEDROCK, every call carries it.
Don't combine the two. With CLAUDE_CODE_SKIP_BEDROCK_AUTH=1 set, Claude Code 2.1.295 sends the profile lookup with no credential even when AWS_BEARER_TOKEN_BEDROCK is set.
Pin enabled models
Pin each model tier to an inference profile your organization has enabled. Without pins, Claude Code uses its own defaults for Bedrock, which may not be enabled in your catalog.
To see the profiles your key can use, call Corveil's profile list:
bash
curl -sS "$ANTHROPIC_BEDROCK_BASE_URL/inference-profiles" \
-H "Authorization: Bearer $AWS_BEARER_TOKEN_BEDROCK" \
| jq -r '.inferenceProfileSummaries[].inferenceProfileId'The list is the profiles enabled in Catalog that your key's model allowlist permits. Pin from it:
ANTHROPIC_DEFAULT_OPUS_MODELandANTHROPIC_DEFAULT_SONNET_MODELset theopusandsonnetaliases.ANTHROPIC_DEFAULT_HAIKU_MODELsets the model for background tasks, such as session titles. On Bedrock, Claude Code otherwise uses its default Sonnet model for them.- A profile must match the credential's region. A
us-east-1credential listsus.andglobal.profiles, noteu.ones.
In Claude Code, run /status. The Status tab should show Amazon Bedrock as the API provider and your Corveil URL as the Bedrock base URL. /model shows the model the session uses.
Verify
- Run the
curlabove. A list of profile IDs means the URL and the key work, a Bedrock credential is stored for the organization, and the listed profiles are enabled. Corveil answers this list from its catalog without calling AWS, so it doesn't prove the AWS keys or the IAM policy work. - Start
claudeand send a prompt that uses a tool, such as "list the files in this directory". A completed turn is what proves the organization's AWS keys and IAM policy work. - In Corveil, open Monitoring → Logs. Each turn is a row with provider
bedrockand endpoint/v1/bedrock/model/{modelId}/invoke-with-response-stream, with its tokens and cost. At startup Claude Code also sends a short request to each model it plans to use, to check it has access; those are rows with endpoint/v1/bedrock/model/{modelId}/invoke. - Run
/contextin Claude Code. Withbedrock:CountTokensgranted, the counts come from Bedrock. Token counting is not logged or billed.
Roll out to a fleet
Distribute the shared values through Claude Code managed settings, and leave each person's key to them. A shared key would put every engineer's spend on one key.
Download your organization's files from People & Access → Organization (needs Manage organization settings): choose Get Claude Code profile, then Amazon Bedrock. You get managed-settings.json, a macOS configuration profile, a macOS custom settings plist and a Windows .reg file, with your Corveil address filled in. Roll out to a fleet on the Claude Code page walks through the rollout, starting with a test on one machine, and explains each key.
managed-settings.json goes in /Library/Application Support/ClaudeCode/ on macOS, /etc/claude-code/ on Linux and WSL, and C:\Program Files\ClaudeCode\ on Windows:
json
{
"env": {
"CLAUDE_CODE_USE_BEDROCK": "1",
"ANTHROPIC_BEDROCK_BASE_URL": "https://corveil.io/v1/bedrock",
"AWS_REGION": "us-east-1",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "us.anthropic.claude-opus-5-5",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "us.anthropic.claude-sonnet-5-5",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "us.anthropic.claude-haiku-5-5"
},
"allowedProviders": [
"customEndpoint"
],
"wslInheritsWindowsSettings": true
}allowedProviders makes Claude Code refuse any provider other than this endpoint, so people can't switch to AWS directly. wslInheritsWindowsSettings makes Claude Code inside WSL follow a Windows machine's policy.
The block above shows the defaults. Your download fills in your own: AWS_REGION is your Bedrock credential's region, and each model pin is the newest Opus, Sonnet or Haiku inference profile enabled in Catalog that the region can use. If your organization has no Bedrock credential, or a tier has no profile enabled, the download keeps the default for it and shows a warning. Enable the profile in Catalog and download again before you deploy.
Each engineer then adds their own key to ~/.claude/settings.json:
json
{
"env": {
"AWS_BEARER_TOKEN_BEDROCK": "sk-citadel-your-key-here"
}
}Managed settings take precedence over user settings, so people can't override the base URL or the model pins in their own settings. Before you change a pin, enable the new profile in Catalog.
Limits
- Output is not redacted. Corveil forwards Bedrock's response unchanged. Input guardrails still block a request. A redacting guardrail that matches the input blocks it too, because Corveil does not rewrite the request. Output guardrails only log what they would have done.
- Claude Desktop uses the Anthropic API path. Desktop's own Bedrock mode needs a base URL with no path, and Corveil serves Bedrock under
/v1/bedrock. Use Claude Desktop (MDM) Gateway mode instead. It can still use these Bedrock models: see Bedrock models in Gateway mode. - Stream length. Corveil ends a streamed turn after 10 minutes in total (
STREAM_MAX_DURATIONon a self-hosted instance). Corveil itself has no idle cut-off, because Bedrock sends no keep-alive frames. On corveil.io the load balancer closes a connection that is silent for 240 seconds, which is sooner than Claude Code's own 5-minute stall timeout. A non-streamed call is limited to 10 minutes. - No model ARNs. Corveil refuses ARNs, including application inference profiles, with a 400. Use inference profile IDs, including in
modelOverrides. - No Mantle.
CLAUDE_CODE_USE_MANTLEis not supported through Corveil. - Request size. A request body over 10 MB is refused.
- Service tiers. Corveil passes
X-Amzn-Bedrock-*headers through, soANTHROPIC_BEDROCK_SERVICE_TIERreaches Bedrock. Corveil's price for a call doesn't depend on the tier.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
401 from Corveil | AWS_BEARER_TOKEN_BEDROCK is unset or doesn't hold a valid Corveil key | Put a valid sk-citadel-… key in AWS_BEARER_TOKEN_BEDROCK. |
corveil login shows No API key issued and says the role can't create API keys | The person's role can't create API keys, such as Viewer | Change their role, or give them a key. See Who can use it. |
Chat works, but /context counts are estimates, and claude --debug logs Failed to list Bedrock inference profiles, falling back to hardcoded models | CLAUDE_CODE_SKIP_BEDROCK_AUTH=1 is set, so those calls carry no key | Unset it, and keep the key in AWS_BEARER_TOKEN_BEDROCK. See Which credential variable. |
400 ValidationException: this organization has no bedrock provider credential configured | The organization has no Bedrock credential. For a model call, Monitoring → Logs records it with error type provider_not_configured; profile-list and token-count refusals are not logged. | Add one under AI Gateway → Providers → Credentials. |
404 ResourceNotFoundException: model not available through this gateway | Corveil's catalog has no row for that ID, such as a typo or an Anthropic model name instead of a Bedrock ID | Pin an ID from the profile list. |
403 AccessDeniedException: model not enabled for your organization, or not allowed for this API key | The profile is disabled in Catalog, or the key's model allowlist excludes it, for example by naming claude-opus-4-8 instead of us.anthropic.claude-opus-4-8 | Enable it in Catalog, or add the profile ID to the key's allowlist. See What a key's limits do on Bedrock. |
403 AccessDeniedException from AWS | The IAM policy is missing an action, or the AWS account hasn't submitted Anthropic's use case form | Attach the policy and submit the form. |
| No Bedrock models in Catalog, and the credential shows Failing | AWS rejected the credential during discovery, often because the policy lacks bedrock:ListFoundationModels or bedrock:ListInferenceProfiles. Your audit log has AWS's error. | Attach the policy, then click Discover now on the credential under AI Gateway → Providers → Credentials. |
400 ServiceQuotaExceededException: spend limit exceeded, or budget exceeded | A key, user, team or organization budget is used up. Claude Code shows it at once and doesn't retry. | Raise the budget, ask for more spend if your organization takes spend requests, or wait for the period to reset. |
429: rate limit exceeded | A key's requests-per-minute or tokens-per-minute limit applies. The response carries Retry-After, and Claude Code retries it. | Wait, or raise the key's rate limit. |
/status shows no Bedrock base URL, and AWS rejects the key | ANTHROPIC_BEDROCK_BASE_URL didn't reach Claude Code, so it called AWS directly | Set it where Claude Code reads it, and restart Claude Code. |