Description
Bug description
I encountered an issue while integrating the xAI Grok provider. When calling streamText(), the returned usage object has promptTokens, completionTokens, and totalTokens all set to NaN. Here is my code:
import { xai } from '@ai-sdk/xai';
import { streamText } from 'ai';
streamText({
model: xai('grok-3-mini-beta'),
messages: [{
role: 'user',
content: 'who are you'
}],
onFinish: async ({ usage }) => {
console.log('Usage:', usage);
},
}
Returns
Usage: {promptTokens: NaN, completionTokens: NaN, totalTokens: NaN}
Info about my ai sdk version
"ai": "^4.3.5",
"@ai-sdk/xai": "^1.2.11",
Description
Bug description
I encountered an issue while integrating the
xAI Grok provider. When callingstreamText(), the returned usage object has promptTokens, completionTokens, and totalTokens all set toNaN. Here is my code:Returns
Info about my ai sdk version