Skip to content

OpenAI-compatible reasoning streamed under reasoning field is dropped #35283

Description

@mickaeldamatha

Description

When an OpenAI-compatible provider streams its chain-of-thought under a reasoning delta field (instead of reasoning_content), opencode drops it entirely — no reasoning surfaces even though the provider is sending it.

The OpenAI Chat delta schema in packages/llm/src/protocols/openai-chat.ts only declares reasoning_content. Each SSE chunk is decoded with Protocol.jsonEventSchema.fromJsonString, which strips any key not on the struct, so reasoning is gone before step() ever runs.

I ran into this with Scaleway. It also affects self-hosted vLLM / SGLang deployments and OpenRouter's reasoning field.

Steps to reproduce

  1. Configure an openai-compatible provider that emits reasoning under reasoning (e.g. Scaleway with a reasoning model).
  2. Send a prompt that triggers reasoning.
  3. The answer streams fine, but no reasoning is shown — even though the raw SSE chunks contain delta.reasoning.

OpenCode version

1.17.12

Operating System

macOS 26 (Darwin 25.5.0)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions