Skip to content

Interleaved reasoning_content lost for non-Claude models on Anthropic SDK #14638

Closed as not planned

Description

@llc1123

Description

When non-Claude models (e.g. kimi-k2.5) are configured via the Anthropic SDK (@ai-sdk/anthropic) with interleaved reasoning capability, reasoning content from previous assistant turns is silently dropped in subsequent requests.

The root cause is that the Anthropic SDK only knows how to serialize thinking blocks — it has no concept of a top-level reasoning_content field on assistant messages. So when opencode replays prior assistant messages that contain reasoning parts, the SDK discards them and the upstream API never receives the reasoning history.

Steps to reproduce

  1. Configure a non-Claude model (e.g. kimi-k2.5) using @ai-sdk/anthropic provider
  2. Enable thinking/reasoning
  3. Have a multi-turn conversation where the model produces reasoning content
  4. Observe that on subsequent turns, the prior reasoning content is missing from the request sent to the API

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Feb 22, 2026
  2. github-actions commented on Feb 22, 2026

    @github-actions
    Contributor

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

    The root cause described here (Anthropic SDK only serializing thinking blocks and dropping reasoning_content) may be a distinct variant, but the underlying problem domain overlaps significantly.

  3. zwhe99 commented on Apr 11, 2026

    @zwhe99

    I’m also running into this issue. Any updates on this?

  4. llc1123 commented on Apr 11, 2026

    @llc1123
    Author

    I’m also running into this issue. Any updates on this?

    Just use @ai-sdk/openai-compatible.

  5. assigned and unassigned on Apr 26, 2026
  6. removed
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  7. github-actions commented on Jul 4, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 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