Two AI coding agents. Two different companies. Same underlying insight: the model is swappable.
Claude Code made waves when developers discovered you could point it at DeepSeek V4 with three environment variables and cut session costs by 10–20×. OpenAI Codex — OpenAI's own desktop coding agent — turns out to support the same trick. But there's a technical wrinkle that trips up most people who try it: a protocol fork between two OpenAI API endpoints that DeepSeek only partially implements.
Understanding that fork is the actual lesson here. It's not just about Codex — it tells you something about where the OpenAI-compatible ecosystem is fractured, and what to check before wiring any agent to a third-party backend.
What Codex Actually Is

OpenAI Codex is a desktop coding agent, not a chat interface. Like Claude Code, it has file system access: it reads your project files, writes edits, runs commands, and loops on errors. You describe a task; it works through the codebase to complete it.
This makes it fundamentally different from GitHub Copilot (inline suggestions) or ChatGPT (stateless Q&A). It's an agent with persistent context across a session — and that agent loop is what makes the model-swapping trick viable. The agent doesn't care what's generating the tokens, as long as the API speaks a language it understands.
The model-agnostic design is intentional. Codex connects to OpenAI's API by default, but the connection parameters are configurable. Point it at any OpenAI-compatible endpoint, provide an API key, and it will use that backend instead.
The Protocol Fork: Chat Completions vs Responses

OpenAI operates two distinct API endpoints for language model inference:
Chat Completions (/v1/chat/completions) is the original, stateless endpoint. You send a messages array, you get a completion back. Every major OpenAI-compatible provider — DeepSeek, Qwen, Together AI, Groq — implements this endpoint. It's the de facto standard for the third-party ecosystem.
Responses API (/v1/responses) is a newer, stateful endpoint introduced by OpenAI. It maintains conversation state server-side, supports richer tool call patterns, and is the direction OpenAI is pushing for agent workflows. But it's proprietary infrastructure — no third-party provider implements it yet.
Codex supports both. When you configure an alternative backend, you have to tell it explicitly which endpoint to use. The default in some configurations is Responses. If you leave it there and point Codex at DeepSeek, it will try to call /v1/responses — which DeepSeek doesn't implement — and the connection fails silently or returns errors.
The fix is one configuration choice: set the protocol to Chat Completions. That single setting determines whether the integration works at all.
Setting Up DeepSeek as the Backend

The configuration itself is straightforward once you understand the protocol requirement.
You need three things: the Codex desktop app, a DeepSeek API key from the developer console, and a proxy layer that handles the connection between Codex and DeepSeek's endpoint.
The proxy layer exists because Codex, when configured for third-party backends, doesn't directly accept arbitrary base URLs in all versions — it expects a local service that translates its requests to the target API. Tools like CCX (a lightweight local proxy) handle this translation. You run CCX locally pointing at https://api.deepseek.com, then point Codex at http://localhost:{port}.
The critical configuration step: when setting the protocol in your proxy or Codex settings, select Chat Completions, not Responses. This is the single most common failure point. Everything else — the API key format, the base URL structure, the model name (deepseek-chat for V4) — follows standard OpenAI-compatible conventions.
DeepSeek V4 pricing at ~$0.27/M input tokens and ~$1.10/M output tokens makes the cost math comparable to what works for Claude Code: complex multi-file sessions that might cost $5–15 with native OpenAI pricing come in at $0.30–1.50.
What Works, What Doesn't

With the Chat Completions endpoint and DeepSeek V4 as the backend, Codex handles its core coding workflows well:
- Code generation and editing: Write functions, refactor files, fix bugs across a project
- Documentation: Generate docstrings, README sections, inline comments
- Data analysis scripts: Python pandas/numpy tasks, SQL query generation
- Web development: HTML/CSS/JS scaffolding, component generation
Two capabilities drop out when you move away from the native OpenAI backend:
Image generation is unavailable. DeepSeek is a text/code model; it doesn't implement OpenAI's image generation endpoints. Any Codex workflow that produces images (generating diagrams, UI mockups from screenshots) won't work.
Computer use / screen control is also unavailable. OpenAI's computer use features depend on their proprietary vision + action API, which is outside the Chat Completions standard entirely. If you're using Codex for browser automation or GUI interactions, you need to stay on native OpenAI.
For pure coding tasks — which is most of what developers actually use Codex for — neither limitation matters.
What It Means for Developers
The Claude Code + DeepSeek V4 setup and the Codex + DeepSeek V4 setup are converging on the same pattern: the agent layer is becoming model-agnostic, and the cost arbitrage from Chinese frontier models is accessible regardless of which agent you prefer.
But the Codex case surfaces something worth keeping in mind when evaluating any "OpenAI-compatible" claim: the ecosystem has already forked. Chat Completions is the common substrate. The Responses API, computer use, image generation, and assistants-with-state are proprietary extensions that no third party implements yet.
Before wiring any agent to a non-OpenAI backend, the first question to ask is: which endpoint does this agent actually call? The answer determines whether the integration is one config change away or fundamentally blocked.
Bottom Line
OpenAI Codex joins Claude Code as a coding agent that works well on DeepSeek V4. The setup requires a local proxy and one non-obvious protocol setting — Chat Completions, not Responses — but once that's right, the cost profile drops dramatically and the core coding workflows are unaffected.
The broader lesson: as the agent ecosystem matures, the model underneath increasingly doesn't matter for most tasks. What matters is knowing which parts of the OpenAI API surface your tool actually uses.
Resources
- OpenAI Codex — official product page
- DeepSeek Platform — API access and pricing
- DeepSeek API Docs — Chat Completions endpoint reference
- Claude Code Docs — comparison: Claude Code + DeepSeek setup
DeepSeek V4 is available via API at platform.deepseek.com. OpenAI Codex is available at openai.com/codex.