Skip to content

Instantly share code, notes, and snippets.

@antenore
Last active July 22, 2026 06:39
Show Gist options
  • Select an option

  • Save antenore/c529e055e45559579b08b4961b517f8c to your computer and use it in GitHub Desktop.

Select an option

Save antenore/c529e055e45559579b08b4961b517f8c to your computer and use it in GitHub Desktop.
Configure OpenAI Codex CLI to use DeepSeek models

Configure OpenAI Codex CLI with DeepSeek Models

Disclaimer (May 2026). Sorry for the long radio silence on the comments, busy stretch on my side. I no longer use this setup and stopped tracking it actively. I'm refreshing the page out of thoroughness because comments kept coming in and people deserve an honest snapshot. If you find better workarounds, post them in the comments and I'll link them, but I won't be maintaining this further.

Status

Codex deprecated wire_api = "chat" in favour of OpenAI's Responses API. DeepSeek only speaks Chat Completions, so the direct integration documented below is no longer reliable. Symptoms reported by users:

  • An assistant message with 'tool_calls' must be followed by tool messages... (insufficient tool messages following tool_calls)
  • Missing 'reasoning_content' field in the assistant message at message index N
  • Deprecation warning for the chat wire API

If you want Codex + DeepSeek today, you need a translation layer (see Workarounds). If you just want to use DeepSeek for coding, there are now better paths (see Alternatives).

Workarounds (community-tested, not by me)

I haven't validated any of these personally. Credits in parentheses point to the comment thread below.

  • OpenRouter with BYOK. Point Codex at OpenRouter and bring your DeepSeek key. Routes through OpenRouter's Responses implementation while billing your DeepSeek credits. Free under 1M requests/month at the time of writing. (via @CrushedAsian255)
  • codeproxy-ai/cli. Local proxy specifically built to make DeepSeek usable inside Codex: https://github.com/codeproxy-ai/cli (via @mushan0x0)
  • LiteLLM. Translates between OpenAI format and arbitrary backends. Run it locally and point Codex at http://localhost:4000: https://github.com/BerriAI/litellm (via @LMCom)
  • dyrnq/ai-adapter. Notes and tests for Codex + DeepSeek V4 Pro: dyrnq/ai-adapter#3 (via @dyrnq)

Original configuration (kept for reference, no longer working as-is)

~/.codex/config.toml

model = "gpt-5.1-codex"

[model_providers.deepseek]
name = "DeepSeek"
base_url = "https://api.deepseek.com/v1"
env_key = "DEEPSEEK_API_KEY"
wire_api = "chat"

[model_providers.deepseek-reasoner]
name = "DeepSeek Reasoner"
base_url = "https://api.deepseek.com/v1"
env_key = "DEEPSEEK_API_KEY"
wire_api = "chat"

[profiles.deepseek]
model = "deepseek-chat"
model_provider = "deepseek"

[profiles.deepseek-r1]
model = "deepseek-reasoner"
model_provider = "deepseek-reasoner"

Usage (when it worked)

codex                       # default, OpenAI
codex --profile deepseek    # DeepSeek Chat
codex -p deepseek-r1        # DeepSeek Reasoner

Setup

export DEEPSEEK_API_KEY="your-deepseek-api-key"

Add the same line to ~/.bashrc or ~/.zshrc. Place the TOML above at ~/.codex/config.toml.

Alternatives

If the goal is "use DeepSeek for coding", these need no proxy.

  • Claude Code. Native DeepSeek V4 support (reported by @emergencescience).
  • Aider. Native DeepSeek support.
  • Continue. Native DeepSeek support.
  • deepseek-code. Open-source Python CLI built directly on the DeepSeek API, agent-loop with file/shell/search tools and a permission system. I contributed multiline input upstream and tested it; I'm not running it day-to-day anymore, but last time I used it the basics worked.
  • DeepSeek API directly. If you don't need a CLI wrapper.

References

@antenore

Copy link
Copy Markdown
Author

@CrushedAsian255 sorry for the late reply, busy stretch on my side.

Thanks for the OpenRouter BYOK tip, that's a clean route since the Responses translation happens on their side and DeepSeek credits stay yours. I've linked it in the updated gist under Workarounds. I won't be maintaining this setup myself, but this is the kind of pointer the next reader needs.

@antenore

Copy link
Copy Markdown
Author

@mushan0x0 sorry for the late reply, busy stretch on my side.

Nice work, a local proxy is the right shape for this problem. I've added codeproxy-ai/cli to the Workarounds list in the gist. I'm no longer maintaining the original setup, so having a dedicated tool linked is more useful than my outdated config.

@antenore

Copy link
Copy Markdown
Author

@prakharprasad agreed, credit to @mushan0x0. Sorry for chiming in this late.

@antenore

Copy link
Copy Markdown
Author

@dyrnq sorry for the late reply, busy stretch on my side.

Thanks for sharing the codex + deepseek-v4-pro notes, that's exactly what readers landing here in 2026 need. I've linked ai-adapter under Workarounds in the gist.

@antenore

Copy link
Copy Markdown
Author

@LMCom sorry for the late reply, busy stretch on my side.

Yes, LiteLLM fits exactly here. Point Codex at the local LiteLLM endpoint and let it translate to DeepSeek. I've added it to the Workarounds section in the gist. I'm not running this setup myself anymore, but for anyone still on the path it's probably the most general-purpose option.

@antenore

antenore commented May 28, 2026

Copy link
Copy Markdown
Author

@emergencescience sorry for the late reply, busy stretch on my side.

I'm not tracking Codex + DeepSeek anymore, so I can't tell you when (or if) OpenAI will follow up on V4. Honest take: I'd switch. Claude Code already supports DeepSeek V4 natively, and even on the Codex side the only paths that work now are proxies: OpenRouter BYOK, codeproxy-ai/cli, LiteLLM, ai-adapter. All linked in the refreshed gist. Thanks for flagging the Claude Code support, I've added a note about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment