You can use DeepSeek AI with Codex by configuring DeepSeek as a custom model provider. Codex handles the coding workflow; DeepSeek supplies the model responses. The current direct integration uses DeepSeek’s native Responses API, so a translation proxy is not required.
This guide covers two setup paths: DeepSeek’s official installer and a manual Codex CLI profile. You will also build a small JavaScript exercise to check whether your setup can read files, make a targeted change, and run tests—not just return a chat response.
Last updated: November 15, 2026. Configuration details were checked against the current OpenAI and DeepSeek documentation. The example’s tests were checked locally; a live DeepSeek-powered Codex session was not executed for this article.
Can You Use DeepSeek with Codex?
Yes. In this arrangement, Codex remains the client you use to work with a codebase. You configure it to send model requests to DeepSeek instead of its usual provider. DeepSeek documents native support for the Responses API, including function calls and the custom patch tool used in coding workflows.
That does not make every OpenAI-hosted API feature available through DeepSeek. It also does not switch the model behind ordinary ChatGPT conversations. The configuration here concerns a local Codex client and the provider that receives its requests.
Keep these connection details handy. The model identifiers and endpoint are documented in the DeepSeek Responses API reference.
| Setting | Value for the direct integration |
|---|---|
| Provider base URL | https://api.deepseek.com |
| Codex protocol | wire_api = "responses" |
| Starting model | deepseek-flash |
| Alternative model | deepseek-v4-pro |
| Authentication | A DeepSeek API key |
| Actual API endpoint | POST https://api.deepseek.com/responses |
Use the provider’s base URL in your configuration. Do not paste a Chat Completions endpoint or the complete /responses endpoint into base_url; the client builds the request URL from its selected protocol.
What You Need Before Setup
- A current Codex installation. DeepSeek’s integration guide currently specifies Codex
0.164.0or later. - A DeepSeek API key and sufficient API balance, available through the DeepSeek platform.
- Access to your user-level Codex configuration directory.
- Git and a current supported Node.js release if you want to run the coding exercise below.
If you use the npm installation method, install or update the CLI, then check its version:
npm install -g @openai/codex@latest
codex --version
If you installed Codex another way, follow the update instructions for that installation method. The official Codex CLI documentation covers installation. Launch Codex once before using DeepSeek’s installer so its configuration directory exists.
Choose One Setup Path
| Path | Best fit | Main consideration |
|---|---|---|
| Official DeepSeek installer | You want the provider and complete model catalog configured together. | Changes the main configuration, stores the supplied key there, and enables search. |
| Manual CLI profile | You want an explicit DeepSeek launch while keeping your base configuration available. | Requires copying the official catalog and providing an environment variable to the CLI. |
You do not need to perform both methods. The manual profile is especially useful when you want to try DeepSeek for one terminal session before deciding whether to change other local clients.
Method 1: Use the Official DeepSeek Installer
The official scripts configure the provider and write the complete model catalog. Close active Codex clients first, then run the command for your operating system.
macOS and Linux
Run this in Bash. It downloads and executes DeepSeek’s official shell script:
bash <(curl -fsSL https://cdn.deepseek.com/api-docs/codex-deepseek-setup-en.sh)
Windows PowerShell
Run the corresponding official PowerShell script:
irm https://cdn.deepseek.com/api-docs/codex-deepseek-setup-en.ps1 | iex
Follow the menu: option 1 selects Flash, option 2 selects Pro, and option 9 restores the saved configuration. Supply your DeepSeek API key when requested, then reopen Codex.

The current installer backs up config.toml, generates models.json, and updates provider settings. It writes the key into the configuration even if the key initially came from DEEPSEEK_API_KEY. It also enables Alpha Search, which has separate request billing. The manual method below uses an environment variable and starts with search disabled.
If the installer reports an existing, unrelated model catalog, preserve that file. Use the manual profile or review the conflict before proceeding; deleting an existing catalog may disrupt another provider.
Method 2: Configure a DeepSeek Codex CLI Profile
This method creates a named configuration that you select when launching the CLI. Current Codex profiles use separate files, such as deepseek.config.toml. Older examples that put [profiles.deepseek] inside the main configuration use a superseded format.
1. Find Your Codex Configuration Directory
The default directory is ~/.codex on macOS and Linux, or %USERPROFILE%\.codex on native Windows. If you already use a custom CODEX_HOME, use that directory. A CLI running inside WSL uses its Linux environment.
Put provider configuration in the user-level directory. A repository’s .codex/config.toml is not the place to define provider routing: Codex ignores provider-selection and provider-definition keys there. See the official configuration layers and precedence.
2. Save the Complete DeepSeek Model Catalog
Open the DeepSeek Codex integration guide, expand the section containing the full models.json content, and copy the complete JSON into a file named deepseek-models.json in your Codex configuration directory.

Do not replace it with a short JSON object containing only the model names. The catalog supplies metadata and instructions that affect the client’s model handling. OpenAI explains that an unrecognized custom model can receive requests while Codex falls back to generic settings; its custom model catalog guidance describes this distinction.
3. Create the Profile File
Create deepseek.config.toml beside the catalog. Paste this configuration and replace the catalog placeholder with your file’s actual absolute path:
model = "deepseek-flash"
model_provider = "deepseek_direct"
model_reasoning_effort = "high"
model_catalog_json = "/ABSOLUTE/PATH/TO/deepseek-models.json"
web_search = "disabled"
[model_providers.deepseek_direct]
name = "DeepSeek"
base_url = "https://api.deepseek.com"
wire_api = "responses"
env_key = "DEEPSEEK_API_KEY"
requires_openai_auth = false

deepseek_direct is a local provider label, not a model ID. Its value must match the name in the provider table. This separate label also avoids reusing a provider definition left by another setup method.
For native Windows, the catalog line can use a single-quoted TOML string:
model_catalog_json = 'C:\Users\YOUR_NAME\.codex\deepseek-models.json'
Replace YOUR_NAME with the real directory name. Do not assume that %USERPROFILE% will expand inside a TOML string. Keep the model and catalog settings above the provider table, and avoid duplicate keys. OpenAI’s custom provider configuration guide explains the separation between top-level settings and provider settings.
4. Make Your API Key Available to the CLI
The profile reads your key from DEEPSEEK_API_KEY. These commands prompt for it without placing the key itself in the command you type. The variable applies to the current shell session and processes launched from it.
macOS or Linux: run bash first if your current shell is different. Then run this command and enter your key at the prompt:
read -r -s -p "DeepSeek API key: " DEEPSEEK_API_KEY && printf '\n' && export DEEPSEEK_API_KEY
Windows PowerShell:
$deepSeekSecret = Read-Host "DeepSeek API key" -AsSecureString; $env:DEEPSEEK_API_KEY = [System.Net.NetworkCredential]::new("", $deepSeekSecret).Password
Launch Codex from that same terminal. A desktop app or editor already running elsewhere may not inherit the variable. OpenAI’s alternative-provider authentication documentation confirms that env_key supplies the custom provider credential; requires_openai_auth = true would select OpenAI authentication instead.
5. Start a New Session with the Profile
codex --profile deepseek
This selects deepseek.config.toml for that CLI launch. It does not automatically select the same profile in every desktop or IDE session. Restart after changing the catalog so the new session loads the updated configuration.
Verify That Codex Is Using DeepSeek
Inside the new CLI session, use /status to inspect the active model and provider. Use /model to inspect the model choices and reasoning controls. If the result differs from your configuration, /debug-config helps identify the effective settings. These commands are documented in the Codex CLI command reference.

Do not use “Which model are you?” as the main verification step. A model’s written answer is weaker evidence than the client’s actual routing configuration.
Check the integration at three levels: the client loads your settings, the provider returns a response, and the agent completes a coding task with tools. A successful first message proves less than a successful file edit followed by a test run.
Run a Reproducible Coding Test
This exercise deliberately starts with a small bug. The function handles a simple two-word label but mishandles repeated spaces, tabs, and line breaks. The task is narrow enough that you can inspect every change.
Create an empty folder named deepseek-codex-check and open a terminal there. Add the following two files with your editor. The tests use Node.js’s built-in test runner, so no package installation is needed for this project.
Create the Function
Save this as normalize-label.cjs:
function normalizeLabel(value) {
return value.trim().toLowerCase().replace(" ", "-");
}
module.exports = { normalizeLabel };
Create the Tests
Save this as normalize-label.test.cjs:
const test = require("node:test");
const assert = require("node:assert/strict");
const { normalizeLabel } = require("./normalize-label.cjs");
test("trims and lowercases a two-word label", () => {
assert.equal(normalizeLabel(" Hello Codex "), "hello-codex");
});
test("collapses repeated spaces between words", () => {
assert.equal(normalizeLabel("DeepSeek with Codex"), "deepseek-with-codex");
});
test("converts tabs and line breaks between words", () => {
assert.equal(normalizeLabel("Fix\tMy\nLabel"), "fix-my-label");
});
test("returns an empty string for whitespace-only input", () => {
assert.equal(normalizeLabel(" \t\n "), "");
});
Establish the Baseline
Initialize Git, stage the original files, and run the tests:
git init
git add normalize-label.cjs normalize-label.test.cjs
node --test normalize-label.test.cjs
The starting result should be two passing tests and two failing tests. Those failures are intentional. Staging the original files gives you a baseline for reviewing the agent’s edits without creating a commit.

Ask Codex to Fix the Function
From this folder, start codex --profile deepseek if you used the manual method, or codex if you used the installer. Confirm the provider, then submit this prompt:
Read normalize-label.cjs and normalize-label.test.cjs. Run node –test normalize-label.test.cjs. Fix normalizeLabel so it trims surrounding whitespace, lowercases the text, and replaces each run of internal whitespace with one hyphen. Change only normalize-label.cjs. Do not modify the tests, install packages, browse the web, download files, stage files, or create a commit. Rerun the tests and summarize the change and the test result.
Keep your usual Codex permission controls. If a legitimate read, edit, or test command requires approval, review that specific action. There is no need to disable the sandbox to complete this exercise.
Inspect the Result Yourself
After the agent finishes, check the files and rerun the tests:
git status --short
git diff --name-only
git diff -- normalize-label.cjs
git diff -- normalize-label.test.cjs
node --test normalize-label.test.cjs

The acceptance criteria are straightforward: all four tests pass, the test file is unchanged, and the edit is confined to the function file. Review the actual diff rather than accepting the agent’s summary as proof.

The original files will appear as staged additions because this is a new repository. The function should also have an unstaged change. Check for unexpected files, and confirm that git diff --name-only lists only normalize-label.cjs.
Passing this exercise confirms the particular read-edit-test workflow you ran. It is not a benchmark of broad coding quality. For a real project, follow it with a small representative task that uses your language, test command, and repository conventions.
Choose a Model and Control Web Search
Start with deepseek-flash so you can establish a working configuration, then compare deepseek-v4-pro on the same project task if needed. The current model table lists Flash as accepting text and images, while Pro accepts text. Model names alone do not tell you which one will produce the best patch for your repository.

The published DeepSeek catalog offers low, high, and max reasoning levels. The profile above starts at high. Use the choices exposed for the selected model instead of assuming that every reasoning label from another provider is supported.
The manual profile disables web search during the initial coding check. DeepSeek’s current installer enables Codex Alpha Search, which uses standalone Search and Fetch APIs. DeepSeek’s Search and Fetch billing documentation explicitly identifies this client-side route as billable per successful request.

That differs from the server-side web_search tool in the Responses API. The current Responses API guide documents that tool for Pro and says Flash ignores it. Current server-side tool rules do not impose a separate tool-call fee, although model token usage still applies. Do not transfer that pricing assumption to Alpha Search.
To keep Codex search disabled, retain web_search = "disabled" at the top level of the applicable configuration. Running the installer’s model setup again can re-enable search, so recheck the setting afterward.
Troubleshoot DeepSeek with Codex
Identify the failing layer before changing settings. A TOML parsing error, an authentication rejection, and an unsuccessful tool call have different causes. DeepSeek’s API error reference explains the HTTP status codes; the remaining checks concern the local client configuration.

| Symptom | What to check |
|---|---|
| Missing API key or HTTP 401 | Check the selected provider’s key. With the manual profile, confirm that Codex inherited DEEPSEEK_API_KEY; the installer instead stores its key in configuration. |
| HTTP 402 | Check the DeepSeek API balance. Credits or subscriptions from another service do not fund that account. |
| HTTP 400 or 422 | Read the returned error. Verify the model ID, Responses protocol, endpoint configuration, and request compatibility. |
| HTTP 429 | Reduce request pressure and retry with delays instead of repeatedly resubmitting immediately. |
| HTTP 500 or 503 | Retry after a delay with a limit on attempts. Preserve the task state before retrying edits. |
| TOML parsing error | Check quotation marks, duplicate keys or tables, and whether top-level settings were accidentally placed inside a provider table. |
| Model or reasoning choice is missing | Check the client version, full catalog content, absolute catalog path, and selected profile. Restart after corrections. |
| CLI works, but the editor or app does not | Compare configuration directories, active settings, and inherited environment variables. A CLI profile is selected only for its launch. |
| Text responses work, but edits or tools fail | Check the complete model catalog, current client, actual tool error, and applicable permissions. Do not treat a successful chat reply as proof of tool compatibility. |
If an older tutorial recommends a Chat Completions bridge, first determine which integration it describes. Instructions for a third-party gateway may require that gateway’s URL and credentials. Mixing those values with the direct DeepSeek configuration makes failures harder to diagnose.
Understand Costs and Switch Back Cleanly
A working configuration does not make API use free. Check DeepSeek’s current pricing for the selected model, cached and uncached input, and output usage. Add standalone search charges if you enable Alpha Search.
Measure a complete task rather than estimating its cost from one short response. A coding session may involve several requests as the agent reads results, edits files, and continues. Record the final patch quality, test outcome, elapsed time, and actual account usage when comparing setups.
If You Used the Manual Profile
Exit the session and launch codex without --profile deepseek to use your base configuration. This assumes you did not also change that base configuration with the installer. Confirm the active provider in the new session.
If You Used the Official Installer
Save any later configuration changes you want to keep, then use the installer’s restore option. It restores the pre-installation snapshot, so edits made to the active configuration afterward are not preserved automatically.
If you revert settings manually, also review model_catalog_json. As the catalog documentation explains, a custom local catalog replaces the bundled catalog. Leaving a DeepSeek-only catalog active can affect the model choices available after switching providers. Restart the client and check the resulting configuration.
Frequently Asked Questions
Do I Need a ChatGPT Subscription to Use DeepSeek with Codex?
No. The direct configuration authenticates model requests with a DeepSeek API key. DeepSeek API usage is billed by DeepSeek; a ChatGPT subscription does not supply DeepSeek API credit. Access requirements for a particular Codex or desktop surface are a separate matter.
Do I Need a Proxy to Connect DeepSeek to Codex?
Not for the direct native Responses integration described here. Use a gateway only when you intentionally want its routing, account, or management features, and follow that service’s configuration consistently.
Can I Use This Setup in VS Code or a Desktop App?
Local Codex surfaces can use custom provider configuration, but the environment and selected settings must match. A profile selected with a CLI flag does not automatically activate in another client. Check that client’s configuration and credential access, restart it, and verify the actual provider.
Does This Run DeepSeek Locally?
No. The client runs locally, but this configuration sends model requests to DeepSeek’s API. Running model weights on your own hardware requires a separate serving setup and is outside this guide.
Is a Passing Coding Test Enough for Production Use?
It is a useful first check. Before using the setup on larger tasks, try a small change in your real project, inspect the diff, and run the relevant tests. Keep the task bounded until you understand how the selected model handles your code and tools.
Once the provider, catalog, and coding exercise work together, you have a practical starting point for using DeepSeek with Codex. Build from that verified workflow and evaluate changes to models, reasoning, or search one at a time.
