Docs · Provider
DeepSeek in Claude Code, Codex, Gemini CLI and OpenCode
DeepSeek serves an OpenAI-compatible API and an Anthropic-compatible one. Add your key to magpie once, and Claude Code, Codex, Gemini CLI, OpenCode and every other agent you connect can use DeepSeek’s models through magpie’s gateway at 127.0.0.1:3425.
Add DeepSeek
- Get an API keyCreate one at platform.deepseek.com/api_keys.
- Add the providerIn magpie’s Providers tab, press + Add provider, pick DeepSeek, paste the key and save. magpie asks DeepSeek which models it serves, such as
deepseek-v4-proanddeepseek-v4-flash. - Pick it for an agentIn the Agents tab, click the model on the agent’s row and choose a DeepSeek model.
magpie provider add deepseek sk-… magpie models # every model, as provider/model
Model ids in magpie are provider/model, so DeepSeek’s are deepseek/…. Adding the preset again adds a second DeepSeek provider for another key; to spread requests over several keys, add them all to the one provider instead.
Endpoints
DeepSeek has one plan, pay as you go, and magpie uses these endpoints for it:
| API | Base URL |
|---|---|
| OpenAI Chat Completions and Responses | https://api.deepseek.com/v1 |
| Anthropic Messages | https://api.deepseek.com/anthropic |
In each agent
Pick the model on an agent’s row in the Agents tab, or from a terminal. Each guide says what magpie writes in that agent’s config and how to switch back.
magpie claude deepseek/deepseek-v4-pro magpie codex deepseek/deepseek-v4-pro magpie gemini model deepseek/deepseek-v4-flash magpie opencode deepseek/deepseek-v4-pro
- Claude Code speaks Anthropic Messages, and so does DeepSeek’s Anthropic endpoint, so its requests are passed on as they are. Every tier (opus, sonnet, haiku) runs on the model you pick unless you give one its own. Models in Claude Code.
- Codex speaks only OpenAI Responses. DeepSeek serves the Responses API itself, so Codex’s requests are passed on as they are. The model shows in Codex’s
/modelwith its reasoning efforts. Models in Codex. - Gemini CLI speaks Gemini’s API. magpie points it at its gateway and translates. Models in Gemini CLI.
- OpenCode gets the model in
opencode.json, with its reasoning variants and cost. Models in OpenCode.
Thinking, effort and the prompt cache
- Thinking on tool turns. DeepSeek’s Anthropic endpoint wants a thinking block on every assistant turn that calls a tool, and on turns that only answer tool results. When an agent’s history has none, magpie adds one, and turns a Claude
redacted_thinkingblock into one. So a routing group can fall back from Claude to DeepSeek in the middle of a conversation. - Effort. DeepSeek thinks at three levels,
low,highandmax, set inoutput_config.effort, and ignoresbudget_tokens. A token budget an agent sends is fitted to one of the three. - Prompt cache. With several keys, magpie keeps a conversation on the same DeepSeek key for an hour after its last turn, so the next turn reads its prompt from DeepSeek’s cache instead of sending it uncached to another key.
- Images. magpie uploads each image an agent sends to DeepSeek’s API once and names it by its file id on later turns.
magpie provider set deepseek image-files=offsends images inline on every turn instead.
Balance and usage
The DeepSeek row shows your balance, read from DeepSeek: the total, what was granted and what you topped up. The Usage tab counts tokens, cache hits and cost for each agent and model that went through magpie.
FAQ
How do I use DeepSeek in Claude Code?
Add your DeepSeek API key in magpie (Providers, Add provider, DeepSeek), then pick a DeepSeek model such as deepseek-v4-pro on Claude Code’s row, or run magpie claude deepseek/deepseek-v4-pro. magpie writes Claude Code’s settings.json and passes its requests to DeepSeek’s Anthropic endpoint, https://api.deepseek.com/anthropic.
Can Codex use DeepSeek?
Yes. DeepSeek serves the OpenAI Responses API that Codex speaks, so magpie passes Codex’s requests on as they are. Pick the model on Codex’s row or run magpie codex deepseek/deepseek-v4-pro; it shows in Codex’s /model list.
Do I need to set ANTHROPIC_BASE_URL to DeepSeek myself?
No. magpie points Claude Code at its own gateway at 127.0.0.1:3425 and keeps your DeepSeek key itself. Picking one of Claude Code’s own models again puts back what you had.
Can I switch between Claude and DeepSeek in one conversation?
Yes. DeepSeek’s Anthropic endpoint wants a thinking block on tool-calling turns, and a conversation that started on Claude doesn’t have one it can read. magpie adds it, so a routing group can fall back from Claude to DeepSeek mid-conversation.
Which reasoning effort does DeepSeek take?
DeepSeek thinks at three levels, low, high and max, set in output_config.effort, and ignores budget_tokens. magpie fits the level or token budget an agent asks for to one of those three.
Can I use several DeepSeek keys?
Yes. Add them all to the DeepSeek provider and tick each one. magpie spreads requests over them, keeps a conversation on one key so its prompt cache is reused, and moves on when a key runs out of balance.
Every agent: Models in Claude Code, Models in Codex, Models in Gemini CLI, Models in OpenCode. Ask on Discord if you get stuck.