Skip to content

Claude streams in bursts via github-copilot provider, GPT streams smoothly #25172

Description

@jimicze

Claude models via the github-copilot provider stream in visible bursts — text arrives in chunks with pauses up to ~500-750ms between them. GPT models on the same provider stream continuously. Happens on every Claude model I've tried (sonnet-4.5, sonnet-4.6).

To rule out OpenCode being the cause, I posted the same prompt directly to the Copilot API using the same OAuth token. The burst pattern is already present in the raw SSE from /v1/messages. GPT endpoints (/chat/completions, /responses) don't have it.

The difference seems to come from how OpenCode routes each model: Claude goes through @ai-sdk/anthropicPOST /v1/messages (Anthropic shim), while GPT uses @ai-sdk/github-copilotPOST /chat/completions. The shim batches SSE frames in a way the OpenAI endpoint doesn't. The toolStreaming = false workaround in copilot.ts (for the shim rejecting eager_input_streaming) makes agentic turns worse since the whole tool-call JSON arrives as one chunk.

I have a small Python script that measures inter-chunk gaps directly against the Copilot API — happy to share if it'd be useful for confirming.

Steps to reproduce

  1. Set provider to github-copilot, pick any Claude model (e.g. claude-sonnet-4.6)
  2. Send a prompt that produces a moderately long response
  3. Watch text arrive in bursts with noticeable pauses
  4. Switch to gpt-4o or gpt-5.4 on the same provider — streams without gaps

OpenCode version: 1.14.30
OS: macOS arm64
Terminal: Ghostty

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions