mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-03 02:22:24 +00:00
feat(oci): add xai.grok-4.3 model metadata
Oracle Cloud Infrastructure Generative AI service has launched the xAI Grok 4.3 model (reasoning model, 1M-token context window shared between prompt and response, knowledge cutoff December 2025). The model id `xai.grok-4.3` is already listed as a supported model in the OCI provider docs (litellm-docs PR #197, merged 2026-05-23), but the model cost catalog has no entry for it, so it does not appear in the proxy UI "Add Model" dropdown and spend is attributed to the default rate. Add cost + capability metadata for `oci/xai.grok-4.3` so the UI surfaces the model and `litellm.cost_calculator` attributes spend accurately. Pricing is taken from the Oracle public pricing API (apexapps.oracle.com/pls/apex/cetools/api/v1/products/, PAY_AS_YOU_GO SKUs B112080-B112085): - input: $1.25 / 1M tokens (<=200k), $2.50 / 1M tokens (>200k) - output: $2.50 / 1M tokens (<=200k), $5.00 / 1M tokens (>200k) - cached: $0.20 / 1M tokens (<=200k), $0.40 / 1M tokens (>200k) Capability flags follow the OCI Grok 4.3 model documentation (https://docs.oracle.com/en-us/iaas/Content/generative-ai/xai-grok-4-3.htm): - function_calling: yes ("Function Calling: Yes, through the API.") - vision: yes ("Multimodal support: Input text and images and get a text output.") - prompt_caching: yes ("Cached Input Tokens: Yes") - reasoning: yes ("reasoning model designed for complex … tasks") - response_schema: false (consistent with existing OCI Grok entries) Context window: - 1,000,000 tokens shared between prompt + response ("Context Length: 1 million tokens (maximum prompt + response length is 1 million tokens for keeping the context).") - The playground caps a single response at 131,000 tokens, but the API has no separate output-only limit beyond the shared context. So max_input_tokens / max_output_tokens / max_tokens are all set to 1,000,000, matching the xai/grok-4.3 catalog entry pattern. Tests follow the pattern from #27154 (xai/grok-4.3 entry). Signed-off-by: BobDu <i@bobdu.cc>
This commit is contained in:
parent
4148667671
commit
18c794908b
3 changed files with 90 additions and 0 deletions
|
|
@ -26296,6 +26296,25 @@
|
|||
"supports_function_calling": true,
|
||||
"supports_response_schema": false
|
||||
},
|
||||
"oci/xai.grok-4.3": {
|
||||
"cache_read_input_token_cost": 2e-07,
|
||||
"cache_read_input_token_cost_above_200k_tokens": 4e-07,
|
||||
"input_cost_per_token": 1.25e-06,
|
||||
"input_cost_per_token_above_200k_tokens": 2.5e-06,
|
||||
"litellm_provider": "oci",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 1000000,
|
||||
"max_tokens": 1000000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 2.5e-06,
|
||||
"output_cost_per_token_above_200k_tokens": 5e-06,
|
||||
"source": "https://docs.oracle.com/en-us/iaas/Content/generative-ai/xai-grok-4-3.htm",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_response_schema": false,
|
||||
"supports_vision": true
|
||||
},
|
||||
"oci/xai.grok-code-fast-1": {
|
||||
"input_cost_per_token": 5e-06,
|
||||
"litellm_provider": "oci",
|
||||
|
|
|
|||
|
|
@ -26438,6 +26438,25 @@
|
|||
"supports_function_calling": true,
|
||||
"supports_response_schema": false
|
||||
},
|
||||
"oci/xai.grok-4.3": {
|
||||
"cache_read_input_token_cost": 2e-07,
|
||||
"cache_read_input_token_cost_above_200k_tokens": 4e-07,
|
||||
"input_cost_per_token": 1.25e-06,
|
||||
"input_cost_per_token_above_200k_tokens": 2.5e-06,
|
||||
"litellm_provider": "oci",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 1000000,
|
||||
"max_tokens": 1000000,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 2.5e-06,
|
||||
"output_cost_per_token_above_200k_tokens": 5e-06,
|
||||
"source": "https://docs.oracle.com/en-us/iaas/Content/generative-ai/xai-grok-4-3.htm",
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_response_schema": false,
|
||||
"supports_vision": true
|
||||
},
|
||||
"oci/xai.grok-code-fast-1": {
|
||||
"input_cost_per_token": 5e-06,
|
||||
"litellm_provider": "oci",
|
||||
|
|
|
|||
52
tests/test_litellm/test_oci_xai_grok_4_3_model_metadata.py
Normal file
52
tests/test_litellm/test_oci_xai_grok_4_3_model_metadata.py
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
import json
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def test_oci_xai_grok_4_3_model_info():
|
||||
json_path = Path(__file__).parents[2] / "model_prices_and_context_window.json"
|
||||
with open(json_path) as f:
|
||||
model_cost = json.load(f)
|
||||
|
||||
model = "oci/xai.grok-4.3"
|
||||
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"] == "oci"
|
||||
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_vision"] is True
|
||||
assert info["supports_prompt_caching"] is True
|
||||
assert info["supports_reasoning"] is True
|
||||
assert info["supports_response_schema"] is False
|
||||
|
||||
|
||||
def test_oci_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)
|
||||
|
||||
model = "oci/xai.grok-4.3"
|
||||
assert backup_cost.get(model) == main_cost.get(
|
||||
model
|
||||
), f"{model} differs between main and backup model cost maps"
|
||||
Loading…
Add table
Reference in a new issue