anomalyco / anomalyco/opencode
OpenCode Go gateway returns 500 on POST /zen/go/v1/chat/completions (all models, all keys)
Open
@fwang is already working on this.
Since Aug 4, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
问题描述
OpenCode Go (opencode-go provider) 的所有模型调用都会失败:POST https://opencode.ai/zen/go/v1/chat/completions 稳定返回 HTTP 500 "Internal server error",而 GET /zen/go/v1/models 正常返回 200 和完整模型列表。受影响模型包括 deepseek-v4-flash、glm-5.1、qwen3.7-plus 等(逐一验证均 500)。
OpenCode 客户端中表现为"子代理超时、无报错":日志显示请求挂起约 78 秒后静默退出并返回空文本。
复现步骤(Windows 11, opencode 1.18.3)
opencode auth已有 opencode-go API key- 用任意 HTTP 客户端 POST 到
https://opencode.ai/zen/go/v1/chat/completions,body:{"model":"deepseek-v4-flash","messages":[{"role":"user","content":"pong"}],"max_tokens":5} - 观察响应
测试证据
| 测试 | 结果 |
|---|---|
GET /zen/go/v1/models (直连真实 IP + 系统 DNS) |
200,模型列表完整 |
POST /zen/go/v1/chat/completions 有效 key |
500, ~1-2s |
POST 无效 key (sk-invalid-key-xyz) |
500(正常应 401) |
| 换模型 glm-5.1 / qwen3.7-plus | 500 |
stream: true 模式 |
500 |
| 浏览器 UA | 500 |
| 不存在的模型 ID | 500 |
| 走本地 HTTP 代理 (127.0.0.1:7892) | 时通时断,通时 500 |
直连真实 IP (curl --resolve opencode.ai:443:172.65.90.20) |
500,响应头 Server: cloudflare |
响应体:{"type":"error","error":{"type":"error","message":"Internal server error"}}
响应头:HTTP/1.1 500 Server: cloudflare CF-RAY: ... Cf-Placement: remote-ORD
关键判断
- 500 由 Cloudflare 层返回(
Server: cloudflare+CF-RAY),POST 请求未真正到达上游模型服务端 - 无效 key 返回 500 而非 401,说明网关层对 POST 的处理有异常
- 排除本地网络/VPN 因素:直连真实 IP 和走代理结果一致,VPN 开/关无影响
影响
opencode-go/*全部模型不可用- OpenCode 客户端无错误提示,只显示"超时",难以定位
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.