Use DeepSeek as the model provider for the OpenAI Codex CLI through a local proxy
Translate Responses API requests into Chat Completions for any provider that only offers the older API
Restore reasoning_content across tool-call turns that DeepSeek drops by default
Wire codex-deepseek into cc-switch so a Codex provider config points at the local port
Needs a DeepSeek API key, a .env file, and a cc-switch or manual ~/.codex/config.toml entry pointing at localhost:11435.
codex-deepseek is a small Python proxy that sits between OpenAI's Codex coding tool and a model provider that does not speak Codex's preferred API. Codex talks the OpenAI Responses API, but most providers, including DeepSeek, only offer the older Chat Completions API. This program listens locally on port 11435, accepts Responses-style requests from Codex, translates them on the fly into Chat Completions requests, forwards them to the upstream provider, and translates the streaming reply back into Responses-style events. It is a Python port of an earlier project called ccswitch-deepseek and uses only the Python standard library, no external dependencies. The README starts with quick setup. You copy .env.example to .env and fill in an API key and optional fields like base_url, model name, port, timeout in minutes, and flags for whether the model is a DeepSeek one and whether it accepts image input. Then you run ./start.sh, or uv run python -m src.main if you prefer uv. The proxy then sits at http://127.0.0.1:11435 waiting for traffic. The translation tables in the README explain exactly which fields and stream events are mapped. On the way in, Responses items like input_text, function_call, function_call_output, developer messages, instructions, tools, and reasoning controls all map to Chat Completions equivalents, while images, files, and audio are skipped with stats. On the way back, Chat Completions SSE deltas for content, reasoning, and tool calls are repackaged into the matching Responses SSE events such as response.output_text.delta and response.completed. Two extra behaviors are described: the proxy remembers the previous turn's reasoning_content so it can be restored on the next message when DeepSeek drops it during tool calls, and a small system message is prepended to every request that tells the model its real identity. The proxy is meant to be used alongside cc-switch, a cross-platform tool that manages AI CLI provider configs. The README walks through adding a Codex provider with base_url http://127.0.0.1:11435, wire_api responses, and requires_openai_auth true, then shows the resulting ~/.codex/config.toml. Codex needs a non-empty OPENAI_API_KEY in ~/.codex/auth.json for its own client-side check, but the real upstream auth comes from the proxy's .env file, so any placeholder works there. The code is a few small files under src: main.py for the HTTP server, log.py for colored logging, translate.py for input translation, sse.py for SSE event translation, and recover.py for the reasoning_content restore. There are 28 unit tests runnable via ./test.sh. License is MIT.
Generated 2026-05-22 · Model: sonnet-4-6 · Verify against the repo before relying on details.