DeepSeek: DeepSeek V3.2 in Claude Code

Run deepseek/deepseek-v3.2 as the model behind Claude Code through Redline, with a hard spend cap on the key and no prompt retention.

V3.2 keeps the 160k context and trims the output price, so it is a cheaper stand-in for V3.1 on long agent sessions.

Model iddeepseek/deepseek-v3.2
Context164k tokens
Input price$0.309 / million tokens
Output price$0.460 / million tokens
Tool callingSupported

Set it up

Point Claude Code's base URL at Redline (no /v1), set the auth token to your key, name this model, and set the context length to its real value of 163,840:

# Put these in your shell profile, then run: claude
export ANTHROPIC_BASE_URL=https://redline-gateway.pages.dev
export ANTHROPIC_AUTH_TOKEN=rl-...
export ANTHROPIC_MODEL=deepseek/deepseek-v3.2
export ANTHROPIC_DEFAULT_HAIKU_MODEL=qwen/qwen3-30b-a3b-instruct-2507
export CLAUDE_CODE_MAX_CONTEXT_TOKENS=163840

Or put the same values under env in ~/.claude/settings.json:

// ~/.claude/settings.json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://redline-gateway.pages.dev",
    "ANTHROPIC_AUTH_TOKEN": "rl-...",
    "ANTHROPIC_MODEL": "deepseek/deepseek-v3.2",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "qwen/qwen3-30b-a3b-instruct-2507",
    "CLAUDE_CODE_MAX_CONTEXT_TOKENS": "163840"
  }
}

ANTHROPIC_DEFAULT_HAIKU_MODEL is the cheap background model, set to qwen/qwen3-30b-a3b-instruct-2507 above. CLAUDE_CODE_MAX_CONTEXT_TOKENS is set because Claude Code assumes 200K for an id it does not recognise. Use ANTHROPIC_AUTH_TOKEN and leave ANTHROPIC_API_KEY unset. Full setup and every caveat is in the Claude Code guide.

Tool calling Claude Code reads, edits and runs commands only through tool calls, so the model you set here must support tool calling. A model without it can chat but cannot touch your files.

FAQ

Can DeepSeek: DeepSeek V3.2 edit files and run commands in Claude Code?

Yes. It supports tool calling, which is what Claude Code needs to use its Read, Edit, Write and Bash tools. A model without tool calling could only chat.

How much does it cost?

$0.309 per million input tokens and $0.460 per million output tokens through Redline, margin already included. Put a spend cap on the key so an agent loop cannot overrun it.

Is this an official Anthropic setup?

No. Anthropic does not officially support routing Claude Code to non-Claude models through a gateway. It works because Redline translates the Messages API, but it is not a configuration Anthropic backs.

Other models for Claude Code