Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(registry): correct xai retired slug pricing, bedrock grok caching, and unsourced entries

mateo-berri2bd7b5864023
diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json
index 20ce49f37d2..e113a476ac7 100644
--- a/litellm/model_prices_and_context_window_backup.json
+++ b/litellm/model_prices_and_context_window_backup.json
@@ -20597,51 +20597,6 @@
},
"gemini_native_audio": true
},
- "gemini/gemini-live-2.5-flash-native-audio": {
- "input_cost_per_audio_token": 3e-06,
- "input_cost_per_token": 5e-07,
- "litellm_provider": "gemini",
- "max_input_tokens": 1048576,
- "max_output_tokens": 65535,
- "max_tokens": 65535,
- "mode": "realtime",
- "output_cost_per_audio_token": 1.2e-05,
- "output_cost_per_token": 2e-06,
- "source": "https://ai.google.dev/gemini-api/docs/pricing",
- "supported_endpoints": [
- "/v1/realtime"
- ],
- "supported_modalities": [
- "text",
- "image",
- "audio",
- "video"
- ],
- "supported_output_modalities": [
- "text",
- "audio"
- ],
- "supports_audio_input": true,
- "supports_audio_output": true,
- "supports_function_calling": true,
- "supports_parallel_function_calling": true,
- "supports_pdf_input": true,
- "supports_prompt_caching": true,
- "supports_response_schema": true,
- "supports_system_messages": true,
- "supports_tool_choice": true,
- "supports_url_context": true,
- "supports_vision": true,
- "supports_web_search": true,
- "search_context_cost_per_query": {
- "search_context_size_low": 0.035,
- "search_context_size_medium": 0.035,
- "search_context_size_high": 0.035
- },
- "gemini_native_audio": true,
- "rpm": 100000,
- "tpm": 8000000
- },
"gemini-live-2.5-flash-preview-native-audio-09-2025": {
"cache_read_input_token_cost": 7.5e-08,
"input_cost_per_audio_token": 3e-06,
@@ -44168,52 +44123,64 @@
"cache_read_input_token_cost_above_200k_tokens": 4e-07
},
"xai/grok-3-beta": {
- "cache_read_input_token_cost": 7.5e-07,
- "input_cost_per_token": 3e-06,
+ "cache_read_input_token_cost": 2e-07,
+ "input_cost_per_token": 1.25e-06,
"litellm_provider": "xai",
"max_input_tokens": 131072,
"max_output_tokens": 131072,
"max_tokens": 131072,
"mode": "chat",
- "output_cost_per_token": 1.5e-05,
+ "output_cost_per_token": 2.5e-06,
"source": "https://x.ai/api#pricing",
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_response_schema": false,
"supports_tool_choice": true,
- "supports_web_search": true
+ "supports_web_search": true,
+ "deprecation_date": "2026-05-15",
+ "input_cost_per_token_above_200k_tokens": 2.5e-06,
+ "output_cost_per_token_above_200k_tokens": 5e-06,
+ "cache_read_input_token_cost_above_200k_tokens": 4e-07
},
"xai/grok-3-fast-beta": {
- "cache_read_input_token_cost": 1.25e-06,
- "input_cost_per_token": 5e-06,
+ "cache_read_input_token_cost": 2e-07,
+ "input_cost_per_token": 1.25e-06,
"litellm_provider": "xai",
"max_input_tokens": 131072,
"max_output_tokens": 131072,
"max_tokens": 131072,
"mode": "chat",
- "output_cost_per_token": 2.5e-05,
+ "output_cost_per_token": 2.5e-06,
"source": "https://x.ai/api#pricing",
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_response_schema": false,
"supports_tool_choice": true,
- "supports_web_search": true
+ "supports_web_search": true,
+ "deprecation_date": "2026-05-15",
+ "input_cost_per_token_above_200k_tokens": 2.5e-06,
+ "output_cost_per_token_above_200k_tokens": 5e-06,
+ "cache_read_input_token_cost_above_200k_tokens": 4e-07
},
"xai/grok-3-fast-latest": {
- "cache_read_input_token_cost": 1.25e-06,
- "input_cost_per_token": 5e-06,
+ "cache_read_input_token_cost": 2e-07,
+ "input_cost_per_token": 1.25e-06,
"litellm_provider": "xai",
"max_input_tokens": 131072,
"max_output_tokens": 131072,
"max_tokens": 131072,
"mode": "chat",
- "output_cost_per_token": 2.5e-05,
+ "output_cost_per_token": 2.5e-06,
"source": "https://x.ai/api#pricing",
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_response_schema": false,
"supports_tool_choice": true,
- "supports_web_search": true
+ "supports_web_search": true,
+ "deprecation_date": "2026-05-15",
+ "input_cost_per_token_above_200k_tokens": 2.5e-06,
+ "output_cost_per_token_above_200k_tokens": 5e-06,
+ "cache_read_input_token_cost_above_200k_tokens": 4e-07
},
"xai/grok-3-latest": {
"cache_read_input_token_cost": 2e-07,
@@ -44236,108 +44203,130 @@
"cache_read_input_token_cost_above_200k_tokens": 4e-07
},
"xai/grok-3-mini": {
- "cache_read_input_token_cost": 7.5e-08,
+ "cache_read_input_token_cost": 2e-07,
"deprecation_date": "2026-02-28",
- "input_cost_per_token": 3e-07,
+ "input_cost_per_token": 1.25e-06,
"litellm_provider": "xai",
"max_input_tokens": 131072,
"max_output_tokens": 131072,
"max_tokens": 131072,
"mode": "chat",
- "output_cost_per_token": 5e-07,
+ "output_cost_per_token": 2.5e-06,
"source": "https://x.ai/api#pricing",
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": false,
"supports_tool_choice": true,
- "supports_web_search": true
+ "supports_web_search": true,
+ "input_cost_per_token_above_200k_tokens": 2.5e-06,
+ "output_cost_per_token_above_200k_tokens": 5e-06,
+ "cache_read_input_token_cost_above_200k_tokens": 4e-07
},
"xai/grok-3-mini-beta": {
- "cache_read_input_token_cost": 7.5e-08,
+ "cache_read_input_token_cost": 2e-07,
"deprecation_date": "2026-02-28",
- "input_cost_per_token": 3e-07,
+ "input_cost_per_token": 1.25e-06,
"litellm_provider": "xai",
"max_input_tokens": 131072,
"max_output_tokens": 131072,
"max_tokens": 131072,
"mode": "chat",
- "output_cost_per_token": 5e-07,
+ "output_cost_per_token": 2.5e-06,
"source": "https://x.ai/api#pricing",
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": false,
"supports_tool_choice": true,
- "supports_web_search": true
+ "supports_web_search": true,
+ "input_cost_per_token_above_200k_tokens": 2.5e-06,
+ "output_cost_per_token_above_200k_tokens": 5e-06,
+ "cache_read_input_token_cost_above_200k_tokens": 4e-07
},
"xai/grok-3-mini-fast": {
- "cache_read_input_token_cost": 1.5e-07,
- "input_cost_per_token": 6e-07,
+ "cache_read_input_token_cost": 2e-07,
+ "input_cost_per_token": 1.25e-06,
"litellm_provider": "xai",
"max_input_tokens": 131072,
"max_output_tokens": 131072,
"max_tokens": 131072,
"mode": "chat",
- "output_cost_per_token": 4e-06,
+ "output_cost_per_token": 2.5e-06,
"source": "https://x.ai/api#pricing",
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": false,
"supports_tool_choice": true,
- "supports_web_search": true
+ "supports_web_search": true,
+ "deprecation_date": "2026-02-28",
+ "input_cost_per_token_above_200k_tokens": 2.5e-06,
+ "output_cost_per_token_above_200k_tokens": 5e-06,
+ "cache_read_input_token_cost_above_200k_tokens": 4e-07
},
"xai/grok-3-mini-fast-beta": {
- "cache_read_input_token_cost": 1.5e-07,
- "input_cost_per_token": 6e-07,
+ "cache_read_input_token_cost": 2e-07,
+ "input_cost_per_token": 1.25e-06,
"litellm_provider": "xai",
"max_input_tokens": 131072,
"max_output_tokens": 131072,
"max_tokens": 131072,
"mode": "chat",
- "output_cost_per_token": 4e-06,
+ "output_cost_per_token": 2.5e-06,
"source": "https://x.ai/api#pricing",
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": false,
"supports_tool_choice": true,
- "supports_web_search": true
+ "supports_web_search": true,
+ "deprecation_date": "2026-02-28",
+ "input_cost_per_token_above_200k_tokens": 2.5e-06,
+ "output_cost_per_token_above_200k_tokens": 5e-06,
+ "cache_read_input_token_cost_above_200k_tokens": 4e-07
},
"xai/grok-3-mini-fast-latest": {
- "cache_read_input_token_cost": 1.5e-07,
- "input_cost_per_token": 6e-07,
+ "cache_read_input_token_cost": 2e-07,
+ "input_cost_per_token": 1.25e-06,
"litellm_provider": "xai",
"max_input_tokens": 131072,
"max_output_tokens": 131072,
"max_tokens": 131072,
"mode": "chat",
- "output_cost_per_token": 4e-06,
+ "output_cost_per_token": 2.5e-06,
"source": "https://x.ai/api#pricing",
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": false,
"supports_tool_choice": true,
- "supports_web_search": true
+ "supports_web_search": true,
+ "deprecation_date": "2026-02-28",
+ "input_cost_per_token_above_200k_tokens": 2.5e-06,
+ "output_cost_per_token_above_200k_tokens": 5e-06,
+ "cache_read_input_token_cost_above_200k_tokens": 4e-07
},
"xai/grok-3-mini-latest": {
- "cache_read_input_token_cost": 7.5e-08,
- "input_cost_per_token": 3e-07,
+ "cache_read_input_token_cost": 2e-07,
+ "input_cost_per_token": 1.25e-06,
"litellm_provider": "xai",
"max_input_tokens": 131072,
"max_output_tokens": 131072,
"max_tokens": 131072,
"mode": "chat",
- "output_cost_per_token": 5e-07,
+ "output_cost_per_token": 2.5e-06,
"source": "https://x.ai/api#pricing",
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": false,
"supports_tool_choice": true,
- "supports_web_search": true
+ "supports_web_search": true,
+ "deprecation_date": "2026-02-28",
+ "input_cost_per_token_above_200k_tokens": 2.5e-06,
+ "output_cost_per_token_above_200k_tokens": 5e-06,
+ "cache_read_input_token_cost_above_200k_tokens": 4e-07
},
"xai/grok-4": {
"input_cost_per_token": 1.25e-06,
@@ -44435,16 +44424,14 @@
"cache_read_input_token_cost_above_200k_tokens": 4e-07
},
"xai/grok-4-1-fast": {
- "cache_read_input_token_cost": 5e-08,
- "input_cost_per_token": 2e-07,
- "input_cost_per_token_above_128k_tokens": 4e-07,
+ "cache_read_input_token_cost": 2e-07,
+ "input_cost_per_token": 1.25e-06,
"litellm_provider": "xai",
"max_input_tokens": 2000000.0,
"max_output_tokens": 2000000.0,
"max_tokens": 2000000.0,
"mode": "chat",
- "output_cost_per_token": 5e-07,
- "output_cost_per_token_above_128k_tokens": 1e-06,
+ "output_cost_per_token": 2.5e-06,
"source": "https://docs.x.ai/docs/models/grok-4-1-fast-reasoning",
"supports_audio_input": true,
"supports_function_calling": true,
@@ -44453,7 +44440,11 @@
"supports_response_schema": true,
"supports_tool_choice": true,
"supports_vision": true,
- "supports_web_search": true
+ "supports_web_search": true,
+ "deprecation_date": "2026-05-15",
+ "input_cost_per_token_above_200k_tokens": 2.5e-06,
+ "output_cost_per_token_above_200k_tokens": 5e-06,
+ "cache_read_input_token_cost_above_200k_tokens": 4e-07
},
"xai/grok-4-1-fast-reasoning": {
"cache_read_input_token_cost": 2e-07,
@@ -50550,6 +50541,7 @@
"us.xai.grok-4.6": {
"input_cost_per_token": 2.2e-06,
"output_cost_per_token": 6.6e-06,
+ "cache_read_input_token_cost": 5.5e-07,
"litellm_provider": "bedrock_converse",
"max_input_tokens": 500000,
"max_output_tokens": 500000,
@@ -50564,6 +50556,7 @@
"global.xai.grok-4.6": {
"input_cost_per_token": 2e-06,
"output_cost_per_token": 6e-06,
+ "cache_read_input_token_cost": 5e-07,
"litellm_provider": "bedrock_converse",
"max_input_tokens": 500000,
"max_output_tokens": 500000,
@@ -54676,7 +54669,6 @@
"litellm_provider": "xai",
"mode": "video_generation",
"output_cost_per_second": 0.08,
- "output_cost_per_second_1080p": 0.25,
"source": "https://docs.x.ai/developers/models/grok-imagine-video-1.5",
"supported_modalities": [
"text",
@@ -54800,7 +54792,10 @@
"mode": "chat",
"output_cost_per_token": 4e-06,
"source": "https://console.groq.com/docs/model/qwen/qwen3.8-27b",
+ "supports_function_calling": true,
"supports_reasoning": true,
+ "supports_response_schema": true,
+ "supports_tool_choice": true,
"supports_vision": true
},
"mistral/mistral-medium-3.5": {
diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.json
index 20ce49f37d2..e113a476ac7 100644
--- a/model_prices_and_context_window.json
+++ b/model_prices_and_context_window.json
@@ -20597,51 +20597,6 @@
},
"gemini_native_audio": true
},
- "gemini/gemini-live-2.5-flash-native-audio": {
- "input_cost_per_audio_token": 3e-06,
- "input_cost_per_token": 5e-07,
- "litellm_provider": "gemini",
- "max_input_tokens": 1048576,
- "max_output_tokens": 65535,
- "max_tokens": 65535,
- "mode": "realtime",
- "output_cost_per_audio_token": 1.2e-05,
- "output_cost_per_token": 2e-06,
- "source": "https://ai.google.dev/gemini-api/docs/pricing",
- "supported_endpoints": [
- "/v1/realtime"
- ],
- "supported_modalities": [
- "text",
- "image",
- "audio",
- "video"
- ],
- "supported_output_modalities": [
- "text",
- "audio"
- ],
- "supports_audio_input": true,
- "supports_audio_output": true,
- "supports_function_calling": true,
- "supports_parallel_function_calling": true,
- "supports_pdf_input": true,
- "supports_prompt_caching": true,
- "supports_response_schema": true,
- "supports_system_messages": true,
- "supports_tool_choice": true,
- "supports_url_context": true,
- "supports_vision": true,
- "supports_web_search": true,
- "search_context_cost_per_query": {
- "search_context_size_low": 0.035,
- "search_context_size_medium": 0.035,
- "search_context_size_high": 0.035
- },
- "gemini_native_audio": true,
- "rpm": 100000,
- "tpm": 8000000
- },
"gemini-live-2.5-flash-preview-native-audio-09-2025": {
"cache_read_input_token_cost": 7.5e-08,
"input_cost_per_audio_token": 3e-06,
@@ -44168,52 +44123,64 @@
"cache_read_input_token_cost_above_200k_tokens": 4e-07
},
"xai/grok-3-beta": {
- "cache_read_input_token_cost": 7.5e-07,
- "input_cost_per_token": 3e-06,
+ "cache_read_input_token_cost": 2e-07,
+ "input_cost_per_token": 1.25e-06,
"litellm_provider": "xai",
"max_input_tokens": 131072,
"max_output_tokens": 131072,
"max_tokens": 131072,
"mode": "chat",
- "output_cost_per_token": 1.5e-05,
+ "output_cost_per_token": 2.5e-06,
"source": "https://x.ai/api#pricing",
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_response_schema": false,
"supports_tool_choice": true,
- "supports_web_search": true
+ "supports_web_search": true,
+ "deprecation_date": "2026-05-15",
+ "input_cost_per_token_above_200k_tokens": 2.5e-06,
+ "output_cost_per_token_above_200k_tokens": 5e-06,
+ "cache_read_input_token_cost_above_200k_tokens": 4e-07
},
"xai/grok-3-fast-beta": {
- "cache_read_input_token_cost": 1.25e-06,
- "input_cost_per_token": 5e-06,
+ "cache_read_input_token_cost": 2e-07,
+ "input_cost_per_token": 1.25e-06,
"litellm_provider": "xai",
"max_input_tokens": 131072,
"max_output_tokens": 131072,
"max_tokens": 131072,
"mode": "chat",
- "output_cost_per_token": 2.5e-05,
+ "output_cost_per_token": 2.5e-06,
"source": "https://x.ai/api#pricing",
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_response_schema": false,
"supports_tool_choice": true,
- "supports_web_search": true
+ "supports_web_search": true,
+ "deprecation_date": "2026-05-15",
+ "input_cost_per_token_above_200k_tokens": 2.5e-06,
+ "output_cost_per_token_above_200k_tokens": 5e-06,
+ "cache_read_input_token_cost_above_200k_tokens": 4e-07
},
"xai/grok-3-fast-latest": {
- "cache_read_input_token_cost": 1.25e-06,
- "input_cost_per_token": 5e-06,
+ "cache_read_input_token_cost": 2e-07,
+ "input_cost_per_token": 1.25e-06,
"litellm_provider": "xai",
"max_input_tokens": 131072,
"max_output_tokens": 131072,
"max_tokens": 131072,
"mode": "chat",
- "output_cost_per_token": 2.5e-05,
+ "output_cost_per_token": 2.5e-06,
"source": "https://x.ai/api#pricing",
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_response_schema": false,
"supports_tool_choice": true,
- "supports_web_search": true
+ "supports_web_search": true,
+ "deprecation_date": "2026-05-15",
+ "input_cost_per_token_above_200k_tokens": 2.5e-06,
+ "output_cost_per_token_above_200k_tokens": 5e-06,
+ "cache_read_input_token_cost_above_200k_tokens": 4e-07
},
"xai/grok-3-latest": {
"cache_read_input_token_cost": 2e-07,
@@ -44236,108 +44203,130 @@
"cache_read_input_token_cost_above_200k_tokens": 4e-07
},
"xai/grok-3-mini": {
- "cache_read_input_token_cost": 7.5e-08,
+ "cache_read_input_token_cost": 2e-07,
"deprecation_date": "2026-02-28",
- "input_cost_per_token": 3e-07,
+ "input_cost_per_token": 1.25e-06,
"litellm_provider": "xai",
"max_input_tokens": 131072,
"max_output_tokens": 131072,
"max_tokens": 131072,
"mode": "chat",
- "output_cost_per_token": 5e-07,
+ "output_cost_per_token": 2.5e-06,
"source": "https://x.ai/api#pricing",
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": false,
"supports_tool_choice": true,
- "supports_web_search": true
+ "supports_web_search": true,
+ "input_cost_per_token_above_200k_tokens": 2.5e-06,
+ "output_cost_per_token_above_200k_tokens": 5e-06,
+ "cache_read_input_token_cost_above_200k_tokens": 4e-07
},
"xai/grok-3-mini-beta": {
- "cache_read_input_token_cost": 7.5e-08,
+ "cache_read_input_token_cost": 2e-07,
"deprecation_date": "2026-02-28",
- "input_cost_per_token": 3e-07,
+ "input_cost_per_token": 1.25e-06,
"litellm_provider": "xai",
"max_input_tokens": 131072,
"max_output_tokens": 131072,
"max_tokens": 131072,
"mode": "chat",
- "output_cost_per_token": 5e-07,
+ "output_cost_per_token": 2.5e-06,
"source": "https://x.ai/api#pricing",
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": false,
"supports_tool_choice": true,
- "supports_web_search": true
+ "supports_web_search": true,
+ "input_cost_per_token_above_200k_tokens": 2.5e-06,
+ "output_cost_per_token_above_200k_tokens": 5e-06,
+ "cache_read_input_token_cost_above_200k_tokens": 4e-07
},
"xai/grok-3-mini-fast": {
- "cache_read_input_token_cost": 1.5e-07,
- "input_cost_per_token": 6e-07,
+ "cache_read_input_token_cost": 2e-07,
+ "input_cost_per_token": 1.25e-06,
"litellm_provider": "xai",
"max_input_tokens": 131072,
"max_output_tokens": 131072,
"max_tokens": 131072,
"mode": "chat",
- "output_cost_per_token": 4e-06,
+ "output_cost_per_token": 2.5e-06,
"source": "https://x.ai/api#pricing",
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": false,
"supports_tool_choice": true,
- "supports_web_search": true
+ "supports_web_search": true,
+ "deprecation_date": "2026-02-28",
+ "input_cost_per_token_above_200k_tokens": 2.5e-06,
+ "output_cost_per_token_above_200k_tokens": 5e-06,
+ "cache_read_input_token_cost_above_200k_tokens": 4e-07
},
"xai/grok-3-mini-fast-beta": {
- "cache_read_input_token_cost": 1.5e-07,
- "input_cost_per_token": 6e-07,
+ "cache_read_input_token_cost": 2e-07,
+ "input_cost_per_token": 1.25e-06,
"litellm_provider": "xai",
"max_input_tokens": 131072,
"max_output_tokens": 131072,
"max_tokens": 131072,
"mode": "chat",
- "output_cost_per_token": 4e-06,
+ "output_cost_per_token": 2.5e-06,
"source": "https://x.ai/api#pricing",
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": false,
"supports_tool_choice": true,
- "supports_web_search": true
+ "supports_web_search": true,
+ "deprecation_date": "2026-02-28",
+ "input_cost_per_token_above_200k_tokens": 2.5e-06,
+ "output_cost_per_token_above_200k_tokens": 5e-06,
+ "cache_read_input_token_cost_above_200k_tokens": 4e-07
},
"xai/grok-3-mini-fast-latest": {
- "cache_read_input_token_cost": 1.5e-07,
- "input_cost_per_token": 6e-07,
+ "cache_read_input_token_cost": 2e-07,
+ "input_cost_per_token": 1.25e-06,
"litellm_provider": "xai",
"max_input_tokens": 131072,
"max_output_tokens": 131072,
"max_tokens": 131072,
"mode": "chat",
- "output_cost_per_token": 4e-06,
+ "output_cost_per_token": 2.5e-06,
"source": "https://x.ai/api#pricing",
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": false,
"supports_tool_choice": true,
- "supports_web_search": true
+ "supports_web_search": true,
+ "deprecation_date": "2026-02-28",
+ "input_cost_per_token_above_200k_tokens": 2.5e-06,
+ "output_cost_per_token_above_200k_tokens": 5e-06,
+ "cache_read_input_token_cost_above_200k_tokens": 4e-07
},
"xai/grok-3-mini-latest": {
- "cache_read_input_token_cost": 7.5e-08,
- "input_cost_per_token": 3e-07,
+ "cache_read_input_token_cost": 2e-07,
+ "input_cost_per_token": 1.25e-06,
"litellm_provider": "xai",
"max_input_tokens": 131072,
"max_output_tokens": 131072,
"max_tokens": 131072,
"mode": "chat",
- "output_cost_per_token": 5e-07,
+ "output_cost_per_token": 2.5e-06,
"source": "https://x.ai/api#pricing",
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": false,
"supports_tool_choice": true,
- "supports_web_search": true
+ "supports_web_search": true,
+ "deprecation_date": "2026-02-28",
+ "input_cost_per_token_above_200k_tokens": 2.5e-06,
+ "output_cost_per_token_above_200k_tokens": 5e-06,
+ "cache_read_input_token_cost_above_200k_tokens": 4e-07
},
"xai/grok-4": {
"input_cost_per_token": 1.25e-06,
@@ -44435,16 +44424,14 @@
"cache_read_input_token_cost_above_200k_tokens": 4e-07
},
"xai/grok-4-1-fast": {
- "cache_read_input_token_cost": 5e-08,
- "input_cost_per_token": 2e-07,
- "input_cost_per_token_above_128k_tokens": 4e-07,
+ "cache_read_input_token_cost": 2e-07,
+ "input_cost_per_token": 1.25e-06,
"litellm_provider": "xai",
"max_input_tokens": 2000000.0,
"max_output_tokens": 2000000.0,
"max_tokens": 2000000.0,
"mode": "chat",
- "output_cost_per_token": 5e-07,
- "output_cost_per_token_above_128k_tokens": 1e-06,
+ "output_cost_per_token": 2.5e-06,
"source": "https://docs.x.ai/docs/models/grok-4-1-fast-reasoning",
"supports_audio_input": true,
"supports_function_calling": true,
@@ -44453,7 +44440,11 @@
"supports_response_schema": true,
"supports_tool_choice": true,
"supports_vision": true,
- "supports_web_search": true
+ "supports_web_search": true,
+ "deprecation_date": "2026-05-15",
+ "input_cost_per_token_above_200k_tokens": 2.5e-06,
+ "output_cost_per_token_above_200k_tokens": 5e-06,
+ "cache_read_input_token_cost_above_200k_tokens": 4e-07
},
"xai/grok-4-1-fast-reasoning": {
"cache_read_input_token_cost": 2e-07,
@@ -50550,6 +50541,7 @@
"us.xai.grok-4.6": {
"input_cost_per_token": 2.2e-06,
"output_cost_per_token": 6.6e-06,
+ "cache_read_input_token_cost": 5.5e-07,
"litellm_provider": "bedrock_converse",
"max_input_tokens": 500000,
"max_output_tokens": 500000,
@@ -50564,6 +50556,7 @@
"global.xai.grok-4.6": {
"input_cost_per_token": 2e-06,
"output_cost_per_token": 6e-06,
+ "cache_read_input_token_cost": 5e-07,
"litellm_provider": "bedrock_converse",
"max_input_tokens": 500000,
"max_output_tokens": 500000,
@@ -54676,7 +54669,6 @@
"litellm_provider": "xai",
"mode": "video_generation",
"output_cost_per_second": 0.08,
- "output_cost_per_second_1080p": 0.25,
"source": "https://docs.x.ai/developers/models/grok-imagine-video-1.5",
"supported_modalities": [
"text",
@@ -54800,7 +54792,10 @@
"mode": "chat",
"output_cost_per_token": 4e-06,
"source": "https://console.groq.com/docs/model/qwen/qwen3.8-27b",
+ "supports_function_calling": true,
"supports_reasoning": true,
+ "supports_response_schema": true,
+ "supports_tool_choice": true,
"supports_vision": true
},
"mistral/mistral-medium-3.5": {
diff --git a/tests/test_litellm/integrations/test_anthropic_cache_control_hook.py b/tests/test_litellm/integrations/test_anthropic_cache_control_hook.py
index 51634c4b723..e995cbae782 100644
--- a/tests/test_litellm/integrations/test_anthropic_cache_control_hook.py
+++ b/tests/test_litellm/integrations/test_anthropic_cache_control_hook.py
@@ -1613,15 +1613,17 @@ class TestEnableAnthropicPromptCaching:
@pytest.mark.parametrize("model", ["us.xai.grok-4.6", "global.xai.grok-4.6"])
def test_bedrock_grok_not_injected(self, monkeypatch, local_model_cost_map, model):
- """Bedrock does not support prompt caching for Grok. The cost-map entries must
- carry supports_prompt_caching=false so no breakpoints are injected; otherwise
- Bedrock rejects the whole request ("You invoked an unsupported model or your
- request did not allow prompt caching")."""
+ """Bedrock supports only implicit prompt caching for Grok: explicit cachePoint
+ breakpoints make it reject the whole request ("You invoked an unsupported model
+ or your request did not allow prompt caching"), so supports_prompt_caching stays
+ false, while implicit cache hits still bill at the cache-read rate."""
from litellm.utils import supports_prompt_caching
monkeypatch.setattr(litellm, "enable_anthropic_prompt_caching", True)
assert supports_prompt_caching(model=model, custom_llm_provider="bedrock") is False
assert self._points(model=model, provider="bedrock") == []
+ entry = litellm.model_cost[model]
+ assert 0 < entry["cache_read_input_token_cost"] < entry["input_cost_per_token"]
def test_stands_down_when_client_sent_cache_control(self, monkeypatch):
monkeypatch.setattr(litellm, "enable_anthropic_prompt_caching", True)
diff --git a/tests/test_litellm/llms/gemini/realtime/test_gemini_realtime_transformation.py b/tests/test_litellm/llms/gemini/realtime/test_gemini_realtime_transformation.py
index 8a2b9730c05..3d8200bc474 100644
--- a/tests/test_litellm/llms/gemini/realtime/test_gemini_realtime_transformation.py
+++ b/tests/test_litellm/llms/gemini/realtime/test_gemini_realtime_transformation.py
@@ -1813,7 +1813,6 @@ def patch_gemini_audio_cost_map_entries(monkeypatch):
"gemini-2.5-flash-native-audio-latest",
"gemini/gemini-2.5-flash-native-audio-latest",
"gemini-live-2.5-flash-native-audio",
- "gemini/gemini-live-2.5-flash-native-audio",
]
flash_live_models = [
"gemini-3.1-flash-live-preview",
@@ -1837,7 +1836,6 @@ def patch_gemini_audio_cost_map_entries(monkeypatch):
("gemini-2.5-flash-native-audio-latest", True),
("gemini/gemini-2.5-flash-native-audio-latest", True),
("gemini-live-2.5-flash-native-audio", True),
- ("gemini/gemini-live-2.5-flash-native-audio", True),
("vertex_ai/gemini-live-2.5-flash-native-audio", True),
("gemini-2.0-flash", False),
("gemini-2.5-flash", False),
@@ -1847,16 +1845,17 @@ def test_is_audio_only_live_model_uses_cost_map(model, expected, patch_gemini_au
assert GeminiRealtimeConfig._is_audio_only_live_model(model) == expected
-def test_gemini_live_native_audio_entries_in_catalog():
+def test_gemini_live_native_audio_entry_is_vertex_only():
import json
from pathlib import Path
from typing import Final
catalog_path: Final = Path(__file__).parents[5] / "model_prices_and_context_window.json"
catalog: Final = json.loads(catalog_path.read_text())
- for key in ("gemini-live-2.5-flash-native-audio", "gemini/gemini-live-2.5-flash-native-audio"):
- assert key in catalog, f"{key} missing from model_prices_and_context_window.json"
- assert catalog[key].get("gemini_native_audio") is True, f"{key}: gemini_native_audio must be true"
+ vertex_key: Final = "gemini-live-2.5-flash-native-audio"
+ assert catalog[vertex_key]["litellm_provider"] == "vertex_ai-language-models"
+ assert catalog[vertex_key].get("gemini_native_audio") is True
+ assert "gemini/gemini-live-2.5-flash-native-audio" not in catalog, "the Gemini API does not serve this model"
def test_is_setup_message_and_is_content_message():
diff --git a/tests/test_litellm/llms/xai/test_xai_cost_calculator.py b/tests/test_litellm/llms/xai/test_xai_cost_calculator.py
index 94cd10437e2..92e76fd18ab 100644
--- a/tests/test_litellm/llms/xai/test_xai_cost_calculator.py
+++ b/tests/test_litellm/llms/xai/test_xai_cost_calculator.py
@@ -51,8 +51,8 @@ class TestXAICostCalculator:
# Expected costs for grok-3-mini:
# Input: 12 tokens * $3e-7 = $0.0000036
# Output: 125 tokens * $5e-7 = $0.0000625
- expected_prompt_cost = 12 * 3e-7
- expected_completion_cost = 125 * 5e-7
+ expected_prompt_cost = 12 * 1.25e-6
+ expected_completion_cost = 125 * 2.5e-6
assert math.isclose(prompt_cost, expected_prompt_cost, rel_tol=1e-10)
assert math.isclose(completion_cost, expected_completion_cost, rel_tol=1e-10)
@@ -77,8 +77,8 @@ class TestXAICostCalculator:
# Expected costs for grok-3-mini:
# Input: 12 tokens * $3e-7 = $0.0000036
# Completion: (125 + 949) tokens * $5e-7 = $0.000537
- expected_prompt_cost = 12 * 3e-7
- expected_completion_cost = (125 + 949) * 5e-7
+ expected_prompt_cost = 12 * 1.25e-6
+ expected_completion_cost = (125 + 949) * 2.5e-6
assert math.isclose(prompt_cost, expected_prompt_cost, rel_tol=1e-10)
assert math.isclose(completion_cost, expected_completion_cost, rel_tol=1e-10)
@@ -104,8 +104,8 @@ class TestXAICostCalculator:
# Input: 12 tokens * $3e-7 = $0.0000036
# Completion: (125 + 949) tokens * $5e-7 = $0.000537
# Note: text_tokens field is ignored, only completion_tokens + reasoning_tokens matters
- expected_prompt_cost = 12 * 3e-7
- expected_completion_cost = (125 + 949) * 5e-7
+ expected_prompt_cost = 12 * 1.25e-6
+ expected_completion_cost = (125 + 949) * 2.5e-6
assert math.isclose(prompt_cost, expected_prompt_cost, rel_tol=1e-10)
assert math.isclose(completion_cost, expected_completion_cost, rel_tol=1e-10)
@@ -159,8 +159,8 @@ class TestXAICostCalculator:
# Expected costs for grok-3-fast-beta:
# Input: 20 tokens * $5e-6 = $0.0001
# Completion: (300 + 200) tokens * $2.5e-5 = $0.0125
- expected_prompt_cost = 20 * 5e-6
- expected_completion_cost = (300 + 200) * 2.5e-5
+ expected_prompt_cost = 20 * 1.25e-6
+ expected_completion_cost = (300 + 200) * 2.5e-6
assert math.isclose(prompt_cost, expected_prompt_cost, rel_tol=1e-10)
assert math.isclose(completion_cost, expected_completion_cost, rel_tol=1e-10)
@@ -186,46 +186,34 @@ class TestXAICostCalculator:
# Expected costs:
# Input: 12 tokens * $3e-7 = $0.0000036
# Completion: (50 + 100) tokens * $5e-7 = $0.000075
- expected_prompt_cost = 12 * 3e-7
- expected_completion_cost = (50 + 100) * 5e-7
+ expected_prompt_cost = 12 * 1.25e-6
+ expected_completion_cost = (50 + 100) * 2.5e-6
assert math.isclose(prompt_cost, expected_prompt_cost, rel_tol=1e-10)
assert math.isclose(completion_cost, expected_completion_cost, rel_tol=1e-10)
- def test_tiered_pricing_above_128k_tokens(self):
- """Test tiered pricing for tokens above 128k."""
- # Test with grok-4-1-fast, which still carries a 128k tier
+ def test_tiered_pricing_above_200k_tokens(self):
usage = Usage(
- prompt_tokens=150000, # Above 128k threshold
- completion_tokens=100000, # Above 128k threshold
- total_tokens=300000,
+ prompt_tokens=250000,
+ completion_tokens=100000,
+ total_tokens=400000,
completion_tokens_details=CompletionTokensDetailsWrapper(
accepted_prediction_tokens=0,
audio_tokens=0,
- reasoning_tokens=50000, # Total completion tokens = 100000 + 50000 = 150000 > 128k
+ reasoning_tokens=50000,
rejected_prediction_tokens=0,
text_tokens=None,
),
)
-
- prompt_cost, completion_cost = cost_per_token(
- model="xai/grok-4-1-fast", usage=usage
- )
-
- # Expected costs for grok-4-1-fast with tiered pricing:
- # Input: 150000 tokens * $0.4e-6 (ALL tokens at tiered rate since input > 128k) = $0.06
- # Completion: (100000 + 50000) tokens * $1e-6 (tiered rate since input > 128k) = $0.15
- expected_prompt_cost = 150000 * 0.4e-6
- expected_completion_cost = (100000 + 50000) * 1e-6
-
+ prompt_cost, completion_cost = cost_per_token(model="xai/grok-4.3", usage=usage)
+ expected_prompt_cost = 250000 * 2.5e-6
+ expected_completion_cost = (100000 + 50000) * 5e-6
assert math.isclose(prompt_cost, expected_prompt_cost, rel_tol=1e-10)
assert math.isclose(completion_cost, expected_completion_cost, rel_tol=1e-10)
- def test_tiered_pricing_below_128k_tokens(self):
- """Test that regular pricing is used for tokens below 128k threshold."""
- # Test with grok-4-1-fast, which still carries a 128k tier
+ def test_tiered_pricing_below_200k_tokens(self):
usage = Usage(
- prompt_tokens=100000, # Below 128k threshold
+ prompt_tokens=100000,
completion_tokens=50000,
total_tokens=160000,
completion_tokens_details=CompletionTokensDetailsWrapper(
@@ -236,17 +224,9 @@ class TestXAICostCalculator:
text_tokens=None,
),
)
-
- prompt_cost, completion_cost = cost_per_token(
- model="xai/grok-4-1-fast", usage=usage
- )
-
- # Expected costs for grok-4-1-fast with regular pricing:
- # Input: 100000 tokens * $0.2e-6 (regular rate) = $0.02
- # Completion: (50000 + 10000) tokens * $0.5e-6 (regular rate) = $0.03
- expected_prompt_cost = 100000 * 0.2e-6
- expected_completion_cost = (50000 + 10000) * 0.5e-6
-
+ prompt_cost, completion_cost = cost_per_token(model="xai/grok-4.3", usage=usage)
+ expected_prompt_cost = 100000 * 1.25e-6
+ expected_completion_cost = (50000 + 10000) * 2.5e-6
assert math.isclose(prompt_cost, expected_prompt_cost, rel_tol=1e-10)
assert math.isclose(completion_cost, expected_completion_cost, rel_tol=1e-10)
@@ -278,50 +258,36 @@ class TestXAICostCalculator:
assert math.isclose(prompt_cost, expected_prompt_cost, rel_tol=1e-10)
assert math.isclose(completion_cost, expected_completion_cost, rel_tol=1e-10)
- def test_tiered_pricing_output_tokens_below_128k(self):
- """Test that output tokens get tiered rate when input tokens > 128k, even if output tokens < 128k."""
+ def test_tiered_pricing_output_tokens_below_200k(self):
usage = Usage(
- prompt_tokens=150000, # Above 128k threshold
- completion_tokens=50000, # Below 128k threshold
- total_tokens=210000,
+ prompt_tokens=250000,
+ completion_tokens=50000,
+ total_tokens=310000,
completion_tokens_details=CompletionTokensDetailsWrapper(
accepted_prediction_tokens=0,
audio_tokens=0,
- reasoning_tokens=10000, # Total completion tokens = 50000 + 10000 = 60000 < 128k
+ reasoning_tokens=10000,
rejected_prediction_tokens=0,
text_tokens=None,
),
)
-
- prompt_cost, completion_cost = cost_per_token(
- model="xai/grok-4-1-fast", usage=usage
- )
-
- # Expected costs for grok-4-1-fast:
- # Input: 150000 tokens * $0.4e-6 (ALL tokens at tiered rate since input > 128k) = $0.06
- # Completion: (50000 + 10000) tokens * $1e-6 (tiered rate since input > 128k) = $0.06
- expected_prompt_cost = 150000 * 0.4e-6
- expected_completion_cost = (50000 + 10000) * 1e-6
-
+ prompt_cost, completion_cost = cost_per_token(model="xai/grok-4.3", usage=usage)
+ expected_prompt_cost = 250000 * 2.5e-6
+ expected_completion_cost = (50000 + 10000) * 5e-6
assert math.isclose(prompt_cost, expected_prompt_cost, rel_tol=1e-10)
assert math.isclose(completion_cost, expected_completion_cost, rel_tol=1e-10)
def test_tiered_pricing_model_without_tiered_pricing(self):
- """Test that models without tiered pricing use regular pricing even above 128k."""
- usage = Usage(
- prompt_tokens=150000, # Above 128k threshold
- completion_tokens=50000,
- total_tokens=200000,
- )
-
- prompt_cost, completion_cost = cost_per_token(model="grok-3-mini", usage=usage)
-
- # grok-3-mini doesn't have tiered pricing, so should use regular rates:
- # Input: 150000 tokens * $3e-7 (regular rate) = $0.045
- # Completion: 50000 tokens * $5e-7 (regular rate) = $0.025
- expected_prompt_cost = 150000 * 3e-7
+ litellm.model_cost["xai/flat-rate-fixture"] = {
+ "input_cost_per_token": 3e-7,
+ "output_cost_per_token": 5e-7,
+ "litellm_provider": "xai",
+ "mode": "chat",
+ }
+ usage = Usage(prompt_tokens=250000, completion_tokens=50000, total_tokens=300000)
+ prompt_cost, completion_cost = cost_per_token(model="xai/flat-rate-fixture", usage=usage)
+ expected_prompt_cost = 250000 * 3e-7
expected_completion_cost = 50000 * 5e-7
-
assert math.isclose(prompt_cost, expected_prompt_cost, rel_tol=1e-10)
assert math.isclose(completion_cost, expected_completion_cost, rel_tol=1e-10)
@@ -342,8 +308,8 @@ class TestXAICostCalculator:
prompt_cost, completion_cost = cost_per_token(model="grok-3-mini", usage=usage)
- expected_prompt_cost = 12 * 3e-7
- expected_completion_cost = 200 * 5e-7
+ expected_prompt_cost = 12 * 1.25e-6
+ expected_completion_cost = 200 * 2.5e-6
assert math.isclose(prompt_cost, expected_prompt_cost, rel_tol=1e-10)
assert math.isclose(completion_cost, expected_completion_cost, rel_tol=1e-10)
diff --git a/tests/test_litellm/llms/xai/test_xai_redirected_slug_pricing.py b/tests/test_litellm/llms/xai/test_xai_redirected_slug_pricing.py
index da1c3ed1ed8..83c3bf1ecef 100644
--- a/tests/test_litellm/llms/xai/test_xai_redirected_slug_pricing.py
+++ b/tests/test_litellm/llms/xai/test_xai_redirected_slug_pricing.py
@@ -2,8 +2,9 @@
xAI retired eight slugs on 2026-05-15 but kept them resolvable: chat slugs redirect to
grok-4.3 and bill at grok-4.3's rates, while the grok-code-fast slugs are aliases of
grok-build-0.1 and bill at its rates, so the registry must price them that way or spend
-tracking is wrong.
-
+tracking is wrong. The grok-3-beta, grok-3-fast, grok-3-mini, and grok-4-1-fast slugs
+are absent from /v1/language-models and resolve to grok-4.3 the same way (the chat
+response names grok-4.3 as the served model), so they carry grok-4.3's rates too.
https://docs.x.ai/developers/migration/may-15-retirement
https://docs.x.ai/developers/models/grok-build-0.1
"""
@@ -21,11 +22,24 @@ BACKUP_PRICES_PATH = REPO_ROOT / "litellm" / "model_prices_and_context_window_ba
MAP_PATHS = (PRICES_PATH, BACKUP_PRICES_PATH)
REDIRECT_TARGET = "xai/grok-4.3"
+GROK_3_MINI_SLUGS = (
+ "xai/grok-3-mini",
+ "xai/grok-3-mini-beta",
+ "xai/grok-3-mini-fast",
+ "xai/grok-3-mini-fast-beta",
+ "xai/grok-3-mini-fast-latest",
+ "xai/grok-3-mini-latest",
+)
REDIRECTED_SLUGS = (
"xai/grok-3",
+ "xai/grok-3-beta",
+ "xai/grok-3-fast-beta",
+ "xai/grok-3-fast-latest",
"xai/grok-3-latest",
+ *GROK_3_MINI_SLUGS,
"xai/grok-4",
"xai/grok-4-0709",
+ "xai/grok-4-1-fast",
"xai/grok-4-1-fast-non-reasoning",
"xai/grok-4-1-fast-non-reasoning-latest",
"xai/grok-4-1-fast-reasoning",
@@ -41,6 +55,7 @@ CODE_SLUGS = (
"xai/grok-code-fast-1-0825",
)
RETIREMENT_DATE = "2026-05-15"
+GROK_3_MINI_RETIREMENT_DATE = "2026-02-28"
BASE_COST_FIELDS = ("input_cost_per_token", "output_cost_per_token", "cache_read_input_token_cost")
TIER_COST_FIELDS = (
@@ -55,6 +70,10 @@ STALE_TIER_FIELDS = (
)
+def expected_retirement_date(slug: str) -> str:
+ return GROK_3_MINI_RETIREMENT_DATE if slug in GROK_3_MINI_SLUGS else RETIREMENT_DATE
+
+
@pytest.fixture(scope="module", params=[p.name for p in MAP_PATHS])
def cost_map(request: pytest.FixtureRequest) -> dict:
path = next(p for p in MAP_PATHS if p.name == request.param)
@@ -80,7 +99,7 @@ def test_code_slug_bills_at_grok_build_rate(cost_map: dict, slug: str):
@pytest.mark.parametrize("slug", (*REDIRECTED_SLUGS, *CODE_SLUGS))
def test_redirected_slug_keeps_its_retirement_date(cost_map: dict, slug: str):
- assert cost_map[slug]["deprecation_date"] == RETIREMENT_DATE
+ assert cost_map[slug]["deprecation_date"] == expected_retirement_date(slug)
@pytest.mark.parametrize("slug", REDIRECTED_SLUGS)
@@ -113,21 +132,13 @@ def test_both_cost_maps_agree_on_the_redirected_slugs():
def test_every_retired_chat_slug_is_covered(cost_map: dict):
- """The list above must stay in step with what the registry marks retired."""
+ """The lists above must stay in step with what the registry marks retired."""
marked = {
key
for key, entry in cost_map.items()
if isinstance(entry, dict)
and entry.get("litellm_provider") == "xai"
- and entry.get("deprecation_date") == RETIREMENT_DATE
+ and "deprecation_date" in entry
and entry.get("mode") == "chat"
}
assert marked == {*REDIRECTED_SLUGS, *CODE_SLUGS}
-
-
-def test_a_live_tiered_model_keeps_its_own_rates(cost_map: dict):
- """grok-4-1-fast is not retired, so it must keep its 128k tier and its own prices."""
- entry = cost_map["xai/grok-4-1-fast"]
- assert "deprecation_date" not in entry
- assert entry["input_cost_per_token_above_128k_tokens"] == 4e-07
- assert entry["input_cost_per_token"] == 2e-07
diff --git a/tests/test_litellm/test_together_ai_model_metadata.py b/tests/test_litellm/test_together_ai_model_metadata.py
index 45f0370386b..76f3d7f3f9f 100644
--- a/tests/test_litellm/test_together_ai_model_metadata.py
+++ b/tests/test_litellm/test_together_ai_model_metadata.py
@@ -15,6 +15,7 @@ COST_MAP_ADAPTER: Final = TypeAdapter(CostMap)
SERVERLESS_CHAT_MODELS: Final = (
"together_ai/moonshotai/Kimi-K3",
"together_ai/zai-org/GLM-5.2",
+ "together_ai/zai-org/GLM-5.3",
"together_ai/zai-org/GLM-5.3-Flash",
"together_ai/deepseek-ai/DeepSeek-V4-Pro-0813",
"together_ai/deepseek-ai/DeepSeek-V4-Flash-0731",