Use DeepSeek in Claude Code and Codex: the official setup, and a per-session switch
How DeepSeek's own guides connect Claude Code and Codex to DeepSeek models, and how Mirasim lets you pick DeepSeek per session without editing config.


The short answer
DeepSeek's API speaks both the OpenAI and the Anthropic formats, so Claude Code and Codex can run on DeepSeek models. For Claude Code you point a few environment variables at DeepSeek's Anthropic endpoint; for Codex, DeepSeek publishes a setup script that edits Codex's config.toml. Both change that tool everywhere you use it. In Mirasim you add your DeepSeek key once and pick a DeepSeek model per session, next to sessions still on Claude or GPT.
- Base URL (OpenAI format)
https://api.deepseek.com- Base URL (Anthropic format)
https://api.deepseek.com/anthropic- Models
deepseek-flash(served by DeepSeek V4.1 Flash) anddeepseek-v4-pro- Key
- An API key from the DeepSeek Platform
Claude Code with DeepSeek: the official way
DeepSeek's guide sets environment variables before you run claude, on macOS and Linux:
export ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropic
export ANTHROPIC_AUTH_TOKEN=<your DeepSeek API key>
export ANTHROPIC_MODEL=deepseek-flash[1m]
export ANTHROPIC_DEFAULT_HAIKU_MODEL=deepseek-flashOn Windows the same variables are set with $env: in PowerShell. DeepSeek's guide lists a few more (the default Opus and Sonnet models, the subagent model, effort level and compaction window). Claude model names sent to this endpoint are mapped: claude-opus… goes to deepseek-v4-pro, other claude… names go to deepseek-flash.
Codex with DeepSeek: the official way
Codex talks to models over the Responses API, which DeepSeek supports. DeepSeek publishes a setup script; launch Codex once first, then run it:
# macOS / Linux
bash <(curl -fsSL https://cdn.deepseek.com/api-docs/codex-deepseek-setup-en.sh)
# Windows PowerShell
irm https://cdn.deepseek.com/api-docs/codex-deepseek-setup-en.ps1 | iexThe script asks for your API key, backs up Codex's config.toml, adds a DeepSeek provider, and lets you choose deepseek-flash or deepseek-v4-pro; another menu option restores the default Codex setup. The change applies to the Codex CLI, the IDE extension and the ChatGPT desktop app, which share one configuration file.
Pick DeepSeek per session in Mirasim
- Add DeepSeek once
Settings › Models › DeepSeek, paste your API key
- Pick it in a session
Claude Code or Codex, under Your models in the model menu
- Keep the rest as is
Other sessions stay on Claude, GPT or anything else
- Model, agent and reasoning level are chosen per session, so a DeepSeek session can sit in the pane next to one on Claude.
- One provider entry is shared by every compatible agent. Mirasim translates between protocols, so Codex and Claude Code can both use the same DeepSeek key.
- No DeepSeek account? Built-in models include DeepSeek V4.1 Flash on Mirasim credit.
- Your own Claude Code and Codex setups in the terminal are left as they are.
Chapter 16 · Models, accounts and quota › Bring your own keys →
Questions
- Which DeepSeek model should I use for coding?
- DeepSeek's guides default to
deepseek-flashand offerdeepseek-v4-proas the larger option. See DeepSeek's Models & Pricing page for the difference. - Does Claude Code still use my Claude subscription?
- Not while it points at DeepSeek: requests go to DeepSeek and are billed to your DeepSeek key. In Mirasim, only the sessions you set to DeepSeek do this.
- What about DeepSeek's own coding agent?
- DeepSeek Harness (dsh) is DeepSeek's own open-source agent harness, and Mirasim runs it as one of its eleven agents.
Article · DeepSeek Harness (DSH) in Mirasim: on any desktop, next to your other agents → DeepSeek Harness in Mirasim.
Article · Use Kimi and GLM models in Claude Code and Codex → The same for Kimi and GLM: Moonshot's and Z.ai's own setups for Claude Code and Codex.
Sources
DeepSeek's setup was checked against api-docs.deepseek.com on November 9, 2026: Your First API Call, the Anthropic API guide, and the Claude Code and Codex agent integration guides. Check those pages for the latest model names and options.
Keep reading

Code review with Claude Code and Codex: /review, GitHub reviews and a second opinion
Code review with Claude Code and Codex: /review for local changes, automatic GitHub PR reviews, where review rules go, and a second opinion from the other agent.

Hooks in Claude Code and Codex: run your own commands when the agent acts
What hooks are in Claude Code and Codex, where they go, when they fire, and examples: a notification, formatting after edits, blocking edits to protected files.

Claude Code and Codex permission modes: auto, plan, --dangerously-skip-permissions and --yolo
What each Claude Code and Codex permission mode allows without asking, what --dangerously-skip-permissions and --yolo turn off, and safer ways to get fewer prompts.