Claude Code integration
Connect Claude Code to DeepSeek Through Tokuse
Claude Code speaks the Anthropic Messages API. Tokuse exposes /v1/messages, so Claude Code can use the same endpoint while Tokuse routes the request to DeepSeek. Use the root Tokuse URL, not /v1; Claude Code appends /v1/messages itself. Both ANTHROPIC_AUTH_TOKEN and ANTHROPIC_API_KEY work; this guide uses the Bearer-token variable. Anthropic does not officially support Claude Code with non-Claude models, so test this setup before relying on it. Tokuse currently does not expose /v1/messages/count_tokens; Claude Code may fall back to local token estimation.
Settings
- Base URL
- https://tokuse.com (no /v1)
- Auth variable
- ANTHROPIC_AUTH_TOKEN
- Main model
- deepseek-flash
- Background model
- deepseek-flash
- Optional heavy model
- deepseek-v4-pro
Setup steps
- Create a Tokuse API key in the Tokuse console.
- Export the variables below, or put the same values in ~/.claude/settings.json under env.
- Keep ANTHROPIC_BASE_URL at https://tokuse.com; do not append /v1.
- Set the main model to deepseek-flash and the Haiku background model to deepseek-flash. Map Opus to deepseek-v4-pro only if you want a heavier model.
- Start claude, run /status to confirm the base URL, then send a short prompt.
Shell configuration
export ANTHROPIC_BASE_URL="https://tokuse.com"
export ANTHROPIC_AUTH_TOKEN="sk-your-tokuse-key"
export ANTHROPIC_MODEL="deepseek-flash"
export ANTHROPIC_DEFAULT_SONNET_MODEL="deepseek-flash"
export ANTHROPIC_DEFAULT_OPUS_MODEL="deepseek-v4-pro"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="deepseek-flash"
claude~/.claude/settings.json (alternative)
{
"env": {
"ANTHROPIC_BASE_URL": "https://tokuse.com",
"ANTHROPIC_AUTH_TOKEN": "sk-your-tokuse-key",
"ANTHROPIC_MODEL": "deepseek-flash",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "deepseek-flash",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "deepseek-v4-pro",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "deepseek-flash"
}
}Before production use
- Keep the Tokuse key on the server or in the tool's secret store.
- Use the base URL exactly as shown in Settings; do not append a full endpoint path.
- Verify the model alias in the current Tokuse catalog.
- Test errors, timeout behavior, and cost with a small workload first.