Claude Code brings AI-powered coding capabilities directly to your terminal.
If your Allowed Headers are already set to *, you can skip this note. If not and you face issues integrating Bifrost with Claude Code, try switching to * or adding the specific headers required by your client. By default, Bifrost whitelists: Content-Type, Authorization, X-Requested-With, X-Stainless-Timeout, and X-Api-Key.
To install Claude code
npm install -g @anthropic-ai/claude-code
Configuring Claude Code to work with Bifrost
Claude Code supports multiple authentication methods. Choose the one that matches your account type.
-
Set environment variables
export ANTHROPIC_API_KEY=your-bifrost-virtual-key # or "dummy" if virtual keys are not enabled
export ANTHROPIC_BASE_URL=http://localhost:8080/anthropic
-
Run Claude Code
Amazon Bedrock via Bifrost
Setup
Configure environment variables
export ANTHROPIC_API_KEY=bifrost-virtual-key
export ANTHROPIC_BASE_URL=http://localhost:8080/anthropic
Pin model versions (recommended)
export ANTHROPIC_DEFAULT_SONNET_MODEL="bedrock/global.anthropic.claude-sonnet-4-6"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="bedrock/global.anthropic.claude-haiku-4-5-20251001-v1:0"
If you don’t pin using CLI - you can pin these in UI. Go to Dashboard > Models > Model Providers > AWS Bedrock > Key. And add deployments
Start Claude Code
Always pin model versions with ANTHROPIC_DEFAULT_*_MODEL when using Bedrock. Without pinning, Claude Code aliases resolve to the latest version, which may not be enabled in your Bedrock account.
Google Vertex AI via Bifrost
Setup
Configure environment variables
export ANTHROPIC_API_KEY=bifrost-virtual-key
export ANTHROPIC_BASE_URL=http://localhost:8080/anthropic
Pin model versions (recommended)
export ANTHROPIC_DEFAULT_SONNET_MODEL="vertex/claude-sonnet-4-6"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="vertex/claude-haiku-4-5"
Start Claude Code
Azure via Bifrost
Setup
Configure environment variables
export ANTHROPIC_API_KEY=bifrost-virtual-key
export ANTHROPIC_BASE_URL=http://localhost:8080/anthropic
Pin model versions (recommended)
export ANTHROPIC_DEFAULT_SONNET_MODEL="azure/claude-sonnet-4-6"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="azure/claude-haiku-4-5"
You will also have to map these model names to actual deployment names on Bifrost dashboard.
Start Claude Code
Azure-hosted models must support tool use capabilities for Claude Code to function properly. Verify tool calling support before configuring Azure models.
Model Configuration
Claude Code uses three model tiers: Sonnet (default), Opus (complex tasks), and Haiku (fast, lightweight). With Bifrost, you can override these defaults to use any model from any provider.
Override Default Models:
Set environment variables to replace Claude Code’s default model tiers with any Bifrost-configured model:
# Replace Sonnet tier with GPT-5
export ANTHROPIC_DEFAULT_SONNET_MODEL="openai/gpt-5"
# Replace Opus tier with Claude Opus 4.5
export ANTHROPIC_DEFAULT_OPUS_MODEL="anthropic/claude-opus-4-5-20251101"
# Replace Haiku tier with Azure-hosted Claude
export ANTHROPIC_DEFAULT_HAIKU_MODEL="azure/claude-haiku-4-5"
Alternative models must support tool use capabilities for file operations, terminal commands, and code editing to work properly with Claude Code.
Start with a Specific Model:
Launch Claude Code with a specific model using the --model flag:
# Start with Opus
claude --model claude-opus-4-5-20251101
# Start with Haiku for lightweight tasks
claude --model claude-haiku-4-5-20251001
Switching Models Mid-Session
Use the /model command to switch models during an active session:
# Using full model names
/model claude-opus-4-5-20251101 # This will be used from anthropic provider
/model claude-sonnet-4-5-20250929 # This will be used from anthropic provider
# Using different providers dynamically via Bifrost
/model vertex/claude-haiku-4-5
/model azure/claude-sonnet-4-5
/model bedrock/claude-sonnet-4-5
Run /model without arguments to check your current model. The switch is instantaneous and Claude Code seamlessly continues your conversation context with the new model.
If you use Claude-specific features like web search, computer use, or citations, ensure the model you switch to also supports these capabilities. Non-Claude models or Claude models on certain providers may not support all features.
Provider Compatibility
Not all providers work well with Claude Code. Since Claude Code heavily relies on tool calling for file operations, terminal commands, and code editing, providers must properly support and stream tool call arguments.Known Issues:
- OpenRouter: Does not stream function call arguments properly. Tool calls return with empty
arguments fields, causing Claude Code to fail when attempting file operations or other tool-based actions.
- Some proxy providers: May not fully implement the Anthropic API streaming specification for tool calls.
If you experience issues with tool calls not executing properly, try switching to a different provider in your Bifrost configuration.