DeepSeek V4 Pro with OpenCode: Setup & Cost
Wire DeepSeek V4 Pro 0813 into OpenCode: provider config, model IDs, reasoning effort, and why the open agent + open model stack is cheap.
OpenCode + DeepSeek, a Natural Pair
OpenCode is an open-source terminal coding agent that speaks the OpenAI-compatible protocol — the same contract DeepSeek exposes at https://api.deepseek.com[1]. DeepSeek's GA notes explicitly list OpenCode as a supported backend client[2], and V4 Pro 0813 brings near-frontier patch coding (96.40% SWE-bench Verified)[5].
Because both sides are open source, the pair has no vendor lock-in: swap the model string and the same OpenCode config talks to any OpenAI-compatible provider.
There is a practical reason this pairing gets so much attention in 2026: it is the cheapest way to run a near-frontier coding agent without renting a closed-model quota. OpenCode brings the agent loop (plan, edit, test, repeat) and V4 Pro brings the reasoning — and both are MIT-licensed, so CI pipelines, containers, and air-gapped setups can run the same stack the developer runs locally[2][6].
OpenCode support is confirmed in DeepSeek's GA release notes[2].
Provider Configuration
OpenCode reads providers from its config file. Add a deepseek provider block pointing at the official base_url, then select the model[1][2].
- baseURL https://api.deepseek.com — OpenAI-format endpoint[1].
- apiKey from the DEEPSEEK_API_KEY environment variable.
- 1M context (1048576 tokens) matches the model's real window[6].
# opencode config (opencode.json / config.json)
{
"provider": {
"deepseek": {
"npm": "@ai-sdk/openai-compatible",
"name": "DeepSeek",
"options": {
"baseURL": "https://api.deepseek.com",
"apiKey": "{env:DEEPSEEK_API_KEY}"
},
"models": {
"deepseek-v4-pro": {
"name": "DeepSeek V4 Pro (0813)",
"limit": { "context": 1048576, "output": 393216 }
},
"deepseek-v4-flash": {
"name": "DeepSeek V4 Flash (0731)",
"limit": { "context": 1048576, "output": 393216 }
}
}
}
},
"model": "deepseek/deepseek-v4-pro"
}Model & Reasoning Settings
Use deepseek-v4-pro for agent sessions and deepseek-v4-flash for quick edits. DeepSeek's reasoning_effort (low/high/max) is passed through the OpenAI-compatible API, and thinking mode is enabled by default[3].
OpenCode's agent loop (plan → edit → test → repeat) maps cleanly onto V4 Pro's tool-calling support. Keep the per-session context lean and stable so DeepSeek's automatic prefix caching trims the bill[4].
# inside OpenCode sessions you can switch per task:
# /model deepseek/deepseek-v4-pro
# /model deepseek/deepseek-v4-flash
# reasoning_effort rides in the request body:
# {"reasoning_effort": "high"} <- default, daily agent work
# {"reasoning_effort": "max"} <- hardest tasks[3]Cost Profile
OpenCode + V4 Pro is one of the cheapest frontier-ish agent stacks: $0.022 per SWE-bench test on V4 Pro 0813 (Vals AI neutral harness)[5], and API rates of $0.435/$0.87 per 1M before the 8/16 peak/off-peak change (off-peak $0.66/$1.98 after)[4].
The open-source stack trades about half a point of SWE accuracy for a 58x cost reduction versus the closed flagship[5]. For teams running thousands of agent iterations a day, that difference is the difference between a $220 bill and a $13,000 bill.
Cache-aware session design matters more here than on closed models: keep the repository context and system prompt byte-identical across iterations so DeepSeek's automatic prefix cache serves the reused prefix at $0.003625 per 1M (pre-8/16) or $0.022 off-peak (post-8/16) instead of the miss price[4]. OpenCode's built-in session persistence helps — avoid re-sending large file contexts every turn.
| Stack | SWE-bench Verified | Cost/test |
|---|---|---|
| OpenCode + V4 Pro 0813 | 96.40% | $0.022 |
| OpenCode + V4 Flash 0731 | 88.80% | $0.010 |
| Claude Opus 5 (any client) | 97.00% | $1.29 |
OpenCode vs Official Harness
DeepSeek also ships its own agent runtime, DeepSeek Harness (dsh), where official benchmarks run in 'minimal mode'[7]. OpenCode is the lighter, drop-in alternative: no new runtime, just a config block, and it supports any OpenAI-compatible provider — not just DeepSeek.
Start with OpenCode for a zero-friction path to V4 Pro today, and evaluate dsh when its plugin ecosystem (now at 60+ community plugins) stabilizes past the developer-preview stage[7].
| Factor | OpenCode + V4 Pro | DeepSeek Harness + V4 Pro |
|---|---|---|
| Setup | Config block only | npx @deepseek-ai/dsh web[7] |
| Runtime | OpenCode (mature) | dsh v0.1 developer preview[7] |
| Benchmark context | Neutral harness, 96.40%[5] | Official minimal-mode, TB2.1 87.9[7] |
| Lock-in | None — any provider | Plugin architecture, any model[7] |
Harness facts from DeepSeek's official harness page and research notes[7].