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

相关推荐
tedcloud1233 小时前
Wand-Enhancer 怎么搭建?开源 Wand 客户端增强与远程控制工具介绍
大数据·服务器·人工智能·开源·音视频
嘉琪coder4 小时前
我做了一个 Chrome 扩展,把 YouTube 播放列表批量变成 AI 可读的本地 Markdown
chrome·开源·浏览器
冬奇Lab7 小时前
一天一个开源项目(第214篇):AstronRPA —— 科大讯飞开源的企业级 RPA + AI Agent 自动化平台
人工智能·开源·资讯
DolphinScheduler社区10 小时前
Apache DolphinScheduler 8 月报:权限安全加固,调度补火上线,性能与稳定性持续提升
大数据·安全·开源·apache·任务调度·海豚调度
T型码农要学习10 小时前
开源项目11|Stable Diffusion WebUI:本地自建AI绘图,无限免费出图,彻底告别AI绘画会员次数限制
开源·ai绘画
小弥儿10 小时前
GitHub今日热榜 | 2026-09-02:i-have-adhd 登顶
学习·开源
分布式存储与RustFS11 小时前
RustFS 多协议接入全景:S3 之外,Swift/Keystone 与 SFTP/FTPS 怎么选
云原生·开源·对象存储·分布式存储·s3·rustfs·性能基准
tedcloud12312 小时前
Wand-Enhancer:如何搭建一套远程开发与测试环境
前端·人工智能·macos·开源·流程图
万物智能信息科技12 小时前
RK3568 的多路显示移植—【万物智能之开源鸿蒙OpenHarmony系统实战开发系列教程】
linux·开发语言·华为·开源·harmonyos