-
-
Notifications
You must be signed in to change notification settings - Fork 11.6k
feat(xai): cherry-pick grok-4.3 model entries onto main (#27154) #27396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| import json | ||
| from pathlib import Path | ||
|
|
||
| import pytest | ||
|
|
||
| from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("model", ["xai/grok-4.3", "xai/grok-4.3-latest"]) | ||
| def test_xai_grok_4_3_model_info(model): | ||
| json_path = Path(__file__).parents[2] / "model_prices_and_context_window.json" | ||
| with open(json_path) as f: | ||
| model_cost = json.load(f) | ||
|
|
||
| info = model_cost.get(model) | ||
| assert ( | ||
| info is not None | ||
| ), f"{model} not found in model_prices_and_context_window.json" | ||
|
|
||
| assert info["litellm_provider"] == "xai" | ||
| assert info["mode"] == "chat" | ||
|
|
||
| assert info["input_cost_per_token"] == 1.25e-06 | ||
| assert info["output_cost_per_token"] == 2.5e-06 | ||
| assert info["cache_read_input_token_cost"] == 2e-07 | ||
|
|
||
| assert info["input_cost_per_token_above_200k_tokens"] == 2.5e-06 | ||
| assert info["output_cost_per_token_above_200k_tokens"] == 5e-06 | ||
| assert info["cache_read_input_token_cost_above_200k_tokens"] == 4e-07 | ||
|
|
||
| assert info["max_input_tokens"] == 1000000 | ||
| assert info["max_output_tokens"] == 1000000 | ||
| assert info["max_tokens"] == 1000000 | ||
|
|
||
| assert info["supports_function_calling"] is True | ||
| assert info["supports_prompt_caching"] is True | ||
| assert info["supports_reasoning"] is True | ||
| assert info["supports_response_schema"] is True | ||
| assert info["supports_tool_choice"] is True | ||
| assert info["supports_vision"] is True | ||
| assert info["supports_web_search"] is True | ||
|
|
||
| routed_model, provider, _, _ = get_llm_provider(model=model) | ||
| assert routed_model == model.split("/", 1)[1] | ||
| assert provider == "xai" | ||
|
|
||
|
|
||
| def test_xai_grok_4_3_backup_matches_main(): | ||
| """Ensure the bundled model cost map stays in sync with the canonical file.""" | ||
| repo_root = Path(__file__).parents[2] | ||
| main_path = repo_root / "model_prices_and_context_window.json" | ||
| backup_path = repo_root / "litellm" / "model_prices_and_context_window_backup.json" | ||
|
|
||
| with open(main_path) as f: | ||
| main_cost = json.load(f) | ||
| with open(backup_path) as f: | ||
| backup_cost = json.load(f) | ||
|
|
||
| for model in ("xai/grok-4.3", "xai/grok-4.3-latest"): | ||
| assert backup_cost.get(model) == main_cost.get( | ||
| model | ||
| ), f"{model} differs between main and backup model cost maps" |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
grok-latestalias entryxAI's published model page lists three aliases for this model:
grok-4.3-latest, andgrok-latest(alongside the canonicalgrok-4.3). This PR adds the first two but omitsxai/grok-latest. Users who callxai/grok-latest(mirroring the provider alias) will get a model-not-found error. Consider adding the third alias entry with identical pricing/capabilities, or document the decision to skip it.