Bedrock & Vertex
Configure Claude Code to work with Amazon Bedrock and Google Vertex AI, and connect through proxies.
Model configuration
By default, Claude Code uses claude-3-7-sonnet-20250219
. You can override this using the following environment variables:
You can also set these variables using the global configuration:
See our model names reference for all available models across different providers.
Use with third-party APIs
Claude Code requires access to both Claude 3.7 Sonnet and Claude 3.5 Haiku models, regardless of which API provider you use.
Connect to Amazon Bedrock
If you’d like to access Claude Code via proxy, you can use the ANTHROPIC_BEDROCK_BASE_URL
environment variable:
If you don’t have prompt caching enabled, also set:
Requires standard AWS SDK credentials (e.g., ~/.aws/credentials
or relevant environment variables like AWS_ACCESS_KEY_ID
, AWS_SECRET_ACCESS_KEY
). To set up AWS credentials, run:
Contact Amazon Bedrock for prompt caching for reduced costs and higher rate limits.
Users will need access to both Claude 3.7 Sonnet and Claude 3.5 Haiku models in their AWS account. If you have a model access role, you may need to request access to these models if they’re not already available. Access to Bedrock in each region is necessary because inference profiles require cross-region capability.
Connect to Google Vertex AI
If you’d like to access Claude Code via proxy, you can use the ANTHROPIC_VERTEX_BASE_URL
environment variable:
If you don’t have prompt caching enabled, also set:
Claude Code on Vertex AI currently only supports the us-east5
region. Make
sure your project has quota allocated in this specific region.
Users will need access to both Claude 3.7 Sonnet and Claude 3.5 Haiku models in their Vertex AI project.
Requires standard GCP credentials configured through google-auth-library. To set up GCP credentials, run:
For the best experience, contact Google for heightened rate limits.
Connect though a proxy
When using Claude Code with an LLM proxy (like LiteLLM), you can control authentication behavior using the following environment variables and configs. Note that you can mix and match these with Bedrock and Vertex-specific settings.
Environment variables
ANTHROPIC_AUTH_TOKEN
: Custom value for theAuthorization
andProxy-Authorization
headers (the value you set here will be prefixed withBearer
)ANTHROPIC_CUSTOM_HEADERS
: Custom headers you want to add to the request (inName: Value
format)HTTP_PROXY
: Set the HTTP proxy URLHTTPS_PROXY
: Set the HTTPS proxy URL
If you prefer to configure via a file instead of environment variables, you can add any of these variables to the env
object in your global Claude config (in ~/.claude.json).
Global configuration options
apiKeyHelper
: A custom shell script to get an API key (invoked once at startup, and cached for the duration of each session)