DeepSeek-V4-Flash 接入 Codex(Windows 版)

1. 能实现什么

  • 直接运行 codex:继续使用默认的 gpt-5.6-sol。
  • 运行 codex -p deepseek:使用 DeepSeek-V4-Flash。
  • 运行 codex -p dap-gpt55:继续使用原有 GPT-5.5 / DAPTokens 配置。
  • 三套配置互相隔离;切换时结束当前对话,再启动对应 profile,不需要退出登录。

2. 配置文件

配置目录:C:\Users\<用户名>\.codex

text 复制代码
config.toml                 # 原有默认 GPT 配置,不修改
deepseek.config.toml        # DeepSeek profile
models.json                 # DeepSeek 模型元数据
auth.json                   # ChatGPT 登录态,不修改
dap-gpt55.config.toml       # 原有 GPT-5.5 profile,不修改

3. DeepSeek 配置

新建 C:\Users\<用户名>\.codex\deepseek.config.toml:

toml 复制代码
model = "deepseek-v4-flash"
model_provider = "deepseek"
model_reasoning_effort = "high"
model_catalog_json = "C:/Users/<用户名>/.codex/models.json"
disable_response_storage = true

[model_providers.deepseek]
name = "deepseek"
base_url = "https://api.deepseek.com/"
wire_api = "responses"
requires_openai_auth = false
experimental_bearer_token = "<DEEPSEEK_API_KEY>"

将 <DEEPSEEK_API_KEY> 替换为自己的 DeepSeek API Key。真实 Key 只保存在本机私有配置中,不要提交到仓库或写入共享文档。

models.json 不是 DeepSeek API 配置,而是 Codex 客户端的模型目录,用来识别模型名称、推理档位、上下文长度和工具能力。官方 provider 配置没有展开这一项;当前本机通过 model_catalog_json 显式加载它。

在已有 models.json 的根节点 models 数组中加入下面这个条目,不要覆盖数组里的其它模型:

json 复制代码
{
  "slug": "deepseek-v4-flash",
  "display_name": "DeepSeek-V4-Flash",
  "description": "Latest frontier agentic coding model.",
  "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" }
  ],
  "shell_type": "shell_command",
  "visibility": "list",
  "minimal_client_version": "0.144.0",
  "supported_in_api": true,
  "priority": 1,
  "support_verbosity": true,
  "default_verbosity": "low",
  "apply_patch_tool_type": "freeform",
  "web_search_tool_type": "text",
  "supports_search_tool": true,
  "input_modalities": ["text"],
  "supports_image_detail_original": false,
  "truncation_policy": { "mode": "tokens", "limit": 10000 },
  "supports_parallel_tool_calls": true,
  "multi_agent_version": "v2",
  "use_responses_lite": false,
  "context_window": 1048576,
  "max_context_window": 1048576,
  "reasoning_summary_format": "experimental",
  "default_reasoning_summary": "none",
  "supports_reasoning_summaries": true,
  "prefer_websockets": false,
  "include_skills_usage_instructions": false,
  "experimental_supported_tools": []
}

当前条目要求 Codex CLI 0.144.0 或更高版本。

4. 启动和恢复

默认 GPT:

powershell 复制代码
codex

DeepSeek 新对话:

powershell 复制代码
codex -p deepseek

也可以显式指定模型:

powershell 复制代码
codex -p deepseek -m deepseek-v4-flash

恢复 DeepSeek 会话:

powershell 复制代码
codex resume --last -p deepseek -m deepseek-v4-flash

或指定会话 ID:

powershell 复制代码
codex resume <SESSION_ID> -p deepseek -m deepseek-v4-flash

本方案中 -p deepseek 用于选择 DeepSeek provider;profile 已经配置模型,因此 -m 可以省略。

5. 登录态共存(重点)

官方 DeepSeek Codex 配置直接改主 config.toml,并强制使用 API Key 登录时,会和已有 ChatGPT 登录态共用同一个 auth.json,导致 ChatGPT 会话被要求退出或出现:

text 复制代码
API key login is required, but ChatGPT is currently being used. Logging out.

当前方案通过以下方式保证共存:

  1. config.toml 保留原来的 GPT 默认配置;
  2. DeepSeek 单独放在 deepseek.config.toml,只通过 -p deepseek 加载;
  3. 设置 requires_openai_auth = false,DeepSeek 使用自己的 API Key;
  4. DeepSeek profile 不设置以下两项:
toml 复制代码
forced_login_method = "api"
preferred_auth_method = "apikey"

因此可以保持 auth.json 中的 ChatGPT 登录态,默认 GPT、DeepSeek 和 DAPTokens profile 可分别启动。切换 DeepSeek 时不要执行 codex logout 或重新登录。

6. 验证

powershell 复制代码
codex login status
codex -p deepseek

第一条命令仍应显示 Logged in using ChatGPT;第二条命令进入 DeepSeek 对话。

相关推荐
Python大数据分析@1 小时前
如何看待DeepSeek 开源昇腾基础组件?
开源
miofly3 小时前
GitHub 周榜趋势速报 | 2026-10-02
开源·github
小小龙学IT4 小时前
snap7 开源西门子 S7 通信协议库深度解析
c++·开源
Erishen4 小时前
用 Lume 写一个完整 CRM:Web 与 Agent 共用同一套业务逻辑
开源·agent
神一样的老师7 小时前
RA-Eco-RA4M2-100PIN-V2.0的USB 串口加上一个开源 Shell(MicroShell 移植实录)
开源
OpenCSG7 小时前
行业观察 | 在宜昌看具身智能:开源社区被摆到了台前
数据库·开源
m4Rk_7 小时前
【论文阅读】Agent 记忆机制(87):VizoMem——把文本历史转化为可检索的视觉记忆
论文阅读·人工智能·学习·开源·github
lpfasd1237 小时前
GitHub非AI开源方向调研报告
人工智能·开源·github
白山编程大哥8 小时前
适合初学者练习的 C/C++ 开源项目推荐
c语言·c++·开源
枫叶丹48 小时前
AI 进入日常工作后,任务应该怎样重新拆分
人工智能·chatgpt·开源·agent·codex