DeepSeek V4 has been optimized for Claude Code. CNBC reported it on launch day. The official documentation confirms V4's agentic coding benchmarks are open-source SOTA. But there is a gap between "this model works with agents" and "here is exactly how to set it up." This guide closes that gap — step by step, with real commands, covering model routing, capability extension, and cost optimization.
Why DeepSeek V4 + Claude Code is a compelling stack
DeepSeek V4 Pro matches GPT-5.5 and Claude Opus 4.7 on agentic coding benchmarks at a fraction of the cost: $0.28/1M input tokens vs $5/1M for GPT-5.5. It supports a 1M-token context window — enough to ingest entire codebases in a single pass. It is Apache 2.0 licensed, which means you can self-host it without usage restrictions. For a full breakdown of DeepSeek V4's capabilities and limitations, see our DeepSeek V4 capability guide.
Claude Code is Anthropic's terminal-native autonomous coding agent. It reads your repository, plans multi-step changes, edits files, runs tests, and iterates on failures. It supports MCP (Model Context Protocol) natively, which means you can extend it with capabilities beyond code. If you're new to Claude Code, start with our installation guide and our Claude Code vs Cursor comparison.
The combination is straightforward: DeepSeek V4 handles reasoning and code generation. Claude Code handles agent execution — reading files, running commands, managing git. AnyCap (or MCP servers) handles multimodal capabilities — image generation, video, web search, storage, publishing.
Prerequisites
Before you start, confirm you have:
- DeepSeek V4 API access — via DeepSeek platform (api.deepseek.com), OpenRouter, or self-hosted. See our DeepSeek V4 developer guide for setup options.
- Claude Code installed —
claude --versionshould return a version number. If not:curl -fsSL https://claude.ai/install.sh | bash - Node.js 18+ — for Claude Code and npm-based tooling
- An API key or OpenRouter key — for routing Claude Code through DeepSeek V4
Step 1: Route Claude Code through DeepSeek V4
Claude Code defaults to Anthropic's Claude models. To use DeepSeek V4 as the reasoning engine, you need to route through a model provider that supports both the Claude Code agent protocol and DeepSeek V4's API.
Option A: OpenRouter (recommended for quick setup)
OpenRouter provides unified API access to both Anthropic and DeepSeek models. Sign up at openrouter.ai, get an API key, and configure Claude Code:
export OPENROUTER_API_KEY=sk-or-your-key-here
claude --model openrouter/deepseek/deepseek-v4-pro
For the Flash variant (faster, cheaper at $0.14/1M tokens):
claude --model openrouter/deepseek/deepseek-v4-flash
Option B: Direct DeepSeek API + custom endpoint
If you have direct DeepSeek API access, configure a custom endpoint. In your Claude Code settings or environment:
export ANTHROPIC_BASE_URL=https://api.deepseek.com/v1
export ANTHROPIC_API_KEY=sk-your-deepseek-key
claude --model deepseek-v4-pro
Note: Direct API routing may have compatibility differences. Test with a simple prompt first: "Explain the architecture of this project in three sentences."
Option C: Self-hosted DeepSeek V4
If you are running DeepSeek V4 locally (via llama.cpp, vLLM, or similar), point Claude Code to your local endpoint:
export ANTHROPIC_BASE_URL=http://localhost:8000/v1
claude
DeepSeek V4 Flash quantized to 4-bit runs on a single consumer GPU. V4 Pro requires more VRAM but is viable on workstation-class hardware.
Verify the routing
Start a Claude Code session and confirm which model is active:
> What model are you running on?
Claude Code should respond indicating it is running on DeepSeek V4 via your configured route.
Step 2: Add multimodal capabilities with AnyCap
DeepSeek V4 is a text-only model. It cannot generate images, create videos, search the web, store files, or publish content. Claude Code provides the agent execution layer — reading files, running commands, managing git — but does not add these capabilities either.
AnyCap fills this gap. Install it as an MCP skill. For a detailed walkthrough of MCP configuration options, see our guide to adding capabilities to Claude Code with MCP:
npx -y skills add anycap-ai/anycap -a claude-code
Authenticate once:
anycap login
Your DeepSeek V4 + Claude Code agent can now:
| Capability | Command in agent session |
|---|---|
| Generate images | anycap image generate "description" |
| Create videos | anycap video generate "description" |
| Search the web | anycap search "query" |
| Store files | anycap drive upload ./path |
| Publish pages | anycap page publish ./file.md |
Step 3: Configure project context
Claude Code reads a CLAUDE.md file at the start of each session for persistent project context. Create one tailored to your DeepSeek V4 setup:
# CLAUDE.md
## Model configuration
- Running on DeepSeek V4 Pro via OpenRouter
- 1M token context window available
- Text-only model — use AnyCap for multimodal tasks
## Capability extensions
- Image generation: anycap image generate
- Video generation: anycap video generate
- Web search: anycap search
- File storage: anycap drive upload
- Publishing: anycap page publish
Generate an initial version with /init inside Claude Code, then customize it with the sections above. For more on Claude Code configuration, see our advanced features guide.
Step 4: Run a real workflow end-to-end
Here is a complete workflow that tests every component of the stack:
1. Build a landing page for a SaaS product called "AgentMetrics"
- FastAPI backend with one endpoint
- Simple HTML/CSS frontend
- Use DeepSeek V4 for all code generation
2. Generate a hero image for the landing page
- Use anycap image generate
3. Store the generated assets
- Use anycap drive upload
4. Publish the landing page
- Use anycap page publish
Your agent — powered by DeepSeek V4 for reasoning — builds the landing page. It calls AnyCap for the hero image. It stores assets in Drive. It publishes the result. One session, three components working together.
Cost optimization: V4 Flash vs V4 Pro
DeepSeek V4 comes in two tiers. Choose based on your workflow:
| Variant | Cost (input) | Cost (output) | Best for |
|---|---|---|---|
| V4 Flash | $0.14/1M tokens | $0.56/1M tokens | Rapid iteration, simple refactors, cost-sensitive workflows |
| V4 Pro | $0.28/1M tokens | $1.12/1M tokens | Complex multi-file refactors, architectural reasoning, debugging |
For most Claude Code sessions, V4 Flash is sufficient. The model is fast, cheap, and handles the majority of coding tasks well. Switch to V4 Pro when you need deeper reasoning — debugging a complex race condition, designing a new architecture, or refactoring across 20+ files.
Cost comparison with alternatives:
| Stack | Approximate cost per heavy coding session |
|---|---|
| Claude Code + Claude Opus 4.7 | $5–15 (subscription or API) |
| Claude Code + GPT-5.5 | $3–10 (API per-token) |
| Claude Code + DeepSeek V4 Flash | $0.50–2 (API per-token) |
| Claude Code + DeepSeek V4 Pro | $1–4 (API per-token) |
DeepSeek V4 Flash at $0.14/1M input tokens is roughly 1/35th the cost of Claude Opus 4.7. Over a month of daily agent use, the difference is hundreds of dollars. For a full Claude Code pricing breakdown, see our plan comparison. For a head-to-head between DeepSeek V4 and GPT-5.5, see our capability comparison.
What this stack excels at
Large-scale refactoring. DeepSeek V4's 1M-token context window means Claude Code can ingest an entire monorepo in one pass. Renaming an interface across 50+ files, updating imports, and running the test suite happens in a single autonomous session.
Budget-constrained agent workflows. If you want autonomous coding agents but Claude Max at $100–200/month is too steep, DeepSeek V4 Flash + Claude Code + AnyCap gives you the same agent architecture at a fraction of the cost.
Self-hosted, air-gapped development. DeepSeek V4 is Apache 2.0 licensed. Run it on your own hardware. Combine with Claude Code for agent execution. Add AnyCap for capabilities that stay within your infrastructure. No data leaves your environment.
Multimodal agent workflows on a budget. DeepSeek V4 handles reasoning. AnyCap handles images, video, search, storage, and publishing. You get a fully multimodal agent without paying for a multimodal model. See our guide to adding multimodal capabilities to DeepSeek V4 for more.
FAQ
Does DeepSeek V4 work with Cursor instead of Claude Code?
Yes. The same routing pattern applies. In Cursor, add DeepSeek V4 as a model provider via Settings → Models → Add Custom Model. AnyCap installs the same way as an MCP skill. The agent shell is interchangeable.
Can I use DeepSeek V4 with OpenClaw?
Yes. CNBC specifically reported that DeepSeek V4 has been optimized for OpenClaw. The setup pattern is similar: configure the model endpoint in OpenClaw, install AnyCap for capabilities.
Is DeepSeek V4's agentic coding performance actually competitive?
Yes. V4 Pro scores 81% on SWE-bench Verified, matching GPT-5.5 and Claude Opus 4.7. On agentic coding benchmarks specifically, DeepSeek claims open-source SOTA. Real-world developer reports confirm strong performance, especially given the price difference. For a full benchmark breakdown, see our DeepSeek V4 developer guide.
What are the limitations?
DeepSeek V4 is text-only — no native multimodal. Claude Code's agent protocol was designed for Anthropic models, so some Claude-specific features (extended thinking, certain permission models) may not translate perfectly to DeepSeek V4 routing. Test your specific workflow before committing to the stack. See our DeepSeek V4 capability guide for a comprehensive overview of what V4 can and cannot do.
How does this compare to just using Claude Opus 4.7 directly?
Claude Opus 4.7 + Claude Code is the most integrated experience — everything is designed to work together. DeepSeek V4 + Claude Code is cheaper but requires routing configuration. The tradeoff is cost vs integration smoothness. If budget is not a constraint, stay native. If you want frontier agentic coding at 1/35th the cost, DeepSeek V4 is the play.
Related Articles
- DeepSeek V4: Complete Developer Guide — Architecture, benchmarks, API integration, self-hosting, and everything you need to integrate DeepSeek V4.
- DeepSeek V4 vs GPT-5.5: Full Capability Comparison — Benchmarks, pricing, multimodal gap, and deployment flexibility compared side-by-side.
- How to Add Multimodal Capabilities to DeepSeek V4 Agents — Add image generation, video, web search, and cloud storage to your DeepSeek V4 agent in under 2 minutes.
- Claude Code vs Cursor: Which AI Coding Agent Wins in 2026? — Terminal-native agent vs IDE fork. Compare autonomy, context handling, pricing, and real tasks.
- How to Add Agent Capabilities to Claude Code with MCP — Step-by-step MCP configuration guide plus the AnyCap one-command fast path.
Set up DeepSeek V4 with Claude Code:
# Route Claude Code through DeepSeek V4
export OPENROUTER_API_KEY=sk-or-your-key
claude --model openrouter/deepseek/deepseek-v4-pro
# Add multimodal capabilities
npx -y skills add anycap-ai/anycap -a claude-code
Install AnyCap · Claude Code Setup Guide · DeepSeek V4 Developer Guide