🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@ai-sdk/anthropic

Package Overview
Dependencies
Maintainers
3
Versions
547
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ai-sdk/anthropic - npm Package Compare versions

Comparing version
3.0.102
to
3.0.103
+6
-0
CHANGELOG.md
# @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