opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat: add reasoning middleware

Open snipeship opened this issue 3 weeks ago • 6 comments

Closes #6337, #4033, #3703


Adds a new interleaved object shape to model config with tagName (required) and optional startWithReasoning. Read ai-sdk's extractReasoningMiddleware() as a reference.

Example config:

"models": {
  "model-name": {
    "reasoning": true,
    "interleaved": {
      "tagName": "think" // or other XML tag
      // "startWithReasoning": true
    },
  }
}

Before (see issue)

After: Screenshot 2025-12-29 at 10 14 57

snipeship avatar Dec 29 '25 08:12 snipeship