Intelligence
Index v5.0
Custom pricing for production workloads
Grok 4.7 is xAI's flagship large language model for text generation, coding and reasoning, with a 500K token context window and prompt caching support.
Grok 4.7 is the flagship large language model by xAI for text generation, coding and reasoning tasks, with a 500K token context window and prompt caching support.
x-ai/grok-4-7https://api.aimlapi.com/v1Grok 4.7 is xAI's flagship large language model for text generation, coding and reasoning, with a 500,000-token context window and prompt caching support. It follows Grok 4.5 and Grok 4.6 in the same line and keeps their tiered long-context pricing.
Elon Musk described it publicly as a 2.1-trillion-parameter model, up from 1.5T in Grok 4.6, and “better than 4.6 in every way, except slightly slower to serve, albeit with even better token efficiency”. Those are the vendor's own statements; xAI has not published a parameter count or benchmark card.
A 500K context window
Long enough for whole repositories, large document sets or extended agent transcripts without chunking.
Tiered long-context pricing
Requests under 200K context bill at the standard rate; above 200K the rate doubles. Worth designing around if prompts sit near the boundary.
Prompt caching
Cached input is a quarter of the standard input rate, which matters for agent loops that re-send the same long prefix.
Agentic workflows
Tool calling and parallel tool calls for loops that plan, call tools and iterate.
Long-context reasoning
Analysis over large codebases and document sets inside the 500K window.
Code
xAI positions the model for code and chat applications.
Sources: https://api.aimlapi.com/v1/models · https://docs.x.ai/developers/models
See how Grok 4.7 compares in intelligence, generation speed and cost per task. Data retrieved Nov 3, 2026.
Compare 7 models available on AI/ML API across 4 independent benchmarks.
Expert-written questions across academic subjects.
Agentic tasks completed in a command-line environment.
Reasoning across long documents of about 100k tokens.
Python coding tasks drawn from scientific research.
| Usage | Price | Unit |
|---|---|---|
| Input | $2 | 1M tokens |
| Output | $6 | 1M tokens |
| Cached input | $0.5 | 1M tokens |
Prices from the AI/ML API price list, checked on Nov 4, 2026.
AI/ML API input and output rates for 5 models, per million tokens.
| Model | Input | Output |
|---|---|---|
| $2 | $6 | |
| $1 | $2 | |
| $1.25 | $2.5 | |
| $2 | $6 | |
| $2 | $6 |
Give your agent the model details, code and documentation.
export AIMLAPI_KEY="8f2b4c7d9a1e6b3f…"curl 'https://api.aimlapi.com/v1/chat/completions' \
-H "Authorization: Bearer $AIMLAPI_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "x-ai/grok-4-7",
"messages": [
{
"role": "user",
"content": "Write a haiku about the ocean."
}
]
}'import os
import requests
headers = {
"Authorization": f"Bearer {os.environ['AIMLAPI_KEY']}",
"Content-Type": "application/json",
}
payload = {
"model": "x-ai/grok-4-7",
"messages": [
{
"role": "user",
"content": "Write a haiku about the ocean."
}
]
}
response = requests.post("https://api.aimlapi.com/v1/chat/completions", headers=headers, json=payload, timeout=120)
response.raise_for_status()
print(response.json())const response = await fetch("https://api.aimlapi.com/v1/chat/completions", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.AIMLAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"model": "x-ai/grok-4-7",
"messages": [
{
"role": "user",
"content": "Write a haiku about the ocean."
}
]
}),
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());Yes. Grok 4.7 is live on AI/ML API. Call it on the OpenAI-compatible chat completions endpoint with the model id x-ai/grok-4-7; the short alias grok-4-7 also resolves to it.
Grok 4.7 has a 500,000 token context window, the same as Grok 4.5 and Grok 4.6.
Grok 4.7 costs $2 input and $6 output per 1M tokens on AI/ML API, billed as you go with no subscription.
xAI calls Grok 4.7 the most capable model it has built. Elon Musk described it as a 2.1-trillion-parameter model, up from 1.5T in Grok 4.6, and “better than 4.6 in every way, except slightly slower to serve, albeit with even better token efficiency”. Those are the vendor's own statements, xAI has not published a parameter count or a benchmark card.
Text and file input, text output. Grok 4.7 is a text model, it does not accept images, audio or video.
Requests whose context stays under 200,000 tokens bill at the standard rate. Once a prompt crosses 200K, both the input and output rates double for that request. If your prompts sit near the boundary, it is worth designing around it.
Yes. Like the rest of the Grok 4 line it supports tool calling, parallel tool calls, streaming and prompt caching.
Grok 4.7 was built by xAI as the newest flagship in the Grok 4 family, following Grok 4.5 and Grok 4.6.
Use x-ai/grok-4-7 as the model parameter. Requests go to the OpenAI-compatible endpoint with your AI/ML API key.