
Summary
「What if I could use DeepSeek with Codex (OpenAI's AI coding assistant)?」
DeepSeek + Codex Complete Guide 2026: One-Click Setup to Use DeepSeek in Codex CLI, ChatGPT Desktop, and VS Code
「What if I could use DeepSeek with Codex (OpenAI's AI coding assistant)?」
In 2026, that dream became reality. The DeepSeek API natively supports Codex's Responses API, and with a one-click setup script, you can use DeepSeek models across Codex CLI, the ChatGPT desktop app, and the VS Code extension — all at once.
This article explains the DeepSeek official docs (api-docs.deepseek.com) in a beginner-friendly, visual way.
What you'll learn in this article
- The basics of DeepSeek × Codex integration (what it can do)
- Supported models (deepseek-v4-flash)
- One-click setup (recommended) steps
- Manual configuration (config.toml / models.json)
- How to use it in Codex CLI, ChatGPT desktop, and VS Code
- Session history caveats
Bottom line: what can you do?
You can swap the model in Codex (OpenAI's AI coding assistant) to DeepSeek.
- Codex CLI, ChatGPT desktop app, and VS Code extension share the same config file
- Configure once, and DeepSeek works in all three
- Currently supported: deepseek-v4-flash (deepseek-v4-pro expected in early August 2026)
- With an API key, no ChatGPT account is needed
Supported models
| Model | Codex support | Notes |
|---|---|---|
| deepseek-v4-flash | ✅ Supported | Fastest and lowest cost. Best for agentic coding |
| deepseek-v4-pro | 🔜 Expected early Aug 2026 | Highest-performance model |
Two setup options
| Method | Difficulty | Recommendation |
|---|---|---|
| Option 1: One-click setup script | ★☆☆ (easy) | ✅ Recommended |
| Option 2: Edit config files manually | ★★☆ (intermediate) | For fine-grained control |
Option 1: One-click setup (recommended)
Prerequisites
Install Codex CLI or the ChatGPT desktop app and launch it at least once (so the ~/.codex directory is created).
Steps
macOS / Linux (run in terminal):
bash <(curl -fsSL https://cdn.deepseek.com/api-docs/codex-deepseek-setup-en.sh)
Windows (run in PowerShell):
irm https://cdn.deepseek.com/api-docs/codex-deepseek-setup-en.ps1 | iex
After running
- Select the model you want from the menu
- On first run, enter your API key (starts with
sk-)- Get one at DeepSeek Platform
- Done!
What the script does automatically
| Step | Content |
|---|---|
| 1. Backup | Saves existing ~/.codex/config.toml to ~/.codex/backup-deepseek/ (restorable anytime) |
| 2. Model catalog | Writes DeepSeek model metadata to ~/.codex/models.json |
| 3. config.toml edit | Rewrites only necessary fields + adds [model_providers.deepseek]. Existing MCP servers etc. are all preserved |
| 4. Validate | Validates config.toml / models.json syntax. Aborts without changes on failure |
Setup flow diagram
Option 2: Manual config file editing
1. Create the model catalog
Create ~/.codex/models.json (declares DeepSeek model metadata, including both deepseek-v4-flash and deepseek-v4-pro):
{
"models": [
{
"slug": "deepseek-v4-flash",
"context_window": 1048576,
"max_context_window": 1048576,
"effective_context_window_percent": 95,
"display_name": "DeepSeek-V4-Flash",
"default_reasoning_level": "high",
"supported_reasoning_levels": [
{ "effort": "low", "description": "Fast responses with lighter reasoning" },
{ "effort": "high", "description": "Extra high reasoning depth for complex problems" },
{ "effort": "max", "description": "Maximum reasoning depth for the hardest problems" }
]
}
]
}
2. Edit config.toml
Add the following to ~/.codex/config.toml:
model = "deepseek-v4-flash"
model_provider = "deepseek"
model_catalog_json = "~/.codex/models.json"
[model_providers.deepseek]
name = "deepseek"
base_url = "https://api.deepseek.com/"
wire_api = "responses"
experimental_bearer_token = "<your DeepSeek API Key>"
config.toml field reference
| Field | Description |
|---|---|
| model | Default model to use |
| model_provider | Provider ID (must match [model_providers.<id>]) |
| model_catalog_json | Path to the custom model catalog (models.json) |
| base_url | DeepSeek API endpoint |
| wire_api | Protocol; "responses" = Responses API |
| experimental_bearer_token | Your API key (stored directly in the config file) |
Getting started
Once configured, DeepSeek works in all three clients.
Codex CLI
cd /path/to/my-project
codex
If the startup banner shows model: deepseek-v4-flash, the configuration is active!
ChatGPT desktop app
- Mac: the model picker shows Custom (the DeepSeek model you selected is actually in use)
- Windows: shows Custom or DeepSeek-V4-Flash
Codex IDE extension (VS Code)
Shares the same config as Codex CLI. Just install the extension and start using it.
Session history caveat
If previous sessions seem missing after switching providers, nothing is deleted.
- Codex stores session history in separate groups by login method
- Official ChatGPT subscription sessions and third-party API (DeepSeek) sessions are kept apart
- Only the group matching the current config is shown
- Restoring the previous config brings earlier sessions back
- Restart the ChatGPT client after switching for the change to take effect
Summary
DeepSeek × Codex integration lets you do cutting-edge agentic coding at low cost without relying on expensive ChatGPT subscriptions.
- One-click script sets everything up (with backup and validation)
- Works in Codex CLI / ChatGPT desktop / VS Code extension
- Supported model: deepseek-v4-flash (pro coming early August)
- Session history is safely kept separate
Run the one-click script and try DeepSeek models in Codex today.
👉 Official docs: DeepSeek API Docs — Integrate with Codex 👉 Get an API key: DeepSeek Platform
Related articles
この記事をシェアする
Related articles

2026年7月19日
Agentic Engineering 2026: Coined by Karpathy — How Google Agents CLI Is Transforming Production Development

2026年7月19日
12 Free AI Agent Courses Recommended for 2026: Learn from the World's Top Instructors

2026年8月8日
Claude Code Cross-Session Messaging Complete Guide 2026: Sessions Can Now Send Messages to Each Other

2026年8月8日
Control Your iPhone with Claude Code in 2026: Complete phone-harness Guide (with Setup Steps)

2026年8月9日
Herdr Complete Guide 2026: The New Standard Runtime Where Any Agents Can Talk to Each Other

2026年8月9日
Hermes HUD Mode Complete Guide 2026: The Overlay AI Agent That Sees, Understands, and Controls Your Screen