[PR #6340] feat: add reasoning middleware #11844

Open
opened 2026-02-16 18:16:47 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/6340

State: open
Merged: No


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

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/6340 **State:** open **Merged:** No --- Closes #6337, #4033, #3703 --- Adds a new `interleaved` object shape to model config with `tagName` (required) and optional `startWithReasoning`. Read ai-sdk's [extractReasoningMiddleware()](https://ai-sdk.dev/docs/reference/ai-sdk-core/extract-reasoning-middleware#extractreasoningmiddleware) as a reference. Example config: ```jsonc "models": { "model-name": { "reasoning": true, "interleaved": { "tagName": "think" // or other XML tag // "startWithReasoning": true }, } } ``` --- Before (see issue) After: <img width="1728" height="1117" alt="Screenshot 2025-12-29 at 10 14 57" src="https://github.com/user-attachments/assets/c5f65eaa-2c83-4ce2-ba96-49d4627dd543" />
yindo added the pull-request label 2026-02-16 18:16:47 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11844