@ai-sdk/anthropic
Advanced tools
+6
-0
| # @ai-sdk/anthropic | ||
| ## 3.0.103 | ||
| ### Patch Changes | ||
| - 7865a71: fix(anthropic): report thinking tokens as reasoning token usage | ||
| ## 3.0.102 | ||
@@ -4,0 +10,0 @@ |
+1
-1
| { | ||
| "name": "@ai-sdk/anthropic", | ||
| "version": "3.0.102", | ||
| "version": "3.0.103", | ||
| "license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
@@ -941,2 +941,7 @@ import type { JSONSchema7 } from '@ai-sdk/provider'; | ||
| output_tokens: z.number(), | ||
| output_tokens_details: z | ||
| .object({ | ||
| thinking_tokens: z.number().nullish(), | ||
| }) | ||
| .nullish(), | ||
| cache_creation_input_tokens: z.number().nullish(), | ||
@@ -1420,2 +1425,7 @@ cache_read_input_tokens: z.number().nullish(), | ||
| output_tokens: z.number(), | ||
| output_tokens_details: z | ||
| .object({ | ||
| thinking_tokens: z.number().nullish(), | ||
| }) | ||
| .nullish(), | ||
| cache_creation_input_tokens: z.number().nullish(), | ||
@@ -1422,0 +1432,0 @@ cache_read_input_tokens: z.number().nullish(), |
@@ -31,2 +31,5 @@ import type { JSONObject, LanguageModelV3Usage } from '@ai-sdk/provider'; | ||
| output_tokens: number; | ||
| output_tokens_details?: { | ||
| thinking_tokens?: number | null; | ||
| } | null; | ||
| cache_creation_input_tokens?: number | null; | ||
@@ -54,2 +57,4 @@ cache_read_input_tokens?: number | null; | ||
| const cacheReadTokens = usage.cache_read_input_tokens ?? 0; | ||
| const reasoningTokens = | ||
| usage.output_tokens_details?.thinking_tokens ?? undefined; | ||
@@ -106,4 +111,5 @@ // When iterations is present (compaction or advisor), sum across executor | ||
| total: outputTokens, | ||
| text: undefined, | ||
| reasoning: undefined, | ||
| text: | ||
| reasoningTokens == null ? undefined : outputTokens - reasoningTokens, | ||
| reasoning: reasoningTokens, | ||
| }, | ||
@@ -110,0 +116,0 @@ raw: rawUsage ?? usage, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
3337097
0.22%35496
0.17%