Skip to content

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

@llc1123

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

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions