anomalyco / anomalyco/opencode
Go gateway: SSE streaming requests over HTTP/1.1 return HTTP 500 (Endpoint is unavailable)
@MrMushrooooom is already working on this.
Since Aug 16, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
Summary
Streaming (SSE) chat completion requests to the opencode-go gateway endpoint https://opencode.ai/zen/go/v1/chat/completions return HTTP 500 with body {"type":"error","error":{"type":"error","message":"Internal server error"}} when sent over HTTP/1.1. The same request over HTTP/2 succeeds (HTTP 200 with normal SSE chunks). Non-streaming requests over HTTP/1.1 also succeed.
This surfaces in OpenChamber/openCode sessions as AI_APICallError: Upstream request failed: Endpoint is unavailable. for provider opencode-go (e.g. deepseek-v4-flash), in recurring bursts (retries all fail for several minutes, then recover).
Evidence
- HTTP/1.1 + stream:true -> always HTTP 500 (reproduced 10+ times)
- HTTP/1.1 non-streaming: HTTP 200 (5/5)
- HTTP/2 (node http2) + stream:true -> HTTP 200, normal SSE stream
- opencode CLI 1.18.18 (bun, HTTP/2) with
opencode-go/deepseek-v4-flashworks fine - Request body/headers captured from the working client and replayed via curl over HTTP/1.1 still 500s:
{"model":"deepseek-v4-flash","max_tokens":32000,"top_p":0.95,"messages":[...],"tool_choice":"auto","stream":true,"stream_options":{"include_usage":true}}
Expected
Streaming over HTTP/1.1 should work like any OpenAI-compatible endpoint (other providers do). Or at minimum return a meaningful status/error instead of a generic 500.
Plugins
None
OpenCode version
1.18.18 (bundled with OpenChamber desktop)
Steps to reproduce
- curl.exe -X POST "https://opencode.ai/zen/go/v1/chat/completions" -H "Authorization: Bearer " -H "Content-Type: application/json" -d '{"model":"deepseek-v4-flash","messages":[{"role":"user","content":"hi"}],"stream":true}' -> HTTP 500 {"type":"error","error":{"type":"error","message":"Internal server error"}}
- Same request without "stream":true -> HTTP 200, normal completion
- Same request over HTTP/2 (e.g. node http2 module, or bun fetch used by the opencode CLI) -> HTTP 200, normal SSE stream
Screenshot and/or share link
No response
Operating System
Windows 11
Terminal
OpenChamber desktop (bundled opencode-cli)
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.