xai-org / grok-1

Grok open release
Apache License 2.0
49.65k stars 8.33k forks source link

[xAI API] Anthopic SDK doesn't report usage #399

Open KernelDeimos opened 1 week ago

KernelDeimos commented 1 week ago

This is an xAI API question, but I don't know where else to ask this because there's no help center, community support forums, Discord server, or any such thing as far as I can tell.

According to the documentation, or what little there is of that, xAI is "fully compatible" with the Anthropic SDK.

When streaming, unlike Claude through the same SDK, the output tokens count is not available. I was able to get this information from openai, claude, mistral, together-ai, and groq, without much of a hassle. I can't seem to find a way to get xAI to do the same. What am I missing?

zhaohan-dong commented 12 hours ago

@KernelDeimos We're aware of the issue and fixing it. In the meantime you can use curl or OpenAI SDK which would provide the output tokens count.

You can reach out to our support email at support@x.ai

KernelDeimos commented 5 hours ago

Yep, I switched Puter's xAI service to OpenAI's SDK and it's working great.