Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

@ai-sdk/xai

Package Overview
Dependencies
Maintainers
3
Versions
307
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ai-sdk/xai - npm Package Compare versions

Comparing version
3.0.55
to
3.0.56
+6
-0
CHANGELOG.md
# @ai-sdk/xai
## 3.0.56
### Patch Changes
- 7ccb902: fix(provider/xai): handle inconsistent cached token reporting
## 3.0.55

@@ -4,0 +10,0 @@

+3
-3
{
"name": "@ai-sdk/xai",
"version": "3.0.55",
"version": "3.0.56",
"license": "Apache-2.0",

@@ -33,4 +33,4 @@ "sideEffects": false,

"@ai-sdk/openai-compatible": "2.0.30",
"@ai-sdk/provider": "3.0.8",
"@ai-sdk/provider-utils": "4.0.15"
"@ai-sdk/provider-utils": "4.0.15",
"@ai-sdk/provider": "3.0.8"
},

@@ -37,0 +37,0 @@ "devDependencies": {

@@ -9,6 +9,12 @@ import { LanguageModelV3Usage } from '@ai-sdk/provider';

const promptTokensIncludesCached = cacheReadTokens <= usage.prompt_tokens;
return {
inputTokens: {
total: usage.prompt_tokens,
noCache: usage.prompt_tokens - cacheReadTokens,
total: promptTokensIncludesCached
? usage.prompt_tokens
: usage.prompt_tokens + cacheReadTokens,
noCache: promptTokensIncludesCached
? usage.prompt_tokens - cacheReadTokens
: usage.prompt_tokens,
cacheRead: cacheReadTokens,

@@ -15,0 +21,0 @@ cacheWrite: undefined,

@@ -10,6 +10,12 @@ import { LanguageModelV3Usage } from '@ai-sdk/provider';

const inputTokensIncludesCached = cacheReadTokens <= usage.input_tokens;
return {
inputTokens: {
total: usage.input_tokens,
noCache: usage.input_tokens - cacheReadTokens,
total: inputTokensIncludesCached
? usage.input_tokens
: usage.input_tokens + cacheReadTokens,
noCache: inputTokensIncludesCached
? usage.input_tokens - cacheReadTokens
: usage.input_tokens,
cacheRead: cacheReadTokens,

@@ -16,0 +22,0 @@ cacheWrite: undefined,

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