noteTb: 267
This data as json
| id | user_id | content | tags | created_at | updated_at | enable | pinned | folder_id | comment | position | visibility |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 267 | 1 1 | # Codex CLI 套 DeepSeek V4 经验 - 版本:1.1.0 - 2026-05-12:deepseek - 补充 Windows 桌面版、完整排障步骤 - 2026-05-12:deepseek - 全链路打通 # 事件 1:安装 Codex CLI 后无法直连 DeepSeek Codex CLI v0.130.0 已移除 Chat Completions API 支持(wire_api="chat"),只认 OpenAI Responses API(/v1/responses)。而 DeepSeek API 只支持 Chat Completions(/chat/completions),不提供 /responses 端点。直接在 config.toml 配 base_url 指向 api.deepseek.com 返回 404。 报错信息:unexpected status 404 Not Found, url: https://api.deepseek.com/responses ## 解决方法 codex-bridge 做协议翻译 开源项目 codex-bridge(github.com/xiaoshaoning/codex-bridge)在本地起 Express 服务(端口 8098),把 Codex 发出的 Responses API 请求翻译成 DeepSeek 的 Chat Completions API。 完整安装步骤: 1. npm install -g @openai/codex 2. git clone https://github.com/xiaoshaoning/codex-bridge.git 3. cd codex-bridge && npm install && npm run build 4. DEEPSEEK_API_KEY=sk-xxx nohup node dist/server.js > /tmp/codex-bridge.log 2>&1 & 5. curl http://localhost:8098/health 验证 ~/.codex/config.toml 完整配置(Linux/macOS),Windows 路径为 C:\\Users\\<用户名>\\.codex\\config.toml: [model_providers.deepseek] name = "DeepSeek" base_url = "http://localhost:8098" env_key = "DEEPSEEK_API_KEY" [profiles.dsv4] model_provider = "deepseek" model = "deepseek-v4-flash" [profiles.dsv4-pro] model_provider = "deepseek" model = "deepseek-v4-pro" 使用方式: - 非交互:echo "指令" | codex exec --profile dsv4 --skip-git-repo-check - 写文件:加 --sandbox workspace-write - 交互:codex --profile dsv4 沙箱模式:默认 read-only,--sandbox workspace-write 可写工作目录,--sandbox danger-full-access 完全访问 ## 坑 5 个 1. Codex 0.130.0 wire_api="chat" 直接报错不再支持 2. bridge SSE 流翻译有 OutputTextDelta without active item 报错,不影响功能但终端刷屏 3. bridge 需常驻后台,重启后手动启动,建议写 systemd service 4. codex exec 默认 read-only,写文件需显式 --sandbox workspace-write 5. 非 git 仓库内运行需 --skip-git-repo-check # 事件 2:Windows 桌面版 Codex 套 DeepSeek 桌面版 Codex(VS Code / Cursor / Windsurf 扩展)和 CLI 共用同一套 config.toml 和 API 协议,方案完全一致。 两种部署方式: A. bridge 跑在 Windows 本地:装 Node.js,clone codex-bridge,npm install && npm run build,启动 bridge,config.toml 的 base_url 写 http://localhost:8098 B. bridge 跑在 Linux 服务器:Windows Codex config.toml 的 base_url 写 http://<服务器IP>:8098,注意防火墙放开 8098 Windows config.toml 路径:C:\\Users\\<用户名>\\.codex\\config.toml ## 解决方法 同 CLI,不需要额外改动 桌面版 Codex 扩展启动后自动读取 config.toml,在设置里选 profile(dsv4 或 dsv4-pro)即可。bridge 在本机 localhost 最简单。 ## 坑 Windows 特有 1. DEEPSEEK_API_KEY 要设到系统环境变量(图形界面),终端 export 对 VS Code 扩展无效 2. 远程 bridge 方案需 Windows 防火墙放行 8098 出站 3. config.toml 路径用正斜杠,避免反斜杠转义问题 | ["codex", "deepseek", "运维"] | 2026-05-12 20:48:17 | 2026-05-12 20:53:50 | T | F | v1.1 补充 Windows 桌面版方案和完整排障步骤 | 23 | public |