Codex CLI on uncensored DeepSeek V4.1 Flash
Codex CLI speaks only the OpenAI Responses API. MagmaRouter serves that format at /v1/responses, so Codex can drive DeepSeek V4.1 Flash Xploded with a provider entry and no shim.
The provider block
Add this to ~/.codex/config.toml:
model = "deepseek-v4.1-flash-xploded" model_provider = "magmarouter" [model_providers.magmarouter] name = "MagmaRouter" base_url = "https://api.magmarouter.com/v1" env_key = "MAGMAROUTER_API_KEY" wire_api = "responses"
Then export the key and start Codex:
export MAGMAROUTER_API_KEY=sk-mr-...
codex
The base URL keeps /v1 because the Responses client appends only /responses. The same block with codex exec runs it headless.
Why this model works in Codex
Codex edits files and runs commands only through function calls, so a model that cannot make one cannot do anything. DeepSeek V4.1 Flash Xploded returned a correct tool call before it went on sale, reasons before it acts, and can write up to 393,216 tokens in one reply, the longest on the line. Its 1,048,576-token context holds a large repository's worth of files across a long session.
What is translated, and what is not
A Responses request becomes a chat-completions body on the way out and the answer becomes a Response object on the way back, with the real event sequence when streaming. Input items, instructions, function tools and tool results all map across.
- previous_response_id is refused with a clear error. Codex sends the full input every turn, so it does not need it.
- OpenAI's hosted tools (web_search, file_search, computer_use) run inside OpenAI's own stack, so they are not available. Function tools you define work normally.
- The model is text only, so it cannot read a screenshot pasted into Codex. GLM 5.3 Flash Xploded reads images on the same key.
The general setup, for any model on the line, is in the Codex CLI quickstart.
FAQ
Can Codex CLI use a non-OpenAI model?
Yes, through a model provider entry in config.toml that points at any endpoint serving the Responses API. MagmaRouter serves it at https://api.magmarouter.com/v1/responses.
What wire_api should I set?
responses. Codex speaks the Responses API, and MagmaRouter translates it for the model.
Does it need a separate key?
No. The same MagmaRouter key works for the OpenAI, Anthropic and Responses formats.