@ai-sdk/anthropic 3.0.28 → 3.0.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/anthropic",
3
- "version": "3.0.28",
3
+ "version": "3.0.30",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -1165,6 +1165,7 @@ export const anthropicMessagesChunkSchema = lazySchema(() =>
1165
1165
  input_tokens: z.number().nullish(),
1166
1166
  output_tokens: z.number(),
1167
1167
  cache_creation_input_tokens: z.number().nullish(),
1168
+ cache_read_input_tokens: z.number().nullish(),
1168
1169
  }),
1169
1170
  }),
1170
1171
  z.object({
@@ -1947,6 +1947,17 @@ export class AnthropicMessagesLanguageModel implements LanguageModelV3 {
1947
1947
  }
1948
1948
  usage.output_tokens = value.usage.output_tokens;
1949
1949
 
1950
+ if (value.usage.cache_read_input_tokens != null) {
1951
+ usage.cache_read_input_tokens =
1952
+ value.usage.cache_read_input_tokens;
1953
+ }
1954
+ if (value.usage.cache_creation_input_tokens != null) {
1955
+ usage.cache_creation_input_tokens =
1956
+ value.usage.cache_creation_input_tokens;
1957
+ cacheCreationInputTokens =
1958
+ value.usage.cache_creation_input_tokens;
1959
+ }
1960
+
1950
1961
  finishReason = {
1951
1962
  unified: mapAnthropicStopReason({
1952
1963
  finishReason: value.delta.stop_reason,
@@ -24,7 +24,7 @@ export function convertAnthropicMessagesUsage(
24
24
  },
25
25
  outputTokens: {
26
26
  total: outputTokens,
27
- text: outputTokens,
27
+ text: undefined,
28
28
  reasoning: undefined,
29
29
  },
30
30
  raw: usage,