Skip to content

fix(models): drop retired xAI models and mark multi-agent responses-only - #38510

Closed
msdianprince-7 wants to merge 1 commit into
BerriAI:litellm_internal_stagingfrom
msdianprince-7:xai_retire_grok_2_models
Closed

fix(models): drop retired xAI models and mark multi-agent responses-only#38510
msdianprince-7 wants to merge 1 commit into
BerriAI:litellm_internal_stagingfrom
msdianprince-7:xai_retire_grok_2_models

Conversation

@msdianprince-7

Copy link
Copy Markdown

TLDR

Problem this solves:

  • The registry advertises xAI models that no longer exist
  • Picking one gets a 404 from xAI, not a redirect
  • Multi-agent models are listed as chat models
  • xAI does not serve them on Chat Completions at all

How it solves it:

  • Remove the grok-2 family, grok-beta and grok-vision-beta
  • Mark both multi-agent models responses-only
  • Leave every model xAI still serves untouched

User Flow

Before: a developer browsing the gateway's xAI models picks one that xAI stopped serving, and only finds out at request time

  1. They open https://litellm-domain/ui/?page=models and see xai/grok-2, xai/grok-2-vision, xai/grok-beta and xai/grok-vision-beta offered with full pricing and a 131k context window
  2. They add xai/grok-2 to their config and send POST https://litellm-domain/v1/chat/completions
  3. The call fails with a 404 from xAI saying the model does not exist, and no amount of config fixes it
  4. They try xai/grok-4.20-multi-agent-0309, which the same page lists as a chat model, on POST https://litellm-domain/v1/chat/completions
  5. That fails too, because xAI serves the multi-agent models only on the Responses API

After: the list only offers models xAI still serves, and the multi-agent models are pointed at the right endpoint

  1. They open https://litellm-domain/ui/?page=models and the retired slugs are gone, so there is nothing dead to pick
  2. xai/grok-4.20-multi-agent-0309 now shows as a /v1/responses model rather than a chat model
  3. They send it to POST https://litellm-domain/v1/responses and it works
  4. xai/grok-4.3, xai/grok-4.6 and every other live xAI model are listed and priced exactly as before

Relevant issues

Fixes #38179

Linear ticket

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*, make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review (Greptile reviews automatically once the PR is opened; only comment @greptileai to re-request a review after pushing changes)

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

Sources

Screenshots / Proof of Fix

This is a registry-metadata change, so the user-visible surface is what the proxy reports for a configured deployment. Live proxy on localhost:4000, config:

model_list:
  - model_name: grok-2
    litellm_params: {model: xai/grok-2, api_key: fake-xai-key}
  - model_name: grok-beta
    litellm_params: {model: xai/grok-beta, api_key: fake-xai-key}
  - model_name: grok-multi-agent
    litellm_params: {model: xai/grok-4.20-multi-agent-0309, api_key: fake-xai-key}
  - model_name: grok-4-3
    litellm_params: {model: xai/grok-4.3, api_key: fake-xai-key}

general_settings:
  master_key: sk-qa-38179

Each case reads GET /model/info and prints the resolved model_info for one deployment:

curl -s http://localhost:4000/model/info -H 'Authorization: Bearer sk-qa-38179'

Before (cd63c7e)

retired slugs are priced as live chat models

  1. curl -s http://localhost:4000/model/info -H 'Authorization: Bearer sk-qa-38179'
  2. xai/grok-2: mode=chat input_cost_per_token=2e-06
  3. xai/grok-beta: mode=chat input_cost_per_token=5e-06

multi-agent advertised for chat completions

  1. curl -s http://localhost:4000/model/info -H 'Authorization: Bearer sk-qa-38179'
  2. xai/grok-4.20-multi-agent-0309: mode=chat supported_endpoints=None

a live xAI model

  1. curl -s http://localhost:4000/model/info -H 'Authorization: Bearer sk-qa-38179'
  2. xai/grok-4.3: mode=chat input_cost_per_token=1.25e-06

After (7a65f3a)

retired slugs are priced as live chat models

  1. curl -s http://localhost:4000/model/info -H 'Authorization: Bearer sk-qa-38179'
  2. xai/grok-2: mode=None input_cost_per_token=0
  3. xai/grok-beta: mode=None input_cost_per_token=0
  4. The registry no longer claims these are live chat models

multi-agent advertised for chat completions

  1. curl -s http://localhost:4000/model/info -H 'Authorization: Bearer sk-qa-38179'
  2. xai/grok-4.20-multi-agent-0309: mode=responses supported_endpoints=['/v1/responses']

a live xAI model

  1. curl -s http://localhost:4000/model/info -H 'Authorization: Bearer sk-qa-38179'
  2. xai/grok-4.3: mode=chat input_cost_per_token=1.25e-06, unchanged

No request is sent to xAI here, since I have no xAI key and the retired slugs would only return the 404 the issue already reports.

Type

🐛 Bug Fix

Caveats (if any)

Medium

  • Anyone still naming a removed slug loses its cost-map entry, so spend logs for it read 0
    • The call itself already fails at xAI, so there is no real spend to lose
    • Reinstating an entry is the fix if xAI ever brings a slug back

Low

  • Removed rather than dated, because xAI published no retirement date for these
    • This repo reverts unverified deprecation dates, see 30b1459
    • xai/grok-2-vision-1212 did already carry deprecation_date: 2026-02-28; if maintainers would rather mark the family than remove it, that is the date to apply
  • litellm/constants.py still lists Clarifai-hosted grok-2 slugs, deliberately left alone since Clarifai serves those independently of xAI
  • Two older tests still use retired slugs as fixture strings; they exercise provider routing and param mapping, never the cost map, so they are untouched and still pass

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

xAI no longer serves the grok-2 family, grok-beta or grok-vision-beta. They are
absent from https://docs.x.ai/docs/models and requests to them 404 rather than
redirecting the way the May 15 retirements do, so the registry was advertising
models nobody can call. No retirement date was ever published for them, and this
repo reverts unverified deprecation dates, so they are removed rather than dated.

xAI documents that the multi-agent models do not work with the OpenAI Chat
Completions API, so grok-4.20-multi-agent-0309 and grok-4.20-multi-agent-beta-0309
are marked responses-only instead of chat.

Fixes BerriAI#38179
@greptile-apps

greptile-apps Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR removes eight retired xAI model entries from both model registries and marks two xAI multi-agent models as Responses-only. It adds regression coverage for removals, endpoint metadata, surviving chat models, and registry synchronization.

Confidence Score: 4/5

The PR appears safe to merge, with only non-blocking typing and comment-policy cleanup needed in the new tests.

The xAI Responses path has a registered native adapter and both registries remain synchronized; the only accepted concern is imprecise test typing and unnecessary explanatory comments.

Files Needing Attention: tests/test_litellm/llms/xai/test_xai_model_registry.py

Important Files Changed

Filename Overview
model_prices_and_context_window.json Removes retired xAI entries and correctly aligns both multi-agent entries with the native Responses endpoint.
litellm/model_prices_and_context_window_backup.json Mirrors the primary registry changes without xAI metadata drift.
tests/test_litellm/llms/xai/test_xai_model_registry.py Adds meaningful registry regression coverage but violates repository typing and comment conventions.

Reviews (1): Last reviewed commit: "fix(models): drop retired xAI models and..." | Re-trigger Greptile



@pytest.fixture(scope="module", params=[p.name for p in MAP_PATHS])
def cost_map(request: pytest.FixtureRequest) -> dict:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Coarse test annotations

The new fixture and three tests use bare dict annotations, reducing static type checking, while the explanatory comments on the model tuples fall outside the repository's source-comment convention. Please use precise map types and remove the unnecessary comments.

Context Used: CLAUDE.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@codecov

codecov Bot commented Aug 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Closing in favor of the rolling registry PR #38207, which now removes these retired xAI entries and carries the multi-agent Responses-only metadata and registry test

@codspeed-hq

codspeed-hq Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing msdianprince-7:xai_retire_grok_2_models (7a65f3a) with litellm_internal_staging (8ebcb3e)1

Open in CodSpeed

Footnotes

  1. No successful run was found on litellm_internal_staging (cd63c7e) during the generation of this report, so 8ebcb3e was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

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.

[Bug]: xAI models can't use

1 participant