Skip to content

Use split token display for xAI models#48719

Merged
benbrandt merged 2 commits intozed-industries:mainfrom
anilpai:split-token-display-xai
Mar 17, 2026
Merged

Use split token display for xAI models#48719
benbrandt merged 2 commits intozed-industries:mainfrom
anilpai:split-token-display-xai

Conversation

@anilpai
Copy link
Copy Markdown
Contributor

@anilpai anilpai commented Feb 8, 2026

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 / 1M token counter, xAI models now show:

  • input tokens used / input token limit
  • output tokens used / output token limit

Before

Screenshot 2026-02-08 at 11 07 13 AM

After

Screenshot 2026-02-08 at 11 05 36 AM

Changes

  • x_ai.rs — Override supports_split_token_display() to return true on XAiLanguageModel. All built-in Grok models already implement max_output_tokens(), so no additional plumbing was needed.
  • cloud.rs — Add XAi to the matches! pattern in CloudLanguageModel::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 return true for split token display.
  • test_xai_models_have_max_output_tokens — Validates all built-in Grok models report max_output_tokens that is Some, positive, and less than max_token_count (required for the UI to compute the input token limit).
  • test_split_token_display_supported_providers — Confirms the cloud provider match pattern includes OpenAi and XAi while excluding Anthropic and Google.

Release Notes:

  • Changed the display of tokens for xAI models to reflect the input/output limits.

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Feb 8, 2026
@SomeoneToIgnore SomeoneToIgnore added the area:ai Related to Agent Panel, Edit Prediction, Copilot, or other AI features label Feb 8, 2026
@maxdeviant maxdeviant changed the title Enhance split token display support for XAi models Enhance split token display support for xAI models Feb 8, 2026
@maxdeviant maxdeviant changed the title Enhance split token display support for xAI models Use split token display for xAI models Feb 8, 2026
@benbrandt benbrandt assigned benbrandt and mikayla-maki and unassigned benbrandt Feb 12, 2026
anilpai and others added 2 commits March 17, 2026 11:33
@benbrandt benbrandt force-pushed the split-token-display-xai branch from 04c436a to a267f20 Compare March 17, 2026 10:34
@benbrandt benbrandt enabled auto-merge (squash) March 17, 2026 10:34
@benbrandt benbrandt merged commit a777605 into zed-industries:main Mar 17, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ai Related to Agent Panel, Edit Prediction, Copilot, or other AI features cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants