CLI Setup

The easiest way to start Claude Code with Bonsai is with the Bonsai CLI:
npm install -g @bonsai-ai/cli

bonsai login

bonsai start claude
You can now mention models like @gpt5 or @grok in your prompts to use different models. In Claude Code, you can also use /model @model-alias to set the default model.

Environment Variables

Alternatively, you can export environment variables before you run claude:
ANTHROPIC_BASE_URL="https://go.trybons.ai" ANTHROPIC_AUTH_TOKEN="bonsai_api_key" claude

Global Configuration

Set up Claude Code CLI to use Bonsai globally:
# Create Claude Code settings directory
mkdir -p ~/.claude

# Create global settings file
cat > ~/.claude/settings.json << EOF
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://go.trybons.ai",
    "ANTHROPIC_AUTH_TOKEN": "bonsai_api_key"
  }
}
EOF

Project-Specific Configuration

If you only want to use Bonsai with Claude Code in a particular project:
# In your project directory
mkdir -p .claude

# Create local settings file
cat > .claude/settings.local.json << EOF
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://go.trybons.ai", 
    "ANTHROPIC_AUTH_TOKEN": "bonsai_api_key"
  }
}
EOF

VS Code Extension

You can configure Claude Code in VS Code to use Bonsai in a couple of ways: Restart VS Code after updating settings.

Next Steps