Fix Codex Provider Switch Losing Session in Three Simple Steps
Recently I integrated DeepSeek into Codex. Some tasks I let the official Codex service handle, and others I delegate to DeepSeek, so I switch between them. During switching, Codex has a mechanism that filters out conversations that don’t belong to the current provider, so when I switched to my custom provider, the official conversations disappeared. Seeing my once-full conversation list on the left suddenly empty, my heart sank. After some searching, I found a lifesaver: codex-provider-sync, a project that already has 3k stars. I tried it and it works really well and is super simple. Seeing my conversations come back, I had to recommend it to anyone using custom providers in Codex!
Using codex-provider-sync
It’s very simple: install => run
But before you start, there are two prerequisites:
-
Quit Codex first: because Codex can’t operate on its conversation database while it’s running.
-
Have Node.js installed: if you’re using Codex, you definitely have a Node.js environment, right?
Step 1: Install the tool
npm install -g git+https://github.com/Dailin521/codex-provider-sync.gitAfter installation, you’ll have a command:
codex-providerStep 2: Use the tool
codex-provider syncOn success, you’ll see something like:
Synchronized provider: deepseekUpdated rollout files: 2108Updated SQLite rows: 5905Backup: ~/.codex/backups_state/provider-sync/时间戳Actually, before using it, you can also check the current status, but it’s not required:
codex-provider statusYou’ll see something like:
Current provider: deepseekRollout files: sessions: openai: 800, deepseek: 12SQLite state: sessions: openai: 790, deepseek: 12The above is the macOS tutorial. For Windows, the official repo also provides a GUI — check the README in the official repository, it’s clearly documented.
Registering DeepSeek as a Native Custom Subagent in Codex
Wait, there’s more. We don’t actually have to switch providers at all — we can have Codex’s subagents use DeepSeek instead, so we don’t have to deal with conversation migration. Use this repository: oil-oil/codex-deepseek-subagent. Here’s how:
-
First, install the Skill globally (requires Node.js):
Terminal window npx skills add oil-oil/codex-deepseek-subagent -g -y -
Restart the ChatGPT / Codex desktop app, then start a new task.
-
In the new task, just say:
Configure DeepSeek as a native subagent in Codex. -
If you haven’t configured an API Key yet, it will ask for your DeepSeek API Key (it’s securely saved to the system credential store via standard input, not written in plaintext to any file).
-
Once you see
status: ready, restart the desktop app again and create a new task. -
After that, you can directly use:
Check this project with the DeepSeek subagent.Or have the main agent invoke it:
spawn_agent(agent_type="DeepSeek", fork_turns="none")
After successful configuration, the agent file will be at ~/.codex/agents/DeepSeek.toml.
This approach automatically handles compatibility issues (pinning the parent model’s multi_agent_version to v1 and disabling multi_agent_v2), because DeepSeek doesn’t currently support V2’s encrypted task delivery (encrypted_content gets dropped).
Summary
Let’s wrap this up simply: if you’re looking to use DeepSeek in Codex recently, I recommend going with the subagent approach. If you’ve run out of official credits, then switch providers and migrate your conversations to the new provider.