Skip to content

Cache control injection uses wrong detection for Anthropic SDK models #14642

Closed

Description

@llc1123

Description

The applyCaching function in transform.ts uses model.providerID === "anthropic" to determine whether to use message-level cache control options. This is incorrect for non-Claude models (e.g. kimi-k2.5) that use the Anthropic SDK but have a different providerID.

Current behavior

const useMessageLevelOptions = model.providerID === "anthropic" || model.providerID.includes("bedrock")

For a model configured as:

{
  providerID: "kimi",
  api: { npm: "@ai-sdk/anthropic", ... }
}

Cache control is incorrectly placed at the content part level instead of the message level.

Expected behavior

Detection should be based on model.api.npm to correctly identify Anthropic SDK usage:

const isAnthropicSdk = model.api.npm === "@ai-sdk/anthropic" || model.api.npm === "@ai-sdk/google-vertex/anthropic"
const useMessageLevelOptions = isAnthropicSdk || model.providerID.includes("bedrock")

Impact

Non-Claude models using @ai-sdk/anthropic may not have cache control applied correctly.

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:

    If your issue is distinct from these, please clarify how it differs so it can be tracked separately.

  3. added a commit that references this issue on Mar 13, 2026
    2d82524
  4. github-actions commented on Apr 24, 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

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

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions