mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-05 22:25:05 +00:00
Feat: add support for Grok 4.1 Fast models (#16936)
* feat: Add support for Grok 4.1 Fast models Add new xAI Grok 4.1 Fast models optimized for high-performance agentic tool calling: - xai/grok-4-1-fast (alias for grok-4-1-fast-reasoning) - xai/grok-4-1-fast-reasoning (with reasoning capabilities) - xai/grok-4-1-fast-reasoning-latest - xai/grok-4-1-fast-non-reasoning (without reasoning for faster responses) - xai/grok-4-1-fast-non-reasoning-latest Features: - Context window: 2,000,000 tokens - Pricing: $0.20/1M input, $0.50/1M output tokens - Cached tokens: $0.05/1M tokens - Supports: Function calling, Structured outputs, Vision, Audio input, Web search, Reasoning Fixes #16927 * docs: Add comprehensive Grok models documentation - Add 'Supported Models' section highlighting new Grok 4.1 Fast models - Include comparison guide for reasoning vs non-reasoning models - Add complete model family table (Grok 4.1, 4, 3, Code, 2) - Add features legend explaining capabilities - Remove pricing details (link to xAI docs instead for current rates) - Improve documentation clarity and consistency Related to #16927 * docs: Minor corrections to xai.md
This commit is contained in:
@@ -11,6 +11,68 @@ https://docs.x.ai/docs
|
||||
|
||||
:::
|
||||
|
||||
## Supported Models
|
||||
|
||||
|
||||
|
||||
**Latest Release** - Grok 4.1 Fast: Optimized for high-performance agentic tool calling with 2M context and prompt caching.
|
||||
|
||||
| Model | Context | Features |
|
||||
|-------|---------|----------|
|
||||
| `xai/grok-4-1-fast-reasoning` | 2M tokens | **Reasoning**, Function calling, Vision, Audio, Web search, Caching |
|
||||
| `xai/grok-4-1-fast-non-reasoning` | 2M tokens | Function calling, Vision, Audio, Web search, Caching |
|
||||
|
||||
**When to use:**
|
||||
- ✅ **Reasoning model**: Complex analysis, planning, multi-step reasoning problems
|
||||
- ✅ **Non-reasoning model**: Simple queries, faster responses, lower token usage
|
||||
|
||||
**Example:**
|
||||
```python
|
||||
from litellm import completion
|
||||
|
||||
# With reasoning
|
||||
response = completion(
|
||||
model="xai/grok-4-1-fast-reasoning",
|
||||
messages=[{"role": "user", "content": "Analyze this problem step by step..."}]
|
||||
)
|
||||
|
||||
# Without reasoning
|
||||
response = completion(
|
||||
model="xai/grok-4-1-fast-non-reasoning",
|
||||
messages=[{"role": "user", "content": "What's 2+2?"}]
|
||||
)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### All Available Models
|
||||
|
||||
| Model Family | Model | Context | Features |
|
||||
|--------------|-------|---------|----------|
|
||||
| **Grok 4.1** | `xai/grok-4-1-fast-reasoning` | 2M | **Reasoning**, Tools, Vision, Audio, Web search, Caching |
|
||||
| | `xai/grok-4-1-fast-non-reasoning` | 2M | Tools, Vision, Audio, Web search, Caching |
|
||||
| **Grok 4** | `xai/grok-4` | 256K | Tools, Web search |
|
||||
| | `xai/grok-4-0709` | 256K | Tools, Web search |
|
||||
| | `xai/grok-4-fast-reasoning` | 2M | **Reasoning**, Tools, Web search |
|
||||
| | `xai/grok-4-fast-non-reasoning` | 2M | Tools, Web search |
|
||||
| **Grok 3** | `xai/grok-3` | 131K | Tools, Web search |
|
||||
| | `xai/grok-3-mini` | 131K | Tools, Web search |
|
||||
| | `xai/grok-3-fast-beta` | 131K | Tools, Web search |
|
||||
| **Grok Code** | `xai/grok-code-fast` | 256K | **Reasoning**, Tools, Code generation, Caching |
|
||||
| **Grok 2** | `xai/grok-2` | 131K | Tools, **Vision** |
|
||||
| | `xai/grok-2-vision-latest` | 32K | Tools, **Vision** |
|
||||
|
||||
**Features:**
|
||||
- **Reasoning** = Chain-of-thought reasoning with reasoning tokens
|
||||
- **Tools** = Function calling / Tool use
|
||||
- **Web search** = Live internet search
|
||||
- **Vision** = Image understanding
|
||||
- **Audio** = Audio input support
|
||||
- **Caching** = Prompt caching for cost savings
|
||||
- **Code generation** = Optimized for code tasks
|
||||
|
||||
**Pricing:** See [xAI's pricing page](https://docs.x.ai/docs/models) for current rates.
|
||||
|
||||
## API Key
|
||||
```python
|
||||
# env variable
|
||||
|
||||
@@ -26179,6 +26179,104 @@
|
||||
"supports_tool_choice": true,
|
||||
"supports_web_search": true
|
||||
},
|
||||
"xai/grok-4-1-fast": {
|
||||
"cache_read_input_token_cost": 0.05e-06,
|
||||
"input_cost_per_token": 0.2e-06,
|
||||
"input_cost_per_token_above_128k_tokens": 0.4e-06,
|
||||
"litellm_provider": "xai",
|
||||
"max_input_tokens": 2e6,
|
||||
"max_output_tokens": 2e6,
|
||||
"max_tokens": 2e6,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 0.5e-06,
|
||||
"output_cost_per_token_above_128k_tokens": 1e-06,
|
||||
"source": "https://docs.x.ai/docs/models/grok-4-1-fast-reasoning",
|
||||
"supports_audio_input": true,
|
||||
"supports_function_calling": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_response_schema": true,
|
||||
"supports_tool_choice": true,
|
||||
"supports_vision": true,
|
||||
"supports_web_search": true
|
||||
},
|
||||
"xai/grok-4-1-fast-reasoning": {
|
||||
"cache_read_input_token_cost": 0.05e-06,
|
||||
"input_cost_per_token": 0.2e-06,
|
||||
"input_cost_per_token_above_128k_tokens": 0.4e-06,
|
||||
"litellm_provider": "xai",
|
||||
"max_input_tokens": 2e6,
|
||||
"max_output_tokens": 2e6,
|
||||
"max_tokens": 2e6,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 0.5e-06,
|
||||
"output_cost_per_token_above_128k_tokens": 1e-06,
|
||||
"source": "https://docs.x.ai/docs/models/grok-4-1-fast-reasoning",
|
||||
"supports_audio_input": true,
|
||||
"supports_function_calling": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_response_schema": true,
|
||||
"supports_tool_choice": true,
|
||||
"supports_vision": true,
|
||||
"supports_web_search": true
|
||||
},
|
||||
"xai/grok-4-1-fast-reasoning-latest": {
|
||||
"cache_read_input_token_cost": 0.05e-06,
|
||||
"input_cost_per_token": 0.2e-06,
|
||||
"input_cost_per_token_above_128k_tokens": 0.4e-06,
|
||||
"litellm_provider": "xai",
|
||||
"max_input_tokens": 2e6,
|
||||
"max_output_tokens": 2e6,
|
||||
"max_tokens": 2e6,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 0.5e-06,
|
||||
"output_cost_per_token_above_128k_tokens": 1e-06,
|
||||
"source": "https://docs.x.ai/docs/models/grok-4-1-fast-reasoning",
|
||||
"supports_audio_input": true,
|
||||
"supports_function_calling": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_response_schema": true,
|
||||
"supports_tool_choice": true,
|
||||
"supports_vision": true,
|
||||
"supports_web_search": true
|
||||
},
|
||||
"xai/grok-4-1-fast-non-reasoning": {
|
||||
"cache_read_input_token_cost": 0.05e-06,
|
||||
"input_cost_per_token": 0.2e-06,
|
||||
"input_cost_per_token_above_128k_tokens": 0.4e-06,
|
||||
"litellm_provider": "xai",
|
||||
"max_input_tokens": 2e6,
|
||||
"max_output_tokens": 2e6,
|
||||
"max_tokens": 2e6,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 0.5e-06,
|
||||
"output_cost_per_token_above_128k_tokens": 1e-06,
|
||||
"source": "https://docs.x.ai/docs/models/grok-4-1-fast-non-reasoning",
|
||||
"supports_audio_input": true,
|
||||
"supports_function_calling": true,
|
||||
"supports_response_schema": true,
|
||||
"supports_tool_choice": true,
|
||||
"supports_vision": true,
|
||||
"supports_web_search": true
|
||||
},
|
||||
"xai/grok-4-1-fast-non-reasoning-latest": {
|
||||
"cache_read_input_token_cost": 0.05e-06,
|
||||
"input_cost_per_token": 0.2e-06,
|
||||
"input_cost_per_token_above_128k_tokens": 0.4e-06,
|
||||
"litellm_provider": "xai",
|
||||
"max_input_tokens": 2e6,
|
||||
"max_output_tokens": 2e6,
|
||||
"max_tokens": 2e6,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 0.5e-06,
|
||||
"output_cost_per_token_above_128k_tokens": 1e-06,
|
||||
"source": "https://docs.x.ai/docs/models/grok-4-1-fast-non-reasoning",
|
||||
"supports_audio_input": true,
|
||||
"supports_function_calling": true,
|
||||
"supports_response_schema": true,
|
||||
"supports_tool_choice": true,
|
||||
"supports_vision": true,
|
||||
"supports_web_search": true
|
||||
},
|
||||
"xai/grok-beta": {
|
||||
"input_cost_per_token": 5e-06,
|
||||
"litellm_provider": "xai",
|
||||
|
||||
Reference in New Issue
Block a user