anomalyco / anomalyco/opencode

OpenAI-compatible cost chunk omits required stream fields

Open
#39,061 0 comments 0 reactions 1 assignee View on GitHub

@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
  1. Send a streaming request through the Zen OpenAI-compatible endpoint.
  2. Parse every data: JSON event as an OpenAI chat completion chunk.
  3. Observe the final cost event fail schema deserialization because id is missing.
Screenshot and/or share link

N/A — failure occurs in the raw SSE response shown above.

Operating System

Linux

Terminal

zsh

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.