xAI Grok model selection and capabilities guide. Use when choosing the right Grok model for your task, comparing model features, or optimizing costs.
64
77%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Fix and improve this skill with Tessl
tessl review fix ./.claude/skills/xai-models/SKILL.mdThe canonical home for this skill is xai-models in fernandezbaptiste/Skrillz
Complete guide to selecting the right Grok model for your use case, with pricing and capability comparisons.
| Model | Best For | Input $/1M | Output $/1M | Context |
|---|---|---|---|---|
grok-4-1-fast | Tool calling, agents | $0.20 | $0.50 | 2M |
grok-4 | Complex reasoning | $3.00 | $15.00 | 256K |
grok-3-fast | General tasks | $0.20 | $0.50 | 131K |
grok-3-mini | Lightweight tasks | $0.30 | $0.50 | 131K |
grok-2-vision | Image analysis | $2.00 | $10.00 | 32K |
What's your primary need?
│
├─► Tool calling / Agent workflows
│ └─► grok-4-1-fast ($0.20/$0.50)
│
├─► Complex reasoning / Analysis
│ └─► grok-4 ($3.00/$15.00)
│
├─► General chat / Simple tasks
│ └─► grok-3-fast ($0.20/$0.50)
│
├─► High volume / Cost sensitive
│ └─► grok-3-mini ($0.30/$0.50)
│
└─► Image/Vision tasks
└─► grok-2-vision ($2.00/$10.00)Best for: Tool calling, agentic workflows, real-time search
# Best choice for X search and sentiment analysis
response = client.chat.completions.create(
model="grok-4-1-fast",
messages=[{"role": "user", "content": "Search X for AAPL sentiment"}]
)Features:
Variants:
grok-4-1-fast-reasoning - Maximum intelligencegrok-4-1-fast-non-reasoning - Instant responsesBest for: Deep analysis, complex reasoning, research
# Use for complex multi-step analysis
response = client.chat.completions.create(
model="grok-4",
messages=[{"role": "user", "content": "Analyze market trends..."}]
)Features:
Best for: General purpose, balanced performance
# Good default choice for most tasks
response = client.chat.completions.create(
model="grok-3-fast",
messages=[{"role": "user", "content": "Summarize this..."}]
)Features:
Best for: High-volume, cost-sensitive applications
# Use for bulk processing
response = client.chat.completions.create(
model="grok-3-mini",
messages=[{"role": "user", "content": "Classify: ..."}]
)Features:
Best for: Image analysis, charts, screenshots
import base64
# Encode image
with open("chart.png", "rb") as f:
image_data = base64.b64encode(f.read()).decode()
response = client.chat.completions.create(
model="grok-2-vision",
messages=[{
"role": "user",
"content": [
{"type": "text", "text": "Analyze this chart"},
{"type": "image_url", "image_url": {"url": f"data:image/png;base64,{image_data}"}}
]
}]
)# For filtering/classification - use mini
filter_response = client.chat.completions.create(
model="grok-3-mini",
messages=[{"role": "user", "content": f"Is this relevant? {text}"}]
)
# For analysis - use fast
if is_relevant:
analysis = client.chat.completions.create(
model="grok-4-1-fast",
messages=[{"role": "user", "content": f"Analyze: {text}"}]
)Cached input tokens are 75% cheaper:
# Instead of 10 separate calls, batch them
texts = ["text1", "text2", "text3"]
batch_prompt = "Analyze these texts:\n" + "\n".join(texts)
response = client.chat.completions.create(
model="grok-3-fast",
messages=[{"role": "user", "content": batch_prompt}]
)| Tool | Cost per 1,000 calls |
|---|---|
| X Search | $5.00 |
| Web Search | $5.00 |
| Code Execution | $5.00 |
| Document Search | $2.50 |
| Model | Context | Pages of Text | Hours of Audio |
|---|---|---|---|
| grok-4-1-fast | 2M | ~6,000 | ~50 |
| grok-4 | 256K | ~800 | ~6 |
| grok-3-fast | 131K | ~400 | ~3 |
| grok-2-vision | 32K | ~100 | ~1 |
| Capability | 4.1 Fast | 4 | 3 Fast | 3 Mini | 2 Vision |
|---|---|---|---|---|---|
| Tool Calling | ⭐⭐⭐ | ⭐⭐ | ⭐ | ⭐ | ❌ |
| Reasoning | ⭐⭐ | ⭐⭐⭐ | ⭐⭐ | ⭐ | ⭐⭐ |
| Speed | ⭐⭐⭐ | ⭐ | ⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐ |
| Cost | ⭐⭐⭐ | ⭐ | ⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐ |
| Vision | ❌ | ❌ | ❌ | ❌ | ⭐⭐⭐ |
| X Search | ⭐⭐⭐ | ⭐⭐ | ⭐⭐ | ⭐ | ❌ |
MODELS = {
"filter": "grok-3-mini", # Fast filtering
"analyze": "grok-4-1-fast", # Tool calling + analysis
"deep": "grok-4" # Complex reasoning (rare)
}MODELS = {
"bulk": "grok-3-mini",
"quality_check": "grok-3-fast"
}MODELS = {
"search": "grok-4-1-fast",
"analyze": "grok-4",
"summarize": "grok-3-fast"
}import os
from openai import OpenAI
client = OpenAI(
api_key=os.getenv("XAI_API_KEY"),
base_url="https://api.x.ai/v1"
)
# List available models
models = client.models.list()
for model in models.data:
print(f"{model.id}")
# Use specific model
response = client.chat.completions.create(
model="grok-4-1-fast",
messages=[{"role": "user", "content": "Hello!"}],
max_tokens=100
)xai-auth - Authentication setupxai-agent-tools - Tool callingxai-sentiment - Sentiment analysis93ed392
Canonical home
since Sep 12, 2026
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.