Text messages and streaming
Supported by the Anthropic-format endpoint.
A provider-documented setup for routing Claude Code through DeepSeek's Anthropic-compatible API, with exact environment variables, a smoke test, and compatibility limits.
Provider boundary: Claude Code is made by Anthropic. DeepSeek documents a compatible routing configuration and explicitly says the third-party agent is listed for reference without an effectiveness or security guarantee. Your API key and model usage are with DeepSeek Platform, not this website.
How the routing works
Claude Code normally speaks the Anthropic Messages format. Setting ANTHROPIC_BASE_URL redirects those requests to DeepSeek’s Anthropic-format endpoint, while ANTHROPIC_AUTH_TOKEN supplies a DeepSeek Platform key. Compatibility lets many text and tool workflows run, but it does not make the two providers’ APIs identical.
| Claude Code role | Configured value | DeepSeek route |
|---|---|---|
| Primary / Opus | ANTHROPIC_MODEL and ANTHROPIC_DEFAULT_OPUS_MODEL | deepseek-v4-pro[1m] |
| Sonnet default | ANTHROPIC_DEFAULT_SONNET_MODEL | deepseek-v4-pro[1m] |
| Haiku / subagents | ANTHROPIC_DEFAULT_HAIKU_MODEL and CLAUDE_CODE_SUBAGENT_MODEL | deepseek-v4-flash |
DeepSeek’s general Anthropic compatibility page also describes fallback mapping: Claude Opus names map to Pro, while Haiku and Sonnet names map to Flash. The explicit Claude Code variables above take precedence for the documented setup and make routing easier to audit.
A current Claude Code installation verified with claude --version
A DeepSeek Platform API key kept outside source control
A supported OS and terminal; npm installs currently require Node.js 22+
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_OPUS_MODEL="deepseek-v4-pro[1m]"
export ANTHROPIC_DEFAULT_SONNET_MODEL="deepseek-v4-pro[1m]"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="deepseek-v4-flash"
export CLAUDE_CODE_SUBAGENT_MODEL="deepseek-v4-flash"
export CLAUDE_CODE_EFFORT_LEVEL="max"Source: DeepSeek's official Claude Code integration guide, checked July 22, 2026. Keep the key out of Git and shared project files.
DeepSeek Claude Code guide · Anthropic API compatibility table · OpenRouter alternative setup
Confirm ANTHROPIC_AUTH_TOKEN contains an active DeepSeek Platform key and ANTHROPIC_BASE_URL is exactly https://api.deepseek.com/anthropic.
Check DeepSeek service status and account rate limits. Compare Flash for faster tasks and Pro for tasks that need the larger model.
Use the publisher-documented IDs deepseek-v4-pro[1m] and deepseek-v4-flash. Re-open the live DeepSeek guide if an ID or alias changes.
DeepSeek's Anthropic compatibility is not complete: image, document, MCP, container, and several cache-control fields are unsupported or ignored. Check the compatibility table before relying on a Claude feature.
Compatibility limits
DeepSeek publishes a field-level Anthropic API compatibility table. Review it before assuming a Claude Code feature will work through the alternate backend, especially for multimodal content, MCP, containers, prompt caching controls, or code execution.
Supported by the Anthropic-format endpoint.
Core names, schemas, calls, and results are supported; some cache and parallel-control fields are ignored.
Supported, but budget_tokens is ignored; output_config supports effort only.
Image and document message blocks are not supported by the compatibility table.
mcp_servers, mcp_tool_use, and mcp_tool_result fields are ignored or unsupported.
Container and code_execution_tool_result fields are not supported.
A coding agent can read source, execute tools, and edit files. Routing to another provider changes where prompts and repository context are processed. Use a scoped test key, a disposable repository, least-privilege tool permissions, version control, and a review gate before enabling writes or commands in valuable projects.
The documented setup uses a direct DeepSeek Platform key. V4 Pro and Flash have separate input/output rates, and web search can generate additional LLM requests to summarize results. Agent loops, subagents, retries, long repository context, and verbose diffs can consume more tokens than a single chat request.
Start with a small spending limit and representative tasks. Record the primary model, subagent model, cache behavior, tool calls, retries, accepted patches, and total usage. This site’s one-time token packs are unrelated to direct API billing.
Open the DeepSeek API pricing guideUse DeepSeek V4 for intelligent code review and suggestions
Leverage V4's reasoning capabilities for complex debugging
Generate comprehensive documentation with V4's language understanding
DeepSeek officially documents how to route the third-party Claude Code client to its Anthropic-format API, while warning that it cannot guarantee the third-party agent's effectiveness or security. It is not an Anthropic endorsement of DeepSeek as a first-party Claude backend.
Possibly, but provider endpoints are protocol-specific. For example, OpenRouter's documented Claude Code endpoint is https://openrouter.ai/api without /v1. Use that provider's current Claude Code guide rather than copying the DeepSeek endpoint or an OpenAI-compatible /api/v1 URL.
With the endpoint shown here, DeepSeek Platform bills the V4 model tokens and additional tool requests. Claude Code itself may have separate licensing or account terms. Check both vendors' current documentation; this website's token packs do not fund the direct DeepSeek API key.
DeepSeek's published mapping uses deepseek-v4-pro[1m] for the main Opus/Sonnet roles and deepseek-v4-flash for Haiku and subagents. Update the role environment variables, restart the terminal session, and run a new smoke test.
DeepSeek V4 is an alternative model backend, not a replacement for the Claude Code client. The setup keeps Claude Code's terminal agent interface and routes supported Anthropic-format requests to DeepSeek Platform.
No. Core text, streaming, thinking, and tool fields are supported, but DeepSeek's compatibility table marks images, documents, MCP fields, containers, and code-execution result blocks as ignored or unsupported.
Complete API integration guide and documentation
Understand costs and optimize your spending
Verified Pro/Flash specifications, sources, and runtime boundaries.
Verify official weights, licenses, runtimes, and hardware before local deployment.
Compare V4 Flash vs Pro models