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

  1. Get an API keyCreate one at platform.deepseek.com/api_keys.
  2. 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-pro and deepseek-v4-flash.
  3. Pick it for an agentIn the Agents tab, click the model on the agent’s row and choose a DeepSeek model.
Terminal
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:

APIBase URL
OpenAI Chat Completions and Responseshttps://api.deepseek.com/v1
Anthropic Messageshttps://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.

Terminal
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

Thinking, effort and the prompt cache

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.