Skip to content

Use DeepSeek V4 with Codex CLI on Windows or WSL

Connect Codex CLI, the Codex IDE extension, and the ChatGPT desktop app to DeepSeek V4 through the Responses API and a custom Codex model catalog.

MGMCSA Guru Team July 29, 2026 3 min read
Codex CLI using DeepSeek V4 Flash through the Responses API

DeepSeek now provides a Responses API route designed for Codex. The current setup is more than a base URL change. Codex also needs a model catalog so it knows the model’s context limit, reasoning settings, and tool behavior.

The configuration is shared by Codex CLI, the Codex IDE extension, and the ChatGPT desktop app. Back up your existing Codex files before changing the provider.

What changed from older guides

Older examples commonly used deepseek-chat, deepseek-reasoner, and wire_api = "chat". DeepSeek discontinued those model aliases on July 24, 2026. Its current Codex documentation uses:

Current Codex settings

Model deepseek-v4-flash
Base URL https://api.deepseek.com/
Protocol wire_api = responses
Model catalog ~/.codex/models.json

DeepSeek’s general API supports V4 Flash and V4 Pro, but the Responses API documentation currently lists V4 Flash for Codex. Verify the integration page before changing the Codex model to V4 Pro.

Back up the current Codex configuration

Codex stores its main configuration under ~/.codex. In PowerShell, that normally resolves to C:\Users\YourName\.codex. In WSL, it is inside your Linux home.

Make a copy of these files if they already exist:

~/.codex/config.toml
~/.codex/models.json

Choose automatic or manual setup

DeepSeek publishes setup scripts for PowerShell and Unix shells. Those scripts back up the existing Codex configuration, write the model catalog, update the provider, and validate the files.

Review any downloaded script before executing it. If you do not want a script to modify your Codex files, follow DeepSeek’s manual instructions instead. The manual route requires copying the current models.json content from the official integration page because the catalog contains more than a model name.

Configure config.toml

After creating the current models.json from DeepSeek’s documentation, add the provider to ~/.codex/config.toml:

model = "deepseek-v4-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>"

The official configuration currently places the token directly in config.toml. Restrict access to the .codex directory and do not commit this file to a repository.

Test the provider

Open a new terminal in a small test repository:

cd /path/to/test-project
codex

Check the startup banner. It should show deepseek-v4-flash. Give Codex a read-only task first, such as summarizing a short file. Then inspect your DeepSeek usage records to confirm that the request reached the intended account.

If Codex asks for ChatGPT authentication or displays an OpenAI model, recheck preferred_auth_method, forced_login_method, model_provider, and the path to models.json.

Common problems

  • A model catalog error usually means models.json is missing, invalid, or saved at a different path.
  • A 401 response means the DeepSeek key is missing, malformed, or no longer valid.
  • A model-not-found response usually means an old alias remains in config.toml or the model catalog.
  • Protocol errors often come from wire_api = "chat". The current Codex integration uses responses.
  • Existing MCP or trust settings disappeared because the configuration was replaced instead of merged. Restore the backup and add only the provider fields.

DeepSeek Codex checklist

  • Existing config.toml and models.json backed up
  • Current models.json copied from DeepSeek's Codex integration page
  • deepseek-v4-flash selected
  • wire_api set to responses
  • Codex startup banner checked
  • Test request confirmed in DeepSeek usage records

Treat the official DeepSeek integration page as the source for the model catalog. The catalog can change when Codex adds new capabilities or DeepSeek expands Responses API support.

Frequently asked questions

Can Codex CLI use DeepSeek directly?

Yes. DeepSeek provides a Responses API endpoint for Codex. The current setup uses a DeepSeek provider in config.toml plus a models.json catalog that describes the model to Codex.

Which DeepSeek model works with Codex?

DeepSeek's current Codex integration documents deepseek-v4-flash. Check the integration page before selecting deepseek-v4-pro because Responses API support can differ from Chat Completions support.

Should wire_api be chat or responses?

Use wire_api = "responses". Older guides that use wire_api = "chat" describe a previous integration path and do not match DeepSeek's current Codex instructions.

Does the same setup affect the Codex IDE extension?

Yes. Codex CLI, the Codex IDE extension, and the ChatGPT desktop app share the same local Codex configuration. Back up your existing files before changing the provider.

Sources & further reading

Official vendor documentation referenced while writing this guide.

MG

MCSA Guru Team

IT & Systems Administration

We are working IT pros and system administrators who spend our days in Windows Server, Microsoft 365, and the wider Microsoft stack. MCSA Guru is where we write down the fixes and walkthroughs we wish we had found the first time.

MCSA Guru provides independent, educational IT guidance. Microsoft, Windows, Windows Server, Microsoft 365, Exchange, and Microsoft Teams are trademarks of Microsoft Corporation; Docker is a trademark of Docker, Inc. MCSA Guru is not affiliated with or endorsed by Microsoft or Docker. Always test changes in a safe environment before applying them in production.

Related guides

Fixing something right now?

Jump straight into the guide library or search for the exact error or task you are dealing with.