Skip to content

reasoning field from Ollama's OpenAI-compatible endpoint is not rendered as a separate thinking block for gpt-oss:20b #45547

Closed as duplicate

Description

@Djjamonconqueso

Description

When using OpenCode with a custom @ai-sdk/openai-compatible provider pointing to a local Ollama server, the reasoning field returned by gpt-oss:20b is not rendered in the collapsible "thinking" UI block. Instead, the reasoning text appears mixed inline with the final response text in the chat.

This is not a case of the upstream provider failing to separate the fields — Ollama returns content and reasoning cleanly separated (see proof below). The issue appears to be on OpenCode's side, in how it consumes/renders the reasoning field for this provider setup.

Config used (opencode.json):

json
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"ollama": {
"npm": "@ai-sdk/openai-compatible",
"name": "Ollama (local)",
"options": { "baseURL": "http://localhost:11434/v1" },
"models": {
"gpt-oss:20b": { "name": "GPT-OSS 20B" }
}
}
}
}

Proof that Ollama returns content/reasoning correctly separated (direct curl against Ollama, bypassing OpenCode entirely):

bash
curl -s http://localhost:11434/v1/chat/completions
-H "Content-Type: application/json"
-d '{"model":"gpt-oss:20b","messages":[{"role":"user","content":"tell me a joke"}]}' | jq
json
{
"choices": [{
"message": {
"role": "assistant",
"content": "Why did the book go to the hospital?\n\nBecause it had an upset stomach. 📚🤒",
"reasoning": "User wants a joke. I should give a short, funny joke. ..."
},
"finish_reason": "stop"
}]
}

Both content and reasoning are present and cleanly separated at the Ollama level. OpenCode should render reasoning in the collapsible thinking UI, but instead it ends up mixed into the visible response text (see screenshot).

Image

Plugins

none

OpenCode version

1.18.23

Steps to reproduce

1.Configure the provider as shown above (Ollama's OpenAI-compatible endpoint via @ai-sdk/openai-compatible).
2.Select gpt-oss:20b as the model.
3.Send any prompt (e.g. "tell me a joke").
3.Observe: the reasoning text appears prepended/mixed into the response, not in a separate collapsible block.

Screenshot and/or share link

No response

Operating System

Omarchy

Terminal

ghostty

Activity

  1. github-actions commented on Aug 27, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If your issue is distinct from all of the above, please add a note explaining how it differs so maintainers can triage it separately.

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