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 Mira 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 Mira 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 Mira
- 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. Mira 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 Mira 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 Mira, 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 Mira runs it as one of its eleven agents.
Article · DeepSeek Harness (DSH) in Mira: on any desktop, next to your other agents → DeepSeek Harness in Mira.
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.
Article · Is Claude Code free? What it costs, and how to run it for free or for less → Is Claude Code free? Local models with Ollama and other cheap options.
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

Fixing OpenAI and Codex 403 “unsupported_country_region_territory”
Why OpenAI and Codex return 403 unsupported_country_region_territory, how to fix false positives on VPNs or cloud IPs, and compliant alternatives.

Running Claude Code and Codex on Amazon Bedrock, Vertex AI, and Microsoft Foundry
Connect Claude Code and Codex to Amazon Bedrock, Vertex AI, and Microsoft Foundry: env vars, config.toml, auth, model pinning, and limits.

Using Claude Code with Chrome and Codex Browser: live debugging, Playwright, and previews
How to connect Claude Code to Chrome (extension, console logs, login limits) and use Codex Browser or Playwright, plus live dev-server previews in Mira.