Run Claude Code with DeepSeek V4 Pro in 5 Minutes – Zero‑Setup Guide
This guide walks you through installing Node.js, obtaining a DeepSeek API key, installing Claude Code via npm, PowerShell or curl, configuring the settings file for the deepseek‑v4‑pro model, verifying the connection, troubleshooting common issues, and optionally setting up the desktop client, all usable from within China.
Prerequisites
Install Node.js LTS from https://nodejs.org/zh-cn and verify with node -v (e.g., v20.12.2).
Obtain a DeepSeek API key from https://platform.deepseek.com; the token has the form sk-xxxx....
Install Claude Code
npm (recommended, cross‑platform) : npm install -g @anthropic-ai/claude-code then verify with claude --version.
Windows PowerShell (no Node required): irm https://claude.ai/install.ps1 | iex.
macOS/Linux terminal (no Node required): curl -fsSL https://claude.ai/install.sh | bash.
Configure DeepSeek
Settings file location:
Windows: C:\Users\<em>your‑username</em>\.claude\settings.json macOS/Linux: ~/.claude/settings.json Create or edit the file with the following JSON, replacing sk-你的DeepSeekAPIKey with the actual key:
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"env": {
"ANTHROPIC_BASE_URL": "https://api.deepseek.com/anthropic",
"ANTHROPIC_AUTH_TOKEN": "sk-你的DeepSeekAPIKey",
"ANTHROPIC_MODEL": "deepseek-v4-pro",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "deepseek-v4-pro",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "deepseek-v4-pro",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "deepseek-v4-flash",
"CLAUDE_CODE_SUBAGENT_MODEL": "deepseek-v4-flash"
}
}Test the Installation
Run claude in a terminal. Expected output includes:
✓ Connected to deepseek-v4-pro
Ready to help. Type /help for commands.Enter a simple query such as “你好,我在国内成功接入DeepSeek了吗?” and verify a normal reply.
Common Issues (China‑specific)
Command not found : add %USERPROFILE%\.local\bin to the system PATH and restart the terminal.
Connection timeout : ensure the URL https://api.deepseek.com/anthropic is correct and the API key is valid with remaining quota.
401 error : the API key is incorrect or expired; generate a new key and update settings.json.
Optional Desktop Client
Download the client from https://claude.ai/download and install.
Enable Developer Mode via Help → Troubleshooting → Enable Developer Mode .
After restart, configure:
Inference Provider → Gateway
Base URL: https://api.deepseek.com/anthropic API Key: your sk-xxx Model: deepseek-v4-pro or
deepseek-v4-flashSigned-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
liandk
Seasoned Java and mobile developer with years of experience, specializing in mini‑programs, public accounts, and full‑stack front‑end development. In the AI era, I continuously learn to broaden my knowledge and evolve. I revived a public account I started a decade ago during a dessert‑startup venture, using code as a vessel and knowledge as a companion. I share personal projects, technical articles, programming tips, and growth insights—let’s improve together and set sail.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
