Description
I noticed that grok-4-fast-reasoning would result in a negative number in the usage field. I logged a request, here is the raw:
"{"prompt_tokens":279,"completion_tokens":6,"total_tokens":374,"prompt_tokens_details":{"text_tokens":279,"audio_tokens":0,"image_tokens":0,"cached_tokens":149},"completion_tokens_details":{"reasoning_tokens":89,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}}"
In the usage field, we end up with "-83" text_output_tokens which is the 6 completion tokens minus the 89 reasoning tokens. Shouldn't this actually be 6, text_output_tokens, 89 reasoning tokens, and 95 total output tokens?
AI SDK Version
"ai": "^6.0.3",
"@ai-sdk/xai": "3.0.1",
Code of Conduct
Description
I noticed that grok-4-fast-reasoning would result in a negative number in the
usagefield. I logged a request, here is the raw:"{"prompt_tokens":279,"completion_tokens":6,"total_tokens":374,"prompt_tokens_details":{"text_tokens":279,"audio_tokens":0,"image_tokens":0,"cached_tokens":149},"completion_tokens_details":{"reasoning_tokens":89,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}}"
In the
usagefield, we end up with "-83" text_output_tokens which is the 6 completion tokens minus the 89 reasoning tokens. Shouldn't this actually be 6, text_output_tokens, 89 reasoning tokens, and 95 total output tokens?AI SDK Version
"ai": "^6.0.3",
"@ai-sdk/xai": "3.0.1",
Code of Conduct