Configure Codex with DeepSeek API: Complete Setup & Verification Guide
This guide details the step-by-step process to integrate DeepSeek models with OpenAI Codex CLI, covering client installation, configuration file setup, API key management, model catalog synchronization, and practical verification using small coding tasks before production use.
Reading font
Prepare Client and API Key
Install and launch Codex CLI or desktop client to generate ~/.codex directory. Official script version 1.5.0 requires client version 0.164 or higher. Back up config.toml and models.json. Create an API key on the DeepSeek platform, check balance and billing. Keep the key locally; do not commit to repositories.
Configure Using Official Fields
Copy the complete model catalog from DeepSeek's "Integrate with Codex" page into ~/.codex/models.json. Current model names are deepseek-flash and deepseek-v4-pro. In config.toml set top-level fields: model="deepseek-flash", model_provider="deepseek", model_catalog_json="~/.codex/models.json". Authentication follows the official API key example.
Under [model_providers.deepseek] specify name="deepseek", base_url="https://api.deepseek.com/", wire_api="responses", and place the local API key in the official designated field. DeepSeek also provides a one-click script; read its backup and rewrite instructions before running, do not execute remote scripts blindly.
Test with Small Tasks Before Production
Restart Codex and verify the startup message shows the selected DeepSeek model. In a small project, ask the model to explain a function, modify a low-risk piece of code, and run tests. Check the responses, tool calls, and file diffs. The presence of the model name does not guarantee compatibility with long-running tasks or all tools. On failure, systematically verify the API key, model catalog, interface URL, and client version.
To revert to the original provider, restore the backups and restart; old sessions may not appear due to different login methods. DeepSeek API bills independently and does not consume or increase the ChatGPT subscription's Codex quota . Only after the tool runs reliably should long-term use be considered.
For questions about attribution, corrections or content rights, please contactand we will review it promptly.
Published
AI-assisted summary