Claude Code with Synthetic
With Synthetic's native Anthropic API support, you can now use Claude Code with any model we support.
Native Anthropic API Support
Synthetic now provides native Anthropic API compatibility, allowing Claude Code to work seamlessly without additional software!
Installation
- bash
npm install -g @anthropic-ai/claude-code
Configuration
Pick the models you want Claude Code to use; the examples below update to match your selection. We recommend the syn: aliases, which automatically track our latest recommended models.
Option 1 (recommended): Creating a synclaude convenience function.
For easier access, create a synclaude function that launches Claude Code with Synthetic configuration:
- bash
# Add to ~/.bashrc or ~/.zshrc
synclaude() {
ANTHROPIC_BASE_URL=https://api.synthetic.new/anthropic \
ANTHROPIC_AUTH_TOKEN=${SYNTHETIC_API_KEY} \
ANTHROPIC_DEFAULT_OPUS_MODEL=syn:large:vision \
ANTHROPIC_DEFAULT_SONNET_MODEL=syn:large:vision \
ANTHROPIC_DEFAULT_HAIKU_MODEL=syn:small:text \
CLAUDE_CODE_SUBAGENT_MODEL=syn:large:vision \
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 \
CLAUDE_CODE_ATTRIBUTION_HEADER=0 \
claude "$@"
}
# Then run: synclaudeOption 2: settings.json
Create a ~/.claude/settings.json file with the following contents to make this your Claude Code default across all projects:
Alternatively, you can create a local .claude/settings.local.json to only apply these settings locally.
- json
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.synthetic.new/anthropic",
"ANTHROPIC_AUTH_TOKEN": "<YOUR_SYNTHETIC_API_KEY>",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "syn:large:vision",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "syn:large:vision",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "syn:small:text",
"CLAUDE_CODE_SUBAGENT_MODEL": "syn:large:vision",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
"CLAUDE_CODE_ATTRIBUTION_HEADER": "0"
}
}Option 3: Environment variables
You can also use environment variables to configure your local Claude Code instance.
- bash
# Add these values to your `~/.bashrc` or `~/.zshrc` to persist changes in new sessions.
# Server configuration
export ANTHROPIC_BASE_URL=https://api.synthetic.new/anthropic # What server to talk to instead of the default
export ANTHROPIC_AUTH_TOKEN=${SYNTHETIC_API_KEY} # Auth key
# Model configuration
# The model to use for opus plan mode:
export ANTHROPIC_DEFAULT_OPUS_MODEL=syn:large:vision
# The model to use for most tasks:
export ANTHROPIC_DEFAULT_SONNET_MODEL=syn:large:vision
# Primarily used for summarization. Use a small model to take advantage of
# small model rate limit discounts:
export ANTHROPIC_DEFAULT_HAIKU_MODEL=syn:small:text
# When starting subagents, what model to use:
export CLAUDE_CODE_SUBAGENT_MODEL=syn:large:vision
# Privacy configuration
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 # Don't send telemetry data
export CLAUDE_CODE_ATTRIBUTION_HEADER=0 # Avoid cache busting due to attribution headers.
# Then run: claudeMake Synthetic Your Claude Default
Replace <YOUR_SYNTHETIC_API_KEY> with your API Key.