Use split token display for xAI models#48719
Merged
benbrandt merged 2 commits intozed-industries:mainfrom Mar 17, 2026
Merged
Conversation
maxdeviant
reviewed
Feb 19, 2026
Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
04c436a to
a267f20
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split token display for xAI
Extends the split input/output token display (introduced in #46829 for OpenAI) to all xAI models.
Instead of the combined
48k / 1Mtoken counter, xAI models now show:Before
After
Changes
supports_split_token_display()to returntrueonXAiLanguageModel. All built-in Grok models already implementmax_output_tokens(), so no additional plumbing was needed.XAito thematches!pattern inCloudLanguageModel::supports_split_token_display()so cloud-routed xAI models also get the split display.Tests
test_xai_supports_split_token_display— Verifies all built-in Grok model variants returntruefor split token display.test_xai_models_have_max_output_tokens— Validates all built-in Grok models reportmax_output_tokensthat isSome, positive, and less thanmax_token_count(required for the UI to compute the input token limit).test_split_token_display_supported_providers— Confirms the cloud provider match pattern includesOpenAiandXAiwhile excludingAnthropicandGoogle.Release Notes: