Skip to content

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

Closed

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.

Activity

  1. github-actions commented on Feb 11, 2026

    @github-actions
    Contributor

    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.

  2. github-actions commented on Apr 13, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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