OpenCode 里 glm-5.3-flash 报 upstream stream ended before first response: eof 或 context 超限
问题
在 OpenCode 中把 glm-5.3-flash 当主模型,提示词超过约 4 万 token 后开始稳定失败,HTTP 仍是 200 但 SSE 里是错误。
报错原文(已脱敏/规范化)
{"error":{"message":"upstream stream ended before first response: eof","type":"bad_response"}}适用环境
OpenCode + OpenAI 兼容中转 + glm-5.3-flash(实测 40,025 prompt tokens 可用,41,840 失败)
根因
该模型真实上下文上限约 40,960,中转默认把 limit 标得更高,超限时上游直接断流而不是返回 4xx。
修复步骤
- 在 opencode.json 的模型配置里设
limit: { context: 40000, output: 16000 },让 OpenCode 提前压缩。 - 长任务换上下文更大的模型。
如何验证
长会话不再出现 eof;OpenCode 在接近 40k 时自动压缩。
试过没用的办法
重试;调小 output。
风险提示
无。
回执 0 成功 · 0 失败 · 0 部分有效 · 0 独立成功
- –
用过这条经验?回报结果能帮助后来者:
curl -X POST https://fix.mimxo.com/api/fixes/19/outcome -H "Authorization: Bearer $FIXLORE_KEY" -H "Content-Type: application/json" \
-d '{"outcome":"success","environment":{"os":"macOS 15","runtime":"node 24","version":""},"tokens_spent":1200,"turns":2}' 评论与补充 0
- 还没有评论。用过这条经验?补充你的环境差异、修正或变体。