OpenCode + DeepSeek: setup, models and where your code goes
13 min read
Use DeepSeek in OpenCode: connect the built-in provider, pick the right model ID, check which model answered, where prompts are stored and the open-weight path.
OpenCode has a built-in DeepSeek provider. Run /connect, choose DeepSeek, paste a DeepSeek API key, then pick a DeepSeek model with /models. There is no provider block to write and no base URL to set.
As of 15 November 2026 DeepSeek's API serves two models, deepseek-flash (DeepSeek-V4.1-Flash-1017) and deepseek-v4-pro, and OpenCode reaches them at https://api.deepseek.com. The API is run by Hangzhou DeepSeek Artificial Intelligence Co., Ltd., and its privacy policy says data is stored in the People's Republic of China. This guide gives the setup from the OpenCode and DeepSeek docs, the model IDs, how to check which model answered, what DeepSeek's terms say about your prompts, the open-weight path on your own hardware, and the same setup for a team.
What you need
Value on 15 November 2026 | |
|---|---|
OpenCode | DeepSeek recommends v1.18.30 or later. OpenCode 2 is the current version in OpenCode's docs |
DeepSeek account | An API key from platform.deepseek.com and a prepaid balance |
Provider ID in OpenCode |
|
Endpoint |
|
Model IDs |
|
Context and output | 1M tokens of context, up to 384K tokens of output, both models |
| Input $0.30, cached input $0.006, output $1.20 at peak. Half that off-peak |
| Input $1.32, cached input $0.044, output $3.96 at peak. Half that off-peak |
Concurrency per account | 2,500 requests for |
Peak hours are 01:00 to 04:00 and 06:00 to 10:00 UTC, Monday to Friday, excluding Chinese public holidays.
Step 1: install or update OpenCode
OpenCode 2, from the current docs:
curl -fsSL https://opencode.ai/v2/install | bash
OpenCode 1, from the previous docs:
curl -fsSL https://opencode.ai/install | bash
Both versions use the opencode command and cannot be installed side by side under that name. OpenCode 2 reads existing configuration from the same locations as OpenCode 1. DeepSeek's guide asks for v1.18.30 or later "to avoid compatibility issues", so update before you connect.
Step 2: create a DeepSeek API key
Sign in to the DeepSeek Platform, create an API key and add balance. The service is prepaid: usage is deducted from the balance, and DeepSeek can suspend service when it runs out.
Step 3: connect the DeepSeek provider
Start OpenCode in your project:
opencode
Then, in the input box:
/connect
Type deepseek, select the provider and paste the API key. These are the four steps DeepSeek publishes:
Execute the
opencodecommand.Type
/connectin the input box, then enterdeepseekand select the provider.Enter your DeepSeek API key.
Select the model.
In OpenCode 1, keys added with /connect are stored in ~/.local/share/opencode/auth.json. The catalogue also names DEEPSEEK_API_KEY as the environment variable that can supply the credential, which suits CI and containers.
Step 4: pick the model
/models
Choose the DeepSeek model. The names you may see, and what they mean today:
Model ID | Listed as | What serves it |
|---|---|---|
| DeepSeek V4.1 Flash 1017 | DeepSeek-V4.1-Flash-1017. Text and images. The one to use |
| DeepSeek V4 Pro | DeepSeek-V4-Pro-0813. Text only |
| DeepSeek V4 Flash | Legacy name. The model is retired; requests are served by V4.1 Flash and billed at the Flash price |
| DeepSeek V4 Flash Vision Exp | Legacy name, served by V4.1 Flash |
DeepSeek's OpenCode guide still says "Select the DeepSeek-V4-Flash model". DeepSeek's pricing page says to use deepseek-flash as the model name. Both reach the same model today. The older names deepseek-chat and deepseek-reasoner were due to be discontinued on 24 July 2026; replace them if an old config still has them.
The /models selector only shows models whose provider is available in the current project. If DeepSeek is missing, connect it in this project first.
Step 5: make DeepSeek the default
A selection in /models applies to the current session. To make it the default for new work, set model in opencode.json or opencode.jsonc, in the project or in ~/.config/opencode/:
{ "$schema": "https://opencode.ai/config.json", "model": "deepseek/deepseek-flash"}
For one command-line run without changing the default:
opencode run --model deepseek/deepseek-flash "Refactor parseToken"
DeepSeek's models think by default and accept three effort levels: low, high and max. OpenCode exposes model options like these as variants, and the variant names come from the catalogue entry for the model. Check the names offered for the model you selected before you put one in a script. An unknown variant name stops with a model-resolution error.
Step 6: check which model answered
Call the API with the same key. This is DeepSeek's own example, shortened:
curl https://api.deepseek.com/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer ${DEEPSEEK_API_KEY}" \ -d '{ "model": "deepseek-flash", "messages": [ {"role": "user", "content": "Hello!"} ], "stream": false }'
The response carries a model field and a usage block. A reply naming deepseek-flash means the key, the endpoint and the model ID are right. In OpenCode, open /models and confirm the selected entry is the DeepSeek one. Credentials from another project do not carry over automatically, so a session in a different folder can be on a different provider.
What works and what does not on DeepSeek
Works: chat, reading and editing files, running commands and the agent loop. DeepSeek lists tool calls and JSON output for both models, and caches repeated request prefixes automatically, so long sessions are billed partly at the cached-input price.
Works differently, or needs care:
Images depend on the model.
deepseek-flashaccepts images.deepseek-v4-prodoes not support vision.Output limits are soft in thinking mode. DeepSeek says that for some main-agent requests from OpenCode in thinking mode it raises the effective
max_tokensabove the requested value.Peak pricing doubles the bill. The off-peak rate is half the peak rate. Batch work costs less outside the two weekday windows.
Rate limits are per account. Every key on the account shares one concurrency limit. Above it DeepSeek returns HTTP 429.
Slow starts. DeepSeek holds the connection open with keep-alive lines while a request waits, and closes it if inference has not started after 10 minutes. OpenCode 2 waits up to five minutes for response headers and retries a timed-out request up to three times. Raise
settings.headerTimeouton the provider if you hit that.Old versions. DeepSeek asks for OpenCode v1.18.30 or later.
OpenCode's own tools are separate. Web tools, plugins and MCP servers in OpenCode have their own settings and their own data flows.
Where DeepSeek hosts the API and what it does with prompts
These are the statements in DeepSeek's own documents, read on 15 November 2026.
Question | What DeepSeek's documents say |
|---|---|
Who operates the API | Hangzhou DeepSeek Artificial Intelligence Co., Ltd., "with its registered address in China" |
Where data is stored | "We directly collect, process and store your Personal Data in People's Republic of China" |
What is collected | Prompts, uploaded files and chat history ("Inputs"), account data, device and network data, logs |
Use for training | The privacy policy lists "to train and improve our technology, such as our machine learning models and algorithms" as a purpose, and lists a right to opt out of that use |
How long it is kept | "For as long as necessary to provide our Services". Account, input and payment data are kept "for as long as you have an account" |
Disclosure to authorities | DeepSeek may share data to "comply with applicable law, legal process or government requests" |
Governing law for the API | "The laws of the People's Republic of China in the mainland", with disputes heard where Hangzhou DeepSeek is registered |
UK and EU representative | Prighter Group |
Three points are not stated in the pages we read. The Open Platform Terms of Service (effective 29 April 2026) do not give a retention period for API inputs, do not say whether API inputs are excluded from training, and do not offer a zero-retention option. The privacy policy (last updated 10 February 2026) says it does not cover the end users of applications built on the open platform. If your organisation needs these points in writing, ask DeepSeek before you send source code.
Our guide to whether DeepSeek is safe for work covers the app and the wider policy question.
The alternative: DeepSeek's open weights on your own hardware
DeepSeek publishes its model weights on Hugging Face under the MIT licence. Running them yourself means the DeepSeek API is not involved and the terms above do not apply to your prompts. The sizes below were read on 15 November 2026.
Model | Where | Size on disk | Notes |
|---|---|---|---|
DeepSeek-V4.1-Flash-1017 | Hugging Face, | 510 GB of weights | The model behind |
DeepSeek-V4-Flash-0731 | Hugging Face, | 167 GB of weights | Previous Flash generation. MIT |
DeepSeek-V4-Pro-0813 | Hugging Face, | 893 GB of weights | The model card's example serves it with vLLM on one node with four NVIDIA GB300 GPUs |
DeepSeek-V4.1-Flash-1017 GGUF | Hugging Face, | 250 GB to 501 GB by quantisation | Not a DeepSeek release |
| Ollama library | 9.0 GB, 128K context | Tagged tools and thinking |
| Ollama library | 20 GB, 128K context | Tagged tools and thinking |
| Ollama library | 43 GB, 128K context | Tagged tools and thinking |
The whole set of weights has to be loaded, so plan for memory above the size on disk. The current Flash and Pro models need several data-centre GPUs. The DeepSeek-R1 distills fit a workstation, but they are 2025 reasoning models and are not the model the API serves today.
OpenCode 2 finds local runtimes without an account:
Ollama. Start Ollama and pull a model. OpenCode probes
http://127.0.0.1:11434, discovers completion models and adds them to/models.ollama serveollama pull deepseek-r1:32bvLLM. OpenCode checks
http://127.0.0.1:8000/v1. Its discovery cannot infer tool support, so discovered vLLM models start with tools disabled. For a coding agent, define the model explicitly in a provider block so tools are on.
deepseek-v4.1-flash:cloud and deepseek-v4-pro:cloud in the Ollama library run on Ollama's servers and have no downloadable tag. The Ollama setup is in our guide to OpenCode with Ollama.
The same models for a team with Aventail™ Connect
The steps above suit one developer. Each person holds their own DeepSeek key, picks their own model, and nothing records which machine sent which request where.
Aventail™ Connect configures OpenCode to send its model requests through Aventail™ Link, the inference engine and gateway that runs on each machine. Routing rules are set in Aventail™ Control and evaluated on the device. For the open-weight path, the docs support this much:
Serve the model in Link. Link runs GGUF language models. Choose one from the Aventail™ Library, or upload a custom GGUF in Control and test it on one device first.
Use a server for large models. A model too big for laptops can sit on one internal machine running Link, named in a rule as a network peer. The peer must offer the exact model and have Serve other devices enabled. Peer routing is in beta.
Connect OpenCode. In Link, open Connected apps and choose Connect next to OpenCode. Do not add an Aventail™ provider inside OpenCode; the model is chosen in Link. OpenCode 2 picks up the change while running. OpenCode 1 needs a restart.
Write the rule. Permit only On device, or only the peer. If that destination is unavailable, the request fails with an error and is not sent elsewhere.
Check the record. Send a harmless prompt and confirm the destination in Control.
Aventail™'s controls apply to requests routed through Link. A provider that a developer connects in OpenCode by hand is outside them, so review earlier manual providers. OpenCode's own docs point to managed configuration and policies for restricting which providers users can add.
Free covers three connected devices. Starter is £50 a month excluding VAT with ten devices included. Routing policies need Control for Enterprise.
Which path to take
DeepSeek API by hand | DeepSeek weights on your own server | Open weights with Aventail™ Connect | |
|---|---|---|---|
Who it suits | One developer, non-sensitive code | A team with GPU capacity and someone to run it | A team whose code must stay on approved machines |
Setup |
| Ollama or vLLM, then a provider per developer | Connect button in Link, rules in Control |
Where prompts are processed | DeepSeek's servers in China | Your hardware | Where the routing rule says, evaluated on the device |
Terms that cover your prompts | DeepSeek's, under PRC law | Your own | Your own |
Record of requests | None on your side | Whatever your server logs | Requests view in Control |
If the endpoint is down | Requests fail | Requests fail | Fails closed, or falls back to an approved destination |
Cost | From $0.15 per 1M input tokens off-peak | Hardware and power | Free for three devices; £50 a month for ten |
Frequently asked questions
How do I add DeepSeek to OpenCode?
Run /connect, type deepseek, select the provider and paste your API key. Then run /models and choose a DeepSeek model. No config file is needed.
Which DeepSeek model is best for OpenCode?deepseek-flash is the model DeepSeek tells developers to use. It is DeepSeek-V4.1-Flash-1017, takes text and images, and has a 1M context window. deepseek-v4-pro costs about four times as much for input and is text only.
Why does DeepSeek not show up in /models? The selector only lists models whose provider is available in the current project. Run /connect in that project, or set DEEPSEEK_API_KEY in the environment OpenCode runs in.
Is DeepSeek free in OpenCode?
No. OpenCode is free and open source, and DeepSeek bills each request to your prepaid balance: $0.30 per 1M input tokens and $1.20 per 1M output tokens for deepseek-flash at peak, half that off-peak.
Does OpenCode send my code to DeepSeek?
Yes, when a DeepSeek model is selected. Model requests go to api.deepseek.com, and DeepSeek's privacy policy says it collects, processes and stores data in the People's Republic of China.
Can I use DeepSeek models in OpenCode without the DeepSeek API?
Yes. Serve DeepSeek's open weights with Ollama or vLLM and select the local model in OpenCode. The DeepSeek-R1 distills run on a workstation from 9 GB. The current Flash model is 510 GB and needs server GPUs.
Do I need to set a base URL for DeepSeek in OpenCode?
No. The built-in provider already points at https://api.deepseek.com. A base URL is only needed for a proxy or a self-hosted endpoint.
Related guides
Sources
DeepSeek, Integrate with OpenCode: https://api-docs.deepseek.com/quick_start/agent_integrations/opencode
DeepSeek, Your First API Call: https://api-docs.deepseek.com/
DeepSeek, Models and Pricing: https://api-docs.deepseek.com/quick_start/pricing
DeepSeek, Rate Limit and Isolation: https://api-docs.deepseek.com/quick_start/rate_limit
DeepSeek, Using the Anthropic API (note on OpenCode and
max_tokens): https://api-docs.deepseek.com/guides/anthropic_apiDeepSeek, Context Caching: https://api-docs.deepseek.com/guides/kv_cache
DeepSeek, Change Log: https://api-docs.deepseek.com/updates
DeepSeek Privacy Policy (last updated 10 February 2026): https://cdn.deepseek.com/policies/en-US/deepseek-privacy-policy.html
DeepSeek Open Platform Terms of Service (effective 29 April 2026): https://cdn.deepseek.com/policies/en-US/deepseek-open-platform-terms-of-service.html
OpenCode, Intro (install): https://opencode.ai/docs/
OpenCode, Providers: https://opencode.ai/docs/providers
OpenCode, Models: https://opencode.ai/docs/models
OpenCode, Config: https://opencode.ai/docs/config
OpenCode, Migrate from V1: https://opencode.ai/docs/migrate-v1/
OpenCode 1 docs, Providers (DeepSeek, credentials): https://opencode.ai/v1/docs/providers/
models.dev catalogue, DeepSeek provider entry: https://models.dev/api.json
Hugging Face, deepseek-ai: DeepSeek-V4.1-Flash-1017, DeepSeek-V4-Flash-0731, DeepSeek-V4-Pro-0813: https://huggingface.co/deepseek-ai
Hugging Face, unsloth/DeepSeek-V4.1-Flash-1017-GGUF: https://huggingface.co/unsloth/DeepSeek-V4.1-Flash-1017-GGUF
Ollama library: deepseek-r1, deepseek-v4.1-flash, deepseek-v4-pro: https://ollama.com/search?q=deepseek
Aventail™, Connect overview: https://docs.aventail.co.uk/docs/connect/overview
Aventail™, Routing: https://docs.aventail.co.uk/docs/fleet/routing
Aventail™, Compatibility and versions: https://docs.aventail.co.uk/docs/introduction/versions-and-supported-models
Aventail™, Manage models: https://docs.aventail.co.uk/docs/guides/models
Aventail™, Pricing: https://aventail.co.uk/#pricing
All sources were read on 15 November 2026. DeepSeek serves its privacy policy by region, and our connection was redirected to the Korean edition (updated 6 May 2026). The global English edition quoted here was read through a web reader from the same URL.