Skip to content

Conversation

@shaper
Copy link
Collaborator

@shaper shaper commented Jan 3, 2026

Background

Developers need insight into cached input token usage. The x.ai responses api implementation is not currently including the metrics in usage data.

Summary

Extract cached input token usage from the x.ai response and propagate it in the AI SDK usage record.

Manual Verification

Ran the existing x.ai example scripts with grok-4.1-fast-reasoning and observed cached input token presence in usage.

Checklist

  • Tests have been added / updated (for bug fixes / features)
  • Documentation has been added / updated (for bug fixes / features)
  • A patch changeset for relevant packages has been added (for bug fixes / features - run pnpm changeset in the project root)
  • I have reviewed this pull request (self-review)

@shaper shaper requested review from dancer and gr2m January 3, 2026 05:38
@shaper shaper marked this pull request as ready for review January 3, 2026 05:38
@shaper shaper merged commit 08bffe4 into release-v5.0 Jan 6, 2026
18 checks passed
@shaper shaper deleted the shaper/pr/xai-usage-cached-v5 branch January 6, 2026 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants