Skip to content

Why does opencode send reasoning_content in OpenAI-compatible messages, and why does it affect model output? #13130

@fqwtt

Description

@fqwtt

### Question

Hi maintainers, thanks for the project.

I noticed something confusing when opencode calls an LLM using an OpenAI-compatible chat/completions API: the request messages sometimes include a non-standard field named reasoning_content on an "assistant" message.

According to the OpenAI Chat Completions schema (and also the API docs of the model provider I’m using), reasoning_content is not a documented/standard field for messages[].assistant. However, in my testing, changing the text in reasoning_content clearly changes the model’s final response (e.g., switching the language of the response).

What I observed
opencode sends an assistant message with:
role: "assistant"
content: ""
tool_calls: [...]
reasoning_content: "..." ← undocumented field
If I intercept/modify the outgoing request and change reasoning_content (e.g., replace English with Chinese), the model’s next response language changes accordingly, as if reasoning_content is included in the prompt/context on the server side.
Example (request snippet)

{
  "role": "assistant",
  "content": "",
  "tool_calls": [
    {
      "id": "call_934ad9cd4aca4d5fb8468e16",
      "type": "function",
      "function": {
        "name": "skill",
        "arguments": "{\"name\":\"explain-code\"}"
      }
    }
  ],
  "reasoning_content": "…(text here)…"
}

Questions
Why does opencode add reasoning_content to messages?
Is this intentional (e.g., for debugging, tool-call tracing, chain-of-thought logging), or accidental?
What is the expected behavior across providers?

Any clarification would be appreciated.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions