anomalyco / anomalyco/opencode

Zen API SSE streaming splits UTF-8 multi-byte characters causing garbled Chinese in third-party clients

Open
#39,694 2 comments 1 reaction 1 assignee View on GitHub

@MrMushrooooom is already working on this.

Since Jul 30, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

When consuming the Zen API (opencode.ai/zen/go/v1/chat/completions) with stream: true, the SSE chunks are too fine-grained, causing UTF-8 multi-byte Chinese characters to be split across chunk boundaries. Clients that process each chunk independently render the incomplete byte sequences as U+FFFD replacement characters (��).

Plugins

No response

OpenCode version

No response

Steps to reproduce

1.Connect any OpenAI-compatible client (tested: WorkBuddy, curl) to https://opencode.ai/zen/go/v1/chat/completions
2.Send a Chinese prompt with "stream": true using deepseek-v4-flash
3.Observe the rendered response — Chinese characters intermittently display as ��
Example: "修复方法" appears as "��复方法" (first byte E4 of 修 is lost at chunk boundary).

Screenshot and/or share link

No response

Operating System

Windows 11

Terminal

No response

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.