Integrations
Use Claude Code with DeepSeek
Run Claude Code on DeepSeek V4.1 Flash through Token Harbor — the settings.json to copy, a check that proves which model answered, a real edit, and the errors you may see. Tested with Claude Code 2.1.308.
Use Claude Code with DeepSeek
Yes, Claude Code runs on DeepSeek: point it at Token Harbor's Anthropic-compatible
endpoint and set its model IDs to deepseek-v4.1-flash. Every step below was run
on 2026-11-21 (UTC) with Claude Code 2.1.308 on Linux, including file edits through
tool calls.
Before you start
- Claude Code installed:
claude --versionprints the version. - A
thk_…key from /dashboard/api-keys. - A balance or a Pass on that account —
deepseek-v4.1-flashis a paid model. See its price.
1. Point Claude Code at Token Harbor
Put this env block in ~/.claude/settings.json:
{
"env": {
"ANTHROPIC_BASE_URL": "https://tokenharbor.ai",
"ANTHROPIC_AUTH_TOKEN": "YOUR_thk_KEY",
"ANTHROPIC_MODEL": "deepseek-v4.1-flash",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "deepseek-v4.1-flash",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "deepseek-v4.1-flash",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "deepseek-v4.1-flash"
}
}
The base URL has no /v1. Setting all four model IDs keeps Claude Code's
background calls on the same model too. Values in this file win over
environment variables set in your shell.
2. Check which model answers
claude -p "Reply with exactly: connected" --output-format json < /dev/null
Expected, trimmed:
{
"subtype": "success",
"result": "connected",
"modelUsage": {
"deepseek-v4.1-flash": { "...": "..." }
}
}
modelUsage lists only deepseek-v4.1-flash: no Claude model was called.
3. Give it a real task
In a folder with a calc.py whose add() returns a - b:
claude -p "calc.py has a bug in add(). Fix it, then reply with one sentence describing the fix." \
--allowedTools "Read,Edit" < /dev/null
Output from our run, in about 8 seconds:
Fixed `add()` in calc.py by changing the subtraction operator to addition, so it now returns `a + b`.
The file then read return a + b.
What it costs
Charged per token at the model's price. The run in step 3 used 13,252 input, 18,432 cached and 169 output tokens — under half a cent at that day's rates.
Claude Code prints its own cost figure (total_cost_usd), estimated from its
price list rather than ours; for that run it said $0.08. Your
usage page shows what was charged.
Errors you may see
| What Claude Code shows | Fix |
|---|---|
There's an issue with the selected model (…). It may not exist or you may not have access to it. | Check the base URL is https://tokenharbor.ai (no /v1), and the model ID has no vendor prefix: deepseek-v4.1-flash, not deepseek/deepseek-v4.1-flash. |
API Error: 402 No active plan was found on this account … the wallet balance can't cover this model | Top up at /dashboard, or use the key from the account that holds your Pass. |
API Error: 403 Please confirm free-model data sharing in your dashboard | You used deepseek-v4.1-flash:free. Confirm data sharing in the dashboard, or use the paid ID. |
| No output for minutes | Usually an invalid key: Claude Code keeps retrying. Replace the key in settings.json. |
This call is estimated at about $… | A large-call check. See If a large call is paused. |
A line [claude-code:unrecognized_model] {"model":"deepseek-v4.1-flash",…} on
stderr is Claude Code noting a model it does not know. It does not stop the run.
Limits
- We tested these steps with
deepseek-v4.1-flashonly. Other model IDs from /models go in the same four fields.
Next: the DeepSeek V4.1 Flash model page, or your first API call.