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

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