anomalyco / anomalyco/opencode
OpenCode hangs indefinitely when using Ollama behind reverse proxy (streaming SSE not delivered)
@nexxeln is already working on this.
Since Jul 28, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
opencode run hangs indefinitely when using a custom Ollama provider behind a reverse proxy (Easypanel/Traefik). The model responds correctly via non-streaming requests, but OpenCode uses streaming by default and never receives the SSE chunks.
Environment
- OpenCode: v1.18.7
- OS: Linux (Docker container)
- Model: qwen2.5-coder:7b via Ollama (remote, behind Easypanel reverse proxy)
- Provider config:
@ai-sdk/openai-compatiblewith custombaseURL
Config
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"ollama": {
"npm": "@ai-sdk/openai-compatible",
"name": "Ollama Remote",
"options": {
"baseURL": "https://<host>/v1"
},
"models": {
"qwen2.5-coder:7b": {
"name": "Qwen 2.5 Coder 7B"
}
}
}
},
"model": "ollama/qwen2.5-coder:7b"
}
What works
Non-streaming requests work perfectly:
curl -s https://<host>/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"qwen2.5-coder:7b","messages":[{"role":"user","content":"say OK"}]}'
# Returns: {"choices":[{"message":{"content":"OK"}}]} OK
What doesn't work
Streaming requests return empty response through the reverse proxy:
curl -sN https://<host>/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"qwen2.5-coder:7b","stream":true,"messages":[{"role":"user","content":"say OK"}]}'
# Returns: (empty)
OpenCode logs show it starts streaming but never receives any data:
level=INFO message=stream providerID=ollama modelID=qwen2.5-coder:7b small=false agent=build
level=INFO message="llm runtime selected" llm.runtime=ai-sdk llm.provider=ollama llm.model=qwen2.5-coder:7b
# ... hangs here indefinitely
Root cause
The reverse proxy (Easypanel, which uses Traefik) appears to buffer or not properly forward SSE chunks. This is a common issue with reverse proxies and Ollama deployments.
Feature request
Add a config option to disable streaming for a provider, or auto-fallback to non-streaming when streaming data isn't received within a timeout. This would make OpenCode compatible with Ollama deployments behind reverse proxies that don't handle SSE correctly.
Something like:
"options": {
"baseURL": "https://<host>/v1",
"stream": false
}
Workaround
None found. OpenCode is unusable with this Ollama setup.
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.