Grok API Pricing (2026): Every Model, Tool Fee, and Multiplier
Grok API pricing starts at $1.00 per 1M input tokens and $2.00 per 1M output tokens (grok-build-0.1), while the flagship grok-4.7 costs $2.00 input, $0.50 cached input, and $6.00 output per 1M tokens for prompts under 200K tokens. Once a prompt reaches 200K tokens, the long-context rate applies to the whole request ($4 / $1 / $12 for Grok 4.7). All figures below come from the official xAI pricing page and models page, checked on October 20, 2026.
This guide covers every current text, image, video, and voice rate, the five multipliers that change your real bill (long context, priority, US region, batch, and tools), a worked cost calculator, how Grok compares with GPT, Claude, Gemini, and Qwen on price, and runnable curl, Python, and Node examples.
Grok API pricing at a glance
| Item | Answer (as of Oct 20, 2026) |
|---|---|
| Cheapest text model | grok-build-0.1: $1.00 input / $2.00 output per 1M tokens |
| Flagship model | grok-4.7: $2.00 input / $0.50 cached / $6.00 output per 1M tokens |
| Long-context threshold | 200K prompt tokens; the higher rate applies to all tokens in that request |
| Priority processing | 2x standard rates on all token types |
| US regional endpoint | https://us.api.x.ai/v1, billed at 1.1x |
| Batch API | 20% off on Grok 4.3 and Grok 4.20 models; no discount on others |
| Web Search / Code Execution tool | $5 per 1,000 calls |
| Global base URL | https://api.x.ai/v1 |
Source: xAI API pricing, October 20, 2026.
Grok text model pricing (per 1M tokens)
Prices are standard global rates in USD per 1M tokens, from the official pricing table as of October 20, 2026.
| Model | Context window | Prompt size | Input | Cached input | Output |
|---|---|---|---|---|---|
grok-4.7 |
500K | < 200K | $2.00 | $0.50 | $6.00 |
grok-4.7 |
500K | ≥ 200K | $4.00 | $1.00 | $12.00 |
grok-4.6 |
500K | < 200K | $2.00 | $0.50 | $6.00 |
grok-4.6 |
500K | ≥ 200K | $4.00 | $1.00 | $12.00 |
grok-4.5 |
500K | < 200K | $2.00 | $0.30 | $6.00 |
grok-4.5 |
500K | ≥ 200K | $4.00 | $0.60 | $12.00 |
grok-4.3 |
1M | < 200K | $1.25 | $0.20 | $2.50 |
grok-4.3 |
1M | ≥ 200K | $2.50 | $0.40 | $5.00 |
grok-4.20-0309-reasoning |
1M | < 200K | $1.25 | $0.20 | $2.50 |
grok-4.20-0309-non-reasoning |
1M | < 200K | $1.25 | $0.20 | $2.50 |
grok-4.20-multi-agent-0309 |
1M | < 200K | $1.25 | $0.20 | $2.50 |
grok-build-0.1 |
256K | < 200K | $1.00 | $0.20 | $2.00 |
grok-build-0.1 |
256K | ≥ 200K | $2.00 | $0.40 | $4.00 |
The Grok 4.20 models also double to $2.50 / $0.40 / $5.00 at or above 200K prompt tokens. Two details most pricing pages miss:
- Grok 4.5 has cheaper cache reads than 4.6 and 4.7 ($0.30 vs $0.50 per 1M on short prompts). If your workload is dominated by a long, repeated system prompt, 4.5 can beat the newer models on effective input cost.
- Grok 4.3 has a 1M-token context window but a lower price than 4.7. For long-document work where you can stay under 200K per request (with retrieval or chunking), 4.3 costs 37.5% less on input and 58% less on output than 4.7.
xAI's models page recommends Grok 4.7 (developer guide) for code and chat and lists its knowledge cut-off as May 2026, so enable search tools when you need current facts.
Grok Imagine (image and video) and Voice pricing
Media models are not billed per token. Rates from the xAI pricing page, October 20, 2026:
| Model / mode | Unit price |
|---|---|
grok-imagine-image |
$0.02 per image |
grok-imagine-image-2.0 |
$0.04 per image |
grok-imagine-image-quality |
$0.05 per image |
grok-imagine-video-1.5-lite |
$0.020 per second |
grok-imagine-video |
$0.050 per second |
grok-imagine-video-1.5 |
$0.080 per second |
Speech to Speech (grok-voice-3.0) |
$0.08 per minute ($4.80/hour) + $0.004 per text input |
| Speech to Text | $0.10/hour (REST), $0.20/hour (streaming) |
| Text to Speech | $15.00 per 1M characters |
A 10-second clip on grok-imagine-video-1.5 therefore costs $0.80, and the same clip on the 1.5 Lite model costs $0.20. Batch requests for image and video are accepted but billed at standard rates.
The five multipliers that change your real Grok bill
1. Long-context pricing (≥ 200K prompt tokens)
The official rule is that a request whose prompt reaches the threshold is billed at the higher rate for all tokens in the request, not just the tokens above 200K. A 199K-token prompt to Grok 4.7 costs about $0.40 in input; a 201K-token prompt costs about $0.80. Trim history or retrieve fewer chunks to stay under the line.
2. Priority processing (2x)
Priority Processing is billed at 2x standard rates on input, cached, output, and reasoning tokens. You are only charged the priority rate when the response confirms "service_tier": "priority". It works on Chat Completions and Responses only, not on image, video, or batch requests (source, Oct 20, 2026).
3. US regional endpoint (1.1x)
Calls to https://us.api.x.ai/v1 run inference in the United States and cost 1.1x. For Grok 4.7 that works out to $2.20 / $0.55 / $6.60 per 1M tokens below 200K, and $4.40 / $1.10 / $13.20 above. Only grok-4.7 and grok-4.6 are available on this endpoint as of October 20, 2026.
4. Batch API (20% off, selected models)
The Batch API discounts all token types by 20% for grok-4.3, grok-4.20-0309-reasoning, grok-4.20-0309-non-reasoning, and grok-4.20-multi-agent-0309. Grok 4.7, 4.6, and 4.5 have no batch discount. Most batch jobs finish within 24 hours and don't count toward rate limits (Batch API docs).
5. Server-side tools
Agentic requests (tools overview) are billed for tokens plus tool invocations (tools pricing, Oct 20, 2026):
| Tool | Price |
|---|---|
Web Search (web_search) |
$5 per 1,000 calls |
X Search (x_search) |
$5 per 1,000 posts, $10 per 1,000 profiles |
| Code Execution | $5 per 1,000 calls |
| File attachment search | $5 per 1,000 calls |
| Collections search (RAG) | $2.50 per 1,000 calls |
| Remote MCP tools | Tokens only |
X Search is billed per item returned, including parent and quoted posts, so a single thread fetch can count as dozens of billable posts. Storage is extra: $0.025/GiB/day for files and $0.10/GiB/day for collections.
There is also a $0.05 usage-guideline violation fee for requests blocked before generation in the Responses API.
Grok 4.7 Fast: not on the public API
Grok 4.7 Fast is the same model on faster infrastructure at 2x standard rates ($4 / $1 / $12 under 200K). xAI states it is available only in Cursor and Grok Build, billed through those plans, and not on the public xAI API (as of October 20, 2026). If a third-party page quotes a "Grok 4.7 Fast API price", it isn't describing a public xAI endpoint.
Grok API cost calculator
cost = (uncached_input / 1e6 × input_rate)
+ (cached_input / 1e6 × cached_rate)
+ (output / 1e6 × output_rate)
+ tool_calls × tool_rate
then × 2 for priority, × 1.1 for the US endpoint, × 0.8 for batch on eligible models
Example: a support agent on Grok 4.7, 1M conversations a month. Each conversation averages 6,000 input tokens (4,000 of them a cached system prompt), 500 output tokens, and 0.2 web searches.
| Line item | Calculation | Monthly cost |
|---|---|---|
| Uncached input | 2,000M tokens × $2.00 | $4,000 |
| Cached input | 4,000M tokens × $0.50 | $2,000 |
| Output | 500M tokens × $6.00 | $3,000 |
| Web Search | 200,000 calls × $0.005 | $1,000 |
| Total | $10,000 |
Moving the same workload to Grok 4.3 (cached $0.20, input $1.25, output $2.50) cuts the token portion from $9,000 to $4,550. Whether that is a saving depends on resolution rate, so compare cost per resolved conversation, not per request.
Here is a small Python helper you can drop into a notebook:
RATES = { # USD per 1M tokens, xAI pricing page, Oct 20, 2026 (<200K prompt)
"grok-4.7": (2.00, 0.50, 6.00),
"grok-4.5": (2.00, 0.30, 6.00),
"grok-4.3": (1.25, 0.20, 2.50),
"grok-build-0.1": (1.00, 0.20, 2.00),
}
def grok_cost(model, uncached, cached, output, priority=False, us=False):
inp, cache, out = RATES[model]
if uncached + cached >= 200_000: # long-context tier applies to all tokens
inp, cache, out = inp * 2, cache * 2, out * 2
cost = (uncached * inp + cached * cache + output * out) / 1e6
return cost * (2 if priority else 1) * (1.1 if us else 1)
print(round(grok_cost("grok-4.7", 2000, 4000, 500), 6)) # 0.009
The long-context doubling in the helper matches all models listed above with two rows on the official table.
Grok vs GPT, Claude, Gemini, and Qwen: price per 1M tokens
The table compares list rates for frontier and fast tiers. Grok rates are from xAI; the others are the list prices shown on each model's Flatkey model page, all checked on October 20, 2026.
| Model | Input | Cached input | Output |
|---|---|---|---|
grok-4.7 |
$2.00 | $0.50 | $6.00 |
grok-4.3 |
$1.25 | $0.20 | $2.50 |
gpt-6-sol |
$2.00 | $0.20 | $10.00 |
claude-sonnet-5-5 |
$2.00 | $0.20 | $10.00 |
gemini-3.5-flash |
$1.50 | $0.15 | $9.00 |
qwen3.8-max |
$2.00 | $0.25 | $6.00 |
Is the Grok API cheaper than the ChatGPT API? On output-heavy work, yes: Grok 4.7's $6.00 output rate is 40% below the $10.00 list output rate of gpt-6-sol. On cache-heavy work, it's the other way around, because Grok's $0.50 cached-input rate is 2.5x higher. Run your own token mix through the calculator above before deciding. For deeper comparisons, see our AI API pricing comparison and OpenAI API cost guide.
How to get a Grok API key and make your first call
- Sign in to the xAI console, create a team, and add credits.
- Create an API key scoped to the models you need and store it as
XAI_API_KEY. - Call the Responses API (recommended) or Chat Completions at
https://api.x.ai/v1.
A Grok consumer subscription (SuperGrok, X Premium) doesn't include API credits: the API is billed separately per token through the console.
curl -s https://api.x.ai/v1/responses \
-H "Authorization: Bearer $XAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "grok-4.7", "input": "Summarize prompt caching in 3 bullets."}'
Running Grok next to other models with one Flatkey key
As of October 20, 2026, the Flatkey model directory lists xAI's Grok Imagine image and video models but not the Grok text models, so call Grok text directly at api.x.ai. Many teams pair it with a router for everything else: one OpenAI-compatible key at https://router.flatkey.ai/v1 covers GPT, Claude, Gemini, Qwen, DeepSeek, Kimi, and GLM, and you can fall back from Grok to any of them without a second integration.
curl: same key, different model
for MODEL in gpt-6-sol claude-sonnet-5-5 qwen3.8-max; do
curl -s https://router.flatkey.ai/v1/chat/completions \
-H "Authorization: Bearer $FLATKEY_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"model\": \"$MODEL\", \"messages\": [{\"role\": \"user\", \"content\": \"Say hi in 5 words\"}]}"
done
Python: Grok first, Flatkey fallback
import os
from openai import OpenAI, APIError
grok = OpenAI(api_key=os.environ["XAI_API_KEY"], base_url="https://api.x.ai/v1")
flatkey = OpenAI(api_key=os.environ["FLATKEY_API_KEY"], base_url="https://router.flatkey.ai/v1")
ROUTES = [(grok, "grok-4.7"), (flatkey, "claude-sonnet-5-5"), (flatkey, "gpt-6-sol")]
def ask(prompt: str) -> str:
last_error = None
for client, model in ROUTES:
try:
r = client.chat.completions.create(
model=model, messages=[{"role": "user", "content": prompt}], timeout=30
)
return f"[{model}] " + r.choices[0].message.content
except APIError as e: # 429, 5xx, timeouts: try the next route
last_error = e
raise last_error
print(ask("Explain the Grok long-context price rule in one sentence."))
Node.js
import OpenAI from "openai";
const flatkey = new OpenAI({
apiKey: process.env.FLATKEY_API_KEY,
baseURL: "https://router.flatkey.ai/v1",
});
for (const model of ["qwen3.8-max", "gemini-3.5-flash"]) {
const r = await flatkey.chat.completions.create({
model,
messages: [{ role: "user", content: "One-line summary of batch APIs." }],
});
console.log(model, r.choices[0].message.content);
}
For setup details, see the Flatkey quickstart and the OpenAI-compatible base URL guide. Flatkey prices are listed on the pricing page.
How to lower your Grok API bill
- Cache the static prefix. On Grok 4.7, cached input is 75% cheaper than fresh input ($0.50 vs $2.00).
- Stay under 200K prompt tokens. Crossing the threshold doubles the cost of every token in the request.
- Batch offline jobs on Grok 4.3 or 4.20 for 20% off. The 4.7 family has no batch discount.
- Use priority only for user-facing P95 paths. It doubles the bill.
- Cap tool calls. Set a maximum number of searches per request and log X Search item counts.
- Route by task. Send classification and extraction to cheaper models and keep Grok 4.7 for hard reasoning. Our AI API cost optimization strategies and prompt caching ROI guide show how.
- Handle 429s properly. See LLM rate limits explained.
FAQ
How much does the Grok API cost?
Grok 4.7 costs $2.00 per 1M input tokens, $0.50 per 1M cached input tokens, and $6.00 per 1M output tokens for prompts under 200K tokens, rising to $4 / $1 / $12 at or above 200K. The cheapest text model, grok-build-0.1, costs $1.00 / $0.20 / $2.00 (xAI pricing page, October 20, 2026).
Is the Grok API cheaper than the ChatGPT API?
For output-heavy workloads, Grok 4.7's $6 per 1M output tokens is below the $10 list output price of gpt-6-sol as of October 20, 2026. For cache-heavy workloads, GPT's $0.20 cached rate is cheaper than Grok's $0.50. The answer depends on your input/output/cache mix.
Is the Grok API available for free?
xAI doesn't list a free API tier on its pricing page. API usage is prepaid or billed through the xAI console. Check your console for any promotional credits on your team.
Does a Grok subscription include API access?
No. SuperGrok and X Premium subscriptions cover the consumer Grok app. API usage is billed separately per token in the xAI console.
What is the Grok API base URL?
The global base URL is https://api.x.ai/v1. The US regional endpoint, https://us.api.x.ai/v1, costs 1.1x and supports Grok 4.7 and 4.6.
Does Grok offer a batch discount?
Yes, 20% off on Grok 4.3 and the Grok 4.20 models. Grok 4.7, 4.6, and 4.5 have no batch discount (as of October 20, 2026).
How is Grok Imagine video priced?
Per second of output: $0.020/sec for Video 1.5 Lite, $0.050/sec for grok-imagine-video, and $0.080/sec for Video 1.5.
Bottom line
For most text workloads, budget around $2 / $0.50 / $6 per 1M tokens on Grok 4.7, or $1.25 / $0.20 / $2.50 on Grok 4.3. Then add your multipliers: 2x for priority, 1.1x for the US region, 0.8x for batch on eligible models, and the 200K long-context doubling. Re-check the official pricing page and release notes before each budget cycle. If Grok is one of several models in your stack, keep a single OpenAI-compatible key for the rest through Flatkey.
Last updated: October 20, 2026 · Flatkey Team. Prices are in USD and quoted from the official sources linked inline.

