2026

How to Use DeepSeek V4 Flash with Codex (One-Command Setup)

· 2 min read · YayaAgent Team

Verified against Codex CLI 0.146.0 and DeepSeek V4 Flash (stable release, July 31, 2026). Config field names and version requirements change fast — check your own codex --version before following this guide.

Until this week, Codex couldn't talk to DeepSeek directly. Codex runs on OpenAI's Responses API — the protocol that supports Agent-style multi-turn tool calls — and DeepSeek only exposed a Chat Completions endpoint. Anyone who wanted DeepSeek inside Codex needed a local proxy to translate between the two.

That gap just closed. DeepSeek V4 Flash's stable release natively supports the Responses API, so Codex can now call it directly — no proxy, no protocol downgrade. If you're already running Codex CLI and want a much cheaper model for routine agent tasks, this is a same-day setup.

Option 1: The official one-line script

Check your Codex version first — DeepSeek's model catalog requires Codex CLI 0.144.0 or later:

codex --version
codex update

macOS / Linux:

bash <(curl -fsSL https://cdn.deepseek.com/api-docs/codex-deepseek-setup.sh)

Windows (PowerShell):

irm https://cdn.deepseek.com/api-docs/codex-deepseek-setup-en.ps1 | iex

The script asks for your DeepSeek API key, writes it into your config, and backs up your existing settings to ~/.codex/backup-deepseek/ before touching anything. Once it finishes, run codex and DeepSeek-V4-Flash should show up in your model list.

Option 2: Manual config (if you run multiple providers)

The one-line script edits your main config.toml directly, which can be disruptive if you already have several providers configured. A cleaner approach is a separate profile file so your existing setup stays untouched.

Create ~/.codex/deepseek.config.toml:

model = "deepseek-v4-flash"
model_provider = "deepseek"
forced_login_method = "api"
model_reasoning_effort = "high"

[model_providers.deepseek]
name = "DeepSeek"
base_url = "https://api.deepseek.com/"
wire_api = "responses"

Then launch Codex with that profile instead of your default one, switching providers per session without overwriting anything.

The pitfall almost everyone hits

DeepSeek's official setup forces API-key login. If Codex is currently signed in with your ChatGPT account, switching to the DeepSeek profile can log you out of that session — you'll see something like "API key login is required, but ChatGPT is currently being used." Keeping DeepSeek in its own separate config file (Option 2) avoids this entirely; the one-click script (Option 1) does not.

Is it actually cheaper?

DeepSeek V4 Flash is priced at roughly ¥1 per million input tokens and ¥2 per million output tokens, with cache hits down at ¥0.02 per million — and Agent workflows lean heavily on cached context across tool-call turns, so the effective cost per session tends to land well below the sticker price. If you're running Codex for routine, high-volume agent tasks, this is one of the cheapest options in the current lineup — worth testing against whatever model you're on now, especially if you've hit API key or auth errors while juggling providers before.

For a broader look at how Codex stacks up against Claude Code and Cursor as a daily driver, see our 2026 desktop agent comparison.

This one-command directness is currently a DeepSeek perk, not a general rule — Claude and Gemini don't speak Codex's native protocol yet, so connecting them still means routing through a compatibility gateway rather than a direct config swap.


Further Reading