anomalyco / anomalyco/opencode

GitHub Copilot compatibility issue with streaming responses containing empty choices chunks

Open
#43,585 1 comment 0 reactions 1 assignee View on GitHub

@MrMushrooooom is already working on this.

Since Aug 20, 2026.

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

Description

Description

Description:

When using OpenCode Go as an OpenAI-compatible Chat Completions endpoint with GitHub Copilot in VS Code, some models fail because the streaming response contains multiple chunks with an empty choices array before the actual content chunks.

The same model works correctly with non-streaming requests.

Environment:

Issue:

A non-streaming request returns a valid OpenAI Chat Completions response with choices:

{
"object": "chat.completion",
"choices": [
{
"message": {
"role": "assistant",
"content": "Hello!"
}
}
]
}

However, when stream=true is used, the response starts with multiple chunks containing an empty choices array:

data: {"object":"chat.completion.chunk","choices":[]}

before the actual content chunks:

data: {"choices":[{"index":0,"delta":{"content":"Hello!"}}]}

GitHub Copilot fails to parse this streaming response and returns:

Response contained no choices.

Expected behavior:

Streaming responses should follow the OpenAI Chat Completions streaming format and avoid sending empty choices chunks, or ensure compatibility with clients that require valid choices in streaming chunks.

Actual behavior:

OpenCode Go sends several empty choices chunks before the assistant content, causing compatibility issues with GitHub Copilot.

Additional information:

The same endpoint and model work correctly when stream=false is used. This appears to be a streaming response formatting compatibility issue rather than an authentication or model availability issue.

Possible fix:

Filter out empty choices chunks in the streaming adapter or ensure every emitted chunk follows the expected OpenAI-compatible streaming format.

Plugins

No response

OpenCode version

No response

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

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.