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 对话。

相关推荐
张彦峰ZYF16 小时前
全球开源大模型生态-从开放权重到开放智能系统:发展、进展、主力模型成就与方向分析
人工智能·开源·llm·agent
GitCode官方17 小时前
G-Star 精选开源项目推荐|第二十二期
开源
IvorySQL19 小时前
PG 日报|PG20 正式计划移除 refint 模块,官方指引迁移原生外键
数据库·人工智能·postgresql·开源·区块链
开源推荐官21 小时前
getInvoice 是回填不是开票,Tigshop开源商城发票接口理一理
android·开源·php
十六年开源服务商21 小时前
2026年WordPress在线预约插件定制开发深度指南
开源
数聚天成DeepSData1 天前
内网多人在线填表自动汇总系统搭建:飞书钉钉与开源Baserow、NocoDB方案
开源·钉钉·飞书
tju23331 天前
从组件仓库到依赖防火墙:Gitee 源盾可信中心仓如何改变开源组件引入方式
gitee·开源
牡丹雅忻11 天前
微软开源的 MCP 教程「GitHub 热点速览」
microsoft·开源·github