DeepSeek claude code

Use DeepSeek behind Claude Code without migrating your whole workflow

Keeping the Claude Code harness and terminal experience does not require keeping the same model backend. DeepSeek provides an Anthropic-compatible route, so you can change or split the model layer while preserving the client workflow.

What changes and what stays

Separate the coding harness from the model route

Stays

Claude Code CLI, repository workflow, commands and tool interface

Changes

API endpoint, API key, backend model and billing account

The client name is not proof of the backend model. Once Claude Code points to DeepSeek's Anthropic-compatible base URL and key, requests and billing follow that configured route.

Official setup

Change the endpoint and credentials first

Checked August 11, 2026. DeepSeek requires Node.js 18 or newer for a fresh Claude Code install; Windows also requires Git for Windows. Obtain the API key from the official DeepSeek platform.

macOS / Linux
export ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropic
export ANTHROPIC_AUTH_TOKEN=<your DeepSeek API Key>
export ANTHROPIC_MODEL=deepseek-v4-pro[1m]
export ANTHROPIC_DEFAULT_HAIKU_MODEL=deepseek-v4-flash
export CLAUDE_CODE_SUBAGENT_MODEL=deepseek-v4-flash
Windows PowerShell
$env:ANTHROPIC_BASE_URL="https://api.deepseek.com/anthropic"
$env:ANTHROPIC_AUTH_TOKEN="<your DeepSeek API Key>"
$env:ANTHROPIC_MODEL="deepseek-v4-pro[1m]"
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL="deepseek-v4-flash"
$env:CLAUDE_CODE_SUBAGENT_MODEL="deepseek-v4-flash"

Use the live guide as the configuration source

The blocks above retain the endpoint, key and primary/worker route needed to understand the setup. The official example also includes timeout, auto-compact and effort settings. Copy the current official values when configuring a machine rather than treating this page as a frozen install script.

Current model routing

Claude labels are mapped to DeepSeek models

Opus-class labels

deepseek-v4-pro

DeepSeek's current generic mapping sends model names beginning with claude-opus to the Pro route.

Sonnet / Haiku-class labels

deepseek-v4-flash

The generic mapping sends model names beginning with claude-sonnet or claude-haiku to Flash.

Documentation nuance: the current installation example explicitly overrides the primary and Sonnet defaults to deepseek-v4-pro[1m], while the model-mapping section describes the generic Sonnet-prefix route as Flash. An explicit environment override is configuration; the prefix table describes default gateway mapping. Verify both sections before changing a live setup.

Why this is a routing decision

Use different routes for different risk levels

This is a workload-design suggestion, not an official performance promise or a Modroam benchmark result.

Main task or difficult reasoning

Start with the Pro route

Validate on a representative task

Subagent or repetitive work

Test the Flash route

Measure corrections, latency and cost

Final critical review

Keep Claude or another trusted review layer

Production review is a separate responsibility

Web Search and hidden cost

A cheaper backend does not make every session cheaper

DeepSeek says its Claude Code route can invoke Web Search. Search results require additional model requests to summarize retrieved content, so those calls add token cost.

Tool calls, long context, retries, search behavior and failed attempts all affect end-to-end cost. Compare completed tasks, not only the advertised input-token price.

When not to switch

Keep the current route when uncertainty is the bigger cost

  • Tool compatibility is critical and you have not tested the exact commands or hooks.
  • The next change is production-critical and has no independent review.
  • You do not have a current cost and latency baseline.
  • Your existing workflow already fits a fixed subscription and its limits better.

Safe first test

Start read-only, then permit one bounded edit

  1. 1

    Inspect files without changing them.

  2. 2

    Explain the repository architecture and identify uncertainties.

  3. 3

    Propose one bounded change without writing it.

  4. 4

    Make one small edit after you approve the plan.

  5. 5

    Compare result quality, corrections, total cost and elapsed time with your current model.