国庆实在太无聊了
早就听OPENAI推出了一个CODEX 论坛内评价也挺好的 想着CC不好用 那就我试试这玩意吧 正好最近DS API也大幅度降价了
总结放前面
- Codex 默认流式向拉数据。默认stream_idle_timeout_ms=300000ms= 5 分钟
- 如果你用Windows直装(不太推荐) 还可以考虑使用 Git Bash
- 没话说了 花费三四个小时发现屁事没干就配个环境
- 抛砖引玉 这是我的配置文件参考
# 安装 配置CNPM
npm i -g @openai/codex
npm config set registry https://registry.npmmirror.com
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned # 如果是Windows
# 新建配置文件 默认用户级
mkdir -p ~/.codex
nano ~/.codex/config.toml
#配置环境变量
nano ~/.bashrc
export DEEPSEEK_API_KEY="KEY"
source ~/.bashrc
echo $DEEPSEEK_API_KEY
# 文件内容
model_provider="deepseek"
model="deepseek-chat"
# trust_level = "trusted" 这个看你们情况配置
[model_providers.deepseek]
name = "DeepSeek"
base_url = "https://api.deepseek.com/v1"
env_key = "DEEPSEEK_API_KEY"
request_max_retries = 4
stream_max_retries = 10
stream_idle_timeout_ms = 15000
折腾步骤实录
- 配置了下 Nodejs+CNPM 直接安装
- Windows下直装遇到了严重的命令执行问题 (PowerShell) 执行失败也不会自己检查 无奈花费 400W Token频繁重试
- 既然不好用那我用WSL总行了吧 开BIOS选项 开系统选项 Windows Store 下载 Ubuntu LTS 24.04 完事
- 发消息没反应 一直Working转
- 以为是权限问题 切换root和user全部卸载重装 还不行
- 去谷歌搜Issues 搜不到结果
- 无奈自己翻log
- 查看cat history.jsonl 是发送的记录
{"session_id":"0199b9dd-4267-7f93-9f28-baf366a6c4bf","ts":1759759912,"text":"hello"}
{"session_id":"0199b9dd-e391-7cc1-bfdb-e2edb4decc81","ts":1759759954,"text":"h"}
{"session_id":"0199b9e0-95c2-7643-aa96-f50b1f834cba","ts":1759760136,"text":"hello"}
{"session_id":"0199b9e2-0c18-79c1-afc9-b460f312a5e8","ts":1759760225,"text":"hello"}
{"session_id":"0199b9e2-0c18-79c1-afc9-b460f312a5e8","ts":1759760389,"text":"hello"}
{"session_id":"0199b9e2-0c18-79c1-afc9-b460f312a5e8","ts":1759760434,"text":"hello 123"}
{"session_id":"0199b9e9-9edd-72a2-9662-b3cbee828bd5","ts":1759760723,"text":"h 2"}
{"session_id":"0199b9ea-42f5-7de1-a260-93de638d3f3e","ts":1759760764,"text":"你好"}
{"session_id":"0199b9ea-d610-77a3-9b9b-faa9d7f0deea","ts":1759760800,"text":"你好"}
- 查看 cat codex-tui.log 发现也是没用的
2025-10-06T14:25:29.031297Z INFO FunctionCall: shell({"command": ["pwd"]})
2025-10-06T14:25:31.012494Z INFO FunctionCall: shell({"command": ["ls", "-la"]})
2025-10-06T14:25:34.683849Z INFO FunctionCall: shell({"command": ["cat", "README.md"]})
2025-10-06T14:25:36.900596Z INFO interrupt received: abort current task, if any
2025-10-06T14:26:31.739881Z INFO interrupt received: abort current task, if any
2025-10-06T14:30:14.778127Z INFO interrupt received: abort current task, if any
2025-10-06T14:31:07.779264Z INFO interrupt received: abort current task, if any
2025-10-06T14:31:43.898188Z INFO interrupt received: abort current task, if any
2025-10-06T14:32:35.891679Z INFO interrupt received: abort current task, if any
2025-10-06T14:33:42.874226Z INFO interrupt received: abort current task, if any
2025-10-06T14:34:30.468137Z INFO interrupt received: abort current task, if any
- 查看 ~/.codex/sessions/2025/10/06 发现是session的log 正好/status 有session ID 检查了一遍 有发送但deepseek没回复
- 寻思不对啊 这网也有 curl测试 ping测试都正常
- 无奈开个新窗口鞭策一下kimi 回复说让我去抓包 我直接贴session log 又说我网络有问题 我说挂个屁啊 这是国内的deepseek
- 这下破案了
{"timestamp":"2025-10-06T14:34:31.542Z","type":"turn_context","payload":{"cwd":"/mnt/e/NU/21/〡X","approval_policy":"on-request","sandbox_policy":{"mode":"danger-full-access"},"model":"deepseek-chat","summary":"auto"}}
{"timestamp":"2025-10-06T14:38:04.753Z","type":"event_msg","payload":{"type":"agent_message","message":"Hi! I'm ready to help you with coding tasks. What would you like to work on today?"}}
{"timestamp":"2025-10-06T14:38:04.754Z","type":"event_msg","payload":{"type":"token_count","info":null,"rate_limits":null}}
{"timestamp":"2025-10-06T14:38:04.754Z","type":"response_item","payload":{"type":"message","role":"assistant","content":[{"type":"output_text","text":"Hi! I'm ready to help you with coding tasks. What would you like to work on today?"}]}}
{"timestamp":"2025-10-06T14:39:19.265Z","type":"response_item","payload":{"type":"message","role":"user","content":[{"type":"input_text","text":"开始"}]}}
{"timestamp":"2025-10-06T14:39:19.265Z","type":"event_msg","payload":{"type":"user_message","message":"开始","kind":"plain"}}
{"timestamp":"2025-10-06T14:39:19.265Z","type":"turn_context","payload":{"cwd":"/mnt/e/NU/21/〡X","approval_policy":"on-request","sandbox_policy":{"mode":"danger-full-access"},"model":"deepseek-chat","summary":"auto"}}
四分钟才回,日志里却没有 timeout/error,最后仍正常返回,说明:
网络层没被重置,请求确实送到了 DeepSeek 国内站;
远端 排队 / 限流 / 冷启动 导致 token 第一包延迟超高;
Codex 本身没重试,也没有读秒中断,所以干等 4 分钟。
这是 DeepSeek 免费档(或当前线路)典型现象,不是配置错误。
把“首包等待”压到秒级,只要做三件事:
- 然后正巧回去看working的已经有收到回复 一切正常
- 勾起了一些回忆 以前听说过DS API平台有个很坑爹的KEEP ALIVE排队机制 没用过也不了解 这下真的体验到了
glm4.6也有一个订阅,那个怎么样
首月20续费40 主打平替CC
但我平时都用Tare/CodeBuddy 用不到这种
今天试试Codex也只是用DS小量来整理笔记的 就冲了10块
CLI太吃TOKEN了 用的多了不够 用的少了都会用IDE不用API 因为API收费的