DeepSeek V4.1 Flash can run as the model provider inside Codex through DeepSeekâs native Responses API. Codex keeps its repository tools, approvals, AGENTS.md instructions, MCP servers, skills, and project settings. DeepSeek handles model inference and bills the requests to your DeepSeek API balance.
This configuration uses DeepSeek API billing for Codex model requests. DeepSeek requests do not consume a ChatGPT plan allowance.
For a new setup, choose deepseek-flash. This API ID now runs DeepSeek-V4.1-Flash-1017, released on October 17, 2026, with improvements in coding and agent performance. The model accepts text and image input, and the API configuration and pricing have not changed.
Last updated: Oct 17, 2026.
Read More: How to Use DeepSeek in Claude Code With an API Key
Can I Use DeepSeek in Codex With Only a DeepSeek API Key?
Yes. DeepSeekâs Codex configuration authenticates with a DeepSeek API key and skips ChatGPT account authentication for the model provider. Model requests are charged to your DeepSeek API balance at DeepSeekâs published token rates.
Codex sessions authenticated through ChatGPT use the allowance and billing attached to that ChatGPT plan. Sessions configured with DeepSeek use DeepSeek API billing. The two accounts, balances, and usage systems are independent.
A DeepSeek configuration can reduce fixed subscription spending when you mainly want Codex for coding and prefer usage-based model billing. A paid ChatGPT plan can be worthwhile when its included Codex allowance or other ChatGPT features justify the monthly cost.
What You Need Before Setup
- Codex CLI, the ChatGPT desktop app, or the Codex extension for VS Code.
- Codex 0.144.0 or newer for DeepSeekâs Codex model catalog.
- A DeepSeek Platform account and API key.
- Available credit in the DeepSeek API account.
- A repository approved for DeepSeek processing, with credentials and prohibited data removed.
- Launch Codex at least once before setup. This creates the
~/.codexdirectory used by the integration.
Check and Update Codex
Check the installed version first. DeepSeekâs Codex model catalog requires Codex 0.144.0 or newer. If your installation is older, update Codex through npm with the second command.
codex --version
# Update when the installed version is older than 0.144.0
npm install -g @openai/codex@latestRead More: OpenAI Codex Commands Cheat Sheet
How to Use DeepSeek V4.1 Flash in Codex
DeepSeek publishes an official installer that updates ~/.codex/config.toml, writes the required ~/.codex/models.json catalog, preserves existing MCP and project trust settings, and validates the configuration before it replaces the active files.
1. Create a DeepSeek API Key
Sign in to the DeepSeek Platform, open the API Keys page, and create a new key. DeepSeek API keys begin with sk-.
Add API credit before the first test. Copy the key when it appears and store it in a password manager or another approved credential store. Keep the key out of repositories, issues, screenshots, shared documents, and shared shell commands.
2. Run the DeepSeek Setup Script
The commands below download and execute DeepSeekâs official installer. If your security policy requires review before remote code execution, download and inspect the installer first.
Windows
Open PowerShell or Windows Terminal and run:
irm https://cdn.deepseek.com/api-docs/codex-deepseek-setup-en.ps1 | iexmacOS or Linux
Run:
bash <(curl -fsSL https://cdn.deepseek.com/api-docs/codex-deepseek-setup-en.sh)Choose the DeepSeek Model
Enter your DeepSeek API key when prompted. The installer backs up the active config.toml under ~/.codex/backup-deepseek/, writes models.json, configures the DeepSeek Responses API provider, and validates the JSON and TOML syntax. Use option 1 for the latest Flash model or option 2 for V4 Pro. Both models are available through the DeepSeek API, with different token pricing:
- Option 1:
deepseek-flashruns DeepSeek-V4.1-Flash-1017 for coding, repository analysis, tests, image input, and other agent tasks. - Option 2:
deepseek-v4-proruns DeepSeek V4 Pro, which continues to be available with its own API pricing. - Option 9: restores the Codex configuration saved before DeepSeek was installed.
3. Restart Codex
Close active Codex windows and terminal sessions. Start Codex again from your project directory. The CLI startup banner should show the DeepSeek model you selected, such as model: deepseek-flash.
cd /path/to/your-project
codex4. Verify the DeepSeek Connection
Begin with a read-only repository task whose answer is easy to check. Confirm that Codex returns real file paths and project commands. After that test, request one small edit on a disposable branch, inspect the diff, and run the projectâs normal checks.
Use one branch per provider when comparing DeepSeek with another model on an identical task. Open the DeepSeek Platform usage page and confirm that the request and token charge appear under the expected account.
Read this repository without editing files. Identify the test command, the main entry point, and three likely maintenance risks. Cite the relevant file paths.5. Switch Back to OpenAI
Run the DeepSeek setup script again and select option 9 to restore the configuration saved before DeepSeek was installed. Restart all Codex clients after the restoration.
Codex stores ChatGPT-authenticated sessions and third-party API sessions in different history groups. After a provider switch, the client displays the group for the active authentication method. Restoring the earlier authentication method displays its session group again.
DeepSeek V4.1 Flash in Codex
deepseek-flash is the canonical DeepSeek model ID for Codex. It now runs DeepSeek-V4.1-Flash-1017 with a 1 million-token context window, up to 384,000 output tokens, tool calls, JSON output, thinking and non-thinking modes, and image input. The account-level concurrency limit is 2,500 requests.
The October 17 update improves coding and agent benchmark performance over the previous V4.1 Flash release. DeepSeek also reports faster task completion and shorter model outputs. The API configuration and token pricing are unchanged.
The legacy IDs deepseek-v4-flash and deepseek-v4-flash-vision-exp now direct requests to the latest V4.1 Flash model. Rerunning DeepSeek’s Codex installer removes these outdated entries from models.json. DeepSeek V4 Pro continues to be available through deepseek-v4-pro with separate pricing.
DeepSeek V4.1 Flash API Pricing in Codex
DeepSeek bills V4.1 Flash requests by token usage with peak and off-peak rates. Peak hours are 01:00â04:00 UTC and 06:00â10:00 UTC on weekdays, excluding Chinese public holidays. All other hours use off-peak pricing. The October 17 model update did not change Flash prices. V4 Pro continues to use its own API rates.
Context caching is enabled automatically. A request receives the cache-hit rate only when its reusable prefix matches content already persisted in DeepSeekâs cache. Cache matching works on a best-effort basis.
DeepSeek also charges for Search and Fetch API requests separately from model tokens. Each API costs $0.75 per 1,000 successful requests. Search and Fetch calls made through DeepSeek’s server-side Codex integration are free of request charges until November 1, 2026, at 00:00 Beijing time. Standard request pricing applies afterward.
| Token type | V4.1 Flash off-peak | V4.1 Flash peak |
|---|---|---|
| Cached input / 1M | $0.003 | $0.006 |
| Uncached input / 1M | $0.15 | $0.30 |
| Output / 1M | $0.60 | $1.20 |
Example API Cost
The example below uses 10 million uncached input tokens and 2 million output tokens. It excludes cache hits, image-token input, taxes, and future price changes.
| Model | Off-peak cost | Peak cost |
|---|---|---|
| DeepSeek V4.1 Flash-1017 | $2.70 | $5.40 |
DeepSeek can change API prices. Check the DeepSeek API pricing reference before funding a large recurring workload.
Why Codex Usage Can Consume Many Input Tokens
Codex requests can include project instructions, file contents, tool definitions, command output, diffs, conversation history, and other working context in addition to the text visible in the prompt box. Repository-wide analysis, dependency migrations, repeated test runs, and long debugging sessions can process large amounts of input.
DeepSeekâs automatic context cache can reduce the price of repeated prefixes that produce cache hits. New or frequently changing context is billed at the uncached input rate. Review the DeepSeek usage dashboard during the first week and base your budget on real repository tasks.
Manual Configuration and API Key Storage
The official installer stores the DeepSeek API key in ~/.codex/config.toml through the experimental_bearer_token field. Codex also reads model metadata from the matching ~/.codex/models.json catalog.
For a manual configuration, create the matching models.json catalog from the DeepSeek Codex integration and use deepseek-flash as the active model.
model = "deepseek-flash"
model_provider = "deepseek"
preferred_auth_method = "apikey"
forced_login_method = "api"
model_reasoning_effort = "high"
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>"Handle
config.tomlas a credential file. Keep the.codexdirectory out of repositories, remove the token before sharing the file, and revoke the key through the DeepSeek Platform after suspected exposure.
Troubleshooting DeepSeek in Codex
Codex Returns a 404, 405, or Responses API Error
Update Codex and rerun DeepSeekâs official installer. Old configurations can contain wire_api = "chat", /chat/completions, translation proxies, or retired model settings that do not match the Responses API integration.
Confirm these values in config.toml:
model_provider = "deepseek"
base_url = "https://api.deepseek.com/"
wire_api = "responses"DeepSeek-Flash Is Missing from the Model Menu
Check the Codex version first. DeepSeekâs Codex model catalog requires Codex 0.144.0 or newer. Update Codex when needed, rerun the official setup script to refresh models.json, choose option 1, and restart every Codex client. Rerunning the installer also removes retired deepseek-v4-flash and deepseek-v4-flash-vision-exp catalog entries.
codex --versionCodex Reports an Authentication or Balance Error
Confirm that the DeepSeek API key is active and the account has API credit. API requests draw from DeepSeek API credit; DeepSeek chat access uses a different service. Rerun the setup script after replacing the key and revoke any key whose storage location is uncertain.
Codex Rejects the Models
Update Codex, rerun the installer, and restart all clients. A manually edited models.json file can fail when it contains invalid JSON or omits metadata required by the installed Codex client.
The Desktop App Shows Custom
The ChatGPT desktop app can display a configured third-party provider as Custom. On Windows it can also display the selected DeepSeek model name. Check the session model details and DeepSeek usage activity when you need to confirm which provider handled the request.
Old Codex Sessions Are Missing
Restore the previous authentication configuration and restart Codex. The client displays session history for the active authentication method, and the earlier session group reappears after its authentication method is restored.
A Long Task Costs More Than Expected
Long sessions can repeatedly send conversation state, repository context, generated files, command output, and test logs. Start a new session when the task changes, exclude irrelevant generated directories, avoid repeated large logs, and use /compact when the active session becomes too large.
Screenshots or Image Prompts Do Not Work
deepseek-flash accepts both text and image input. Rerun DeepSeekâs installer if Codex is using an older model catalog, then confirm that the active model is deepseek-flash. The retired deepseek-v4-flash-vision-exp ID is no longer required for image input.
Security and Repository Data
Repository content sent to the model is processed by DeepSeek under its API service and privacy terms. Remove private keys, production credentials, customer records, confidential source code, and regulated information unless your organization has approved that data transfer.
DeepSeek uses personal data to improve and train its technology and directly collects, processes, and stores personal data in the Peopleâs Republic of China. You can opt out of the use of personal data for model training or technology optimization.
Do Different DeepSeek API Keys Increase the Concurrency Limit?
No. DeepSeek calculates concurrency at the account level, independent of the API key used for a request. All keys under one account share its concurrency limit. Additional keys can help with device management, key rotation, and revocation.
Related Resources
- AI LLM API Pricing: GPT, Gemini, Claude & More
- How to Use Kimi K3 in Codex & Claude Code
- OpenAI Codex Commands Cheat Sheet
- Codex Timeline: Release Dates and Major Updates
- DeepSeek Harness: Open-Source Plugin-Based AI Agent Harness
- 100 Best DeepSeek Harness Plugins for DSH










