Skip to main content
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

To avoid getting into different caching issues of Claude code -
  • Ensure there is no model field in settings.json. If it’s present remove it. This overwrites the env model selection.
  • Once you update the settings.json, start claude, and execute /logout. And restart - select use API key even if its not recommended.
    Claude cli API selection
Claude Code supports multiple authentication methods. Choose the one that matches your account type.
  1. Update settings.json
Global settings.json is placed in your home folder.
  • macOS / Linux / WSL (User Global): ~/.claude/settings.json
  • Windows (User Global): %USERPROFILE%\.claude\settings.json
  • Project-Specific: .claude/settings.json (located within your individual project’s root directory)
  • Local Overrides: .claude/settings.local.json (also in the project root, used for personal preferences that aren’t shared via Git)
You will need to update the most granular settings.json.

1. Using alias

  1. Add following routing rules in Bifrost
sonnet-model route
  • Keep it a global level and assign priority you want to assign
  • Add model condition as model = sonnet-model. This option is not available out of the box - so type this string and select Create sonnet-model
  • And add second header condition; to check if the user-agent starts with claude-cli.
  • And then you can map this model to any model you want. In the configuration given - we are using vertex/claude-sonnet-4-6.
sonnet-model routing example
haiku-model route
  • Repeat the above steps by replacing sonnet-model with haiku-model.
  1. Update settings.json
The JSON snippets below show only the env key. Merge them into your existing settings.json top-level object — do not paste them as a standalone file, or you will overwrite other settings like permissions, model, and apiKeyHelper.
"env": {
  "ANTHROPIC_BASE_URL": "http://localhost:8080/anthropic",
  "ANTHROPIC_API_KEY": "your-virtual-key",
  "ANTHROPIC_DEFAULT_HAIKU_MODEL": "haiku-model",
  "ANTHROPIC_DEFAULT_SONNET_MODEL": "sonnet-model"
}

2. Using provider-specific model pinning

Anthropic

Update settings.json to pick Anthropic models. For Anthropic models, you don’t need to prefix models with provider name.
"env": {
  "ANTHROPIC_BASE_URL": "http://localhost:8080/anthropic",
  "ANTHROPIC_API_KEY": "your-virtual-key",
  "ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-4-6",
  "ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-4-6"
}

Bedrock

Update settings.json to pick Anthropic models on Bedrock.
"env": {
  "ANTHROPIC_BASE_URL": "http://localhost:8080/anthropic",
  "ANTHROPIC_API_KEY": "your-virtual-key",
  "ANTHROPIC_DEFAULT_HAIKU_MODEL": "bedrock/global.anthropic.claude-haiku-4-6",
  "ANTHROPIC_DEFAULT_SONNET_MODEL": "bedrock/global.anthropic.claude-sonnet-4-6"
}
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
Claude bedrock pinning

Vertex

Update settings.json to pick Anthropic models on Vertex.
"env": {
  "ANTHROPIC_BASE_URL": "http://localhost:8080/anthropic",
  "ANTHROPIC_API_KEY": "your-virtual-key",
  "ANTHROPIC_DEFAULT_HAIKU_MODEL": "vertex/claude-haiku-4-6",
  "ANTHROPIC_DEFAULT_SONNET_MODEL": "vertex/claude-sonnet-4-6"
}

Azure

Update settings.json to pick Anthropic models on Azure.
"env": {
  "ANTHROPIC_BASE_URL": "http://localhost:8080/anthropic",
  "ANTHROPIC_API_KEY": "your-virtual-key",
  "ANTHROPIC_DEFAULT_HAIKU_MODEL": "azure/claude-haiku-4-6",
  "ANTHROPIC_DEFAULT_SONNET_MODEL": "azure/claude-sonnet-4-6"
}
Azure model  pinning
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. 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.

Checklist

  1. Ensure the model selected is same as you configured in the settings.json.
Selected model in Claude cli
If this is not the case -
  1. Select model using /config
  2. Execute /config
  3. Search for model
  4. Select the correct model
Claude code model selection using /config
  1. Or pass the model using /model <model_name> e.g., /model sonnet-model