Skip to main content
Claude Code brings AI-powered coding capabilities directly to your terminal.

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.

Claude Pro / Max accounts

If you have a Claude Pro or Max subscription, Claude Code authenticates via browser-based OAuth — no API key needed.
  1. Set the Bifrost base URL
    export ANTHROPIC_BASE_URL=http://localhost:8080/anthropic
    
  2. Run Claude Code and log in
    claude
    
    A browser window opens for you to log in with your Claude.ai account. All traffic automatically routes through Bifrost.
Max subscriptions default to Opus, while Pro subscriptions default to Sonnet. You can change this with the /model command or environment variables.

Claude for Teams / Enterprise accounts

Teams and Enterprise users authenticate the same way — via browser OAuth with their team Claude.ai account.
  1. Set the Bifrost base URL
    export ANTHROPIC_BASE_URL=http://localhost:8080/anthropic
    
  2. Run Claude Code and log in
    claude
    
    Log in with the Claude.ai account your team admin invited you to.
Team Premium defaults to Opus, Team Standard defaults to Sonnet. Enterprise users have access to Opus but it may not be the default — check with your admin.

API key based usage

For users with Anthropic Console API keys or Bifrost virtual keys:
  1. Configure environment variables
    export ANTHROPIC_API_KEY=your-api-key  # Anthropic Console key or Bifrost virtual key
    export ANTHROPIC_BASE_URL=http://localhost:8080/anthropic
    
  2. Run Claude Code
    claude
    

Custom authentication

For enterprise setups where Bifrost handles authentication centrally, Claude Code supports additional auth mechanisms:
  • ANTHROPIC_AUTH_TOKEN — Sets the Authorization: Bearer header. Use this when your gateway requires a custom bearer token.
    export ANTHROPIC_AUTH_TOKEN=your-bearer-token
    export ANTHROPIC_BASE_URL=http://localhost:8080/anthropic
    
  • apiKeyHelper — A script that dynamically generates credentials. Configure in Claude Code settings:
    {
      "apiKeyHelper": "/path/to/your/credential-script.sh"
    }
    
    Set CLAUDE_CODE_API_KEY_HELPER_TTL_MS to control the refresh interval (in milliseconds).
ANTHROPIC_AUTH_TOKEN takes precedence over ANTHROPIC_API_KEY. The apiKeyHelper has the lowest precedence — it is only used when neither ANTHROPIC_AUTH_TOKEN nor ANTHROPIC_API_KEY is set.
Now all Claude Code traffic flows through Bifrost, giving you access to any provider/model configured in your Bifrost setup, plus MCP tools and observability.

Cloud Provider Passthrough

Bifrost can act as a gateway between Claude Code and cloud providers like Amazon Bedrock, Google Vertex AI, and Azure. This lets you route Claude Code traffic through Bifrost while using your cloud provider’s infrastructure.

Amazon Bedrock via Bifrost

Route Claude Code through Bifrost’s Bedrock endpoint, which handles AWS authentication on your behalf:
# Enable Bedrock mode
export CLAUDE_CODE_USE_BEDROCK=1
export ANTHROPIC_BEDROCK_BASE_URL=http://localhost:8080/bedrock
export CLAUDE_CODE_SKIP_BEDROCK_AUTH=1  # Bifrost handles AWS auth
export AWS_REGION=us-east-1 # This acts as a placeholder - adaptive load balancer automatically flips based on provider availability

# Pin model versions (recommended)
export ANTHROPIC_DEFAULT_SONNET_MODEL="us.anthropic.claude-sonnet-4-6"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="us.anthropic.claude-haiku-4-5-20251001-v1:0"

# Start Claude Code
claude
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

Route Claude Code through Bifrost’s Vertex AI endpoint:
# Enable Vertex AI mode
export CLAUDE_CODE_USE_VERTEX=1
export ANTHROPIC_VERTEX_BASE_URL=http://localhost:8080/genai
export CLAUDE_CODE_SKIP_VERTEX_AUTH=1  # Bifrost handles GCP auth
export ANTHROPIC_VERTEX_PROJECT_ID=your-project-id
export CLOUD_ML_REGION=us-east5

# Pin model versions (recommended)
export ANTHROPIC_DEFAULT_SONNET_MODEL="claude-sonnet-4-6"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-haiku-4-5@20251001"

# Start Claude Code
claude

Azure via Bifrost

Claude Code doesn’t have native Azure passthrough like Bedrock or Vertex. Instead, route through Bifrost’s Anthropic endpoint and let Bifrost handle routing to Azure-hosted models:
# Use Bifrost's Anthropic endpoint
export ANTHROPIC_API_KEY=your-bifrost-virtual-key
export ANTHROPIC_BASE_URL=http://localhost:8080/anthropic

# Point model tiers to Azure-hosted models in your Bifrost config
export ANTHROPIC_DEFAULT_SONNET_MODEL="azure/claude-sonnet-4-5"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="azure/claude-haiku-4-5"

# Start Claude Code
claude
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 shorthand
/model opus
/model sonnet
/model haiku

# Using full model names
/model claude-opus-4-5-20251101
/model claude-sonnet-4-5-20250929

# 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.

Example: Full Bifrost Setup

Anthropic API passthrough (most common)

# Core Bifrost configuration
export ANTHROPIC_BASE_URL=http://localhost:8080/anthropic

# For API key users (skip for Pro/Max/Team OAuth login)
export ANTHROPIC_API_KEY=your-bifrost-virtual-key

# Custom model tiers (optional)
export ANTHROPIC_DEFAULT_SONNET_MODEL="anthropic/claude-sonnet-4-5-20250929"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="azure/claude-haiku-4-5"

# Start Claude Code
claude

Bedrock passthrough

# Bedrock via Bifrost
export CLAUDE_CODE_USE_BEDROCK=1
export ANTHROPIC_BEDROCK_BASE_URL=http://localhost:8080/bedrock
export CLAUDE_CODE_SKIP_BEDROCK_AUTH=1
export AWS_REGION=us-east-1

# Pin model versions
export ANTHROPIC_DEFAULT_SONNET_MODEL="us.anthropic.claude-sonnet-4-6"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="us.anthropic.claude-haiku-4-5-20251001-v1:0"

# Start Claude Code
claude
Add these exports to your ~/.bashrc or ~/.zshrc for persistent configuration across terminal sessions.

Using Non-Anthropic Models with Claude Code

Bifrost automatically translates Anthropic API requests to other providers, so you can use Claude Code with models from OpenAI, Google, Mistral, and more. Use the provider/model-name format to specify any Bifrost-configured model. Override default model tiers:
# Use OpenAI for the primary (Sonnet) tier
export ANTHROPIC_DEFAULT_SONNET_MODEL="openai/gpt-5"

# Use Google Gemini for the Opus tier
export ANTHROPIC_DEFAULT_OPUS_MODEL="gemini/gemini-2.5-pro"

# Use Groq for the Haiku (fast) tier
export ANTHROPIC_DEFAULT_HAIKU_MODEL="groq/llama-3.3-70b-versatile"
Switch models mid-session:
/model openai/gpt-5
/model gemini/gemini-2.5-pro
/model mistral/mistral-large-latest
/model xai/grok-3

Supported Providers

Bifrost supports the following providers with the provider/model-name format: openai, azure, gemini, vertex, bedrock, mistral, groq, cerebras, cohere, perplexity, xai, ollama, openrouter, huggingface, nebius, parasail, replicate, vllm, sgl
Non-Anthropic models must support tool use for Claude Code to work properly. Claude Code relies on tool calling for file operations, terminal commands, and code editing. Models without tool use support will fail on most operations.
Claude-specific features like extended thinking, web search, computer use, and citations are not available when using non-Anthropic models. Core functionality — chat, streaming, and tool use — works across most providers.