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.
Description
The
applyCachingfunction intransform.tsusesmodel.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 differentproviderID.Current behavior
For a model configured as:
Cache control is incorrectly placed at the content part level instead of the message level.
Expected behavior
Detection should be based on
model.api.npmto correctly identify Anthropic SDK usage:Impact
Non-Claude models using
@ai-sdk/anthropicmay not have cache control applied correctly.