anomalyco / anomalyco/opencode
OpenAI-compatible cost chunk omits required stream fields
Open
@rekram1-node is already working on this.
Since Jul 27, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
Zen appends an invalid cost event to OpenAI-compatible streams:
{"choices":[],"cost":"0"}
The event omits id, object, created, and model. Strict OpenAI chunk decoders parse every SSE data: event and fail with missing field id before they can ignore the cost metadata. Expected: retain cost inside a valid chat-completion chunk envelope.
Plugins
N/A
OpenCode version
Zen production endpoint, observed 2026-07-27
Steps to reproduce
- Send a streaming request through the Zen OpenAI-compatible endpoint.
- Parse every
data:JSON event as an OpenAI chat completion chunk. - Observe the final cost event fail schema deserialization because
idis missing.
Screenshot and/or share link
N/A — failure occurs in the raw SSE response shown above.
Operating System
Linux
Terminal
zsh
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.