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

Open
opened 2026-02-16 18:11:33 -05:00 by yindo · 1 comment
Owner

Originally created by @fqwtt on GitHub (Feb 11, 2026).

Originally assigned to: @thdxr on GitHub.

### 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.

Originally created by @fqwtt on GitHub (Feb 11, 2026). Originally assigned to: @thdxr on GitHub. `###` 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.
Author
Owner

@github-actions[bot] commented on GitHub (Feb 11, 2026):

Thanks for the detailed question! This is related to #13002, which discusses similar issues with reasoning fields (reasoning_details) being included in API requests. You may find additional context there about how OpenCode handles reasoning content across different providers.

@github-actions[bot] commented on GitHub (Feb 11, 2026): Thanks for the detailed question! This is related to #13002, which discusses similar issues with reasoning fields (`reasoning_details`) being included in API requests. You may find additional context there about how OpenCode handles reasoning content across different providers.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9067