Grok API pricing (xAI)

As of November 3, 2026, the Grok API costs $1 to $2 per million input tokens and $2 to $6 per million output tokens, across 7 Grok models. Grok Build 0.1 costs $1 input and $2 output; Grok Code Fast costs $1 input and $2 output; Grok 4.7 costs $2 input and $6 output. A typical request of 1,000 input and 500 output tokens costs $0.002 on Grok Build 0.1 and $0.005 on Grok 4.7.

Prices updated

Grok API price per 1M tokens, every model

ModelInputCached inputOutputBatch inputBatch outputContextTypical request
Grok Build 0.1
grok-build-0.1
$1$0.2$2––256K$0.002
Grok Code Fast
grok-code-fast
$1$0.2$2––256K$0.002
Grok 4.3
grok-4.3
$1.25$0.2$2.5$1$21M$0.0025
Grok 4.20
grok-4.20
$1.25$0.2$2.5$1$21M$0.0025
Grok 4.5
grok-4.5
$2$0.3$6––500K$0.005
Grok 4.6
grok-4.6
$2$0.5$6––500K$0.005
Grok 4.7
grok-4.7
$2$0.5$6$1.6$4.8500K$0.005

US dollars per million tokens, sorted by the cost of a typical request of 1,000 input and 500 output tokens. Also listed as grok-code-fast-1-0825 (same as Grok Code Fast), grok-4.20-0309-non-reasoning (same as Grok 4.20), grok-4.20-0309-reasoning (same as Grok 4.20), grok-4.20-non-reasoning (same as Grok 4.20) and grok-4.20-reasoning (same as Grok 4.20).

Calculate the cost of your own prompt →

How much does a Grok API request cost?

A typical request of 1,000 input and 500 output tokens costs $0.002 on Grok Build 0.1, $0.002 on Grok Code Fast and $0.005 on Grok 4.7. A coding agent step with 50K tokens of context and 2K output tokens costs $0.11 on Grok 4.7.

ModelShort chat message
300 in, 200 out
Typical request
1K in, 500 out
Long document summary
20K in, 1K out
Coding agent step
50K in, 2K out
1,000 typical requests
Grok Build 0.1$0.0007$0.002$0.022$0.054$2.00
Grok Code Fast$0.0007$0.002$0.022$0.054$2.00
Grok 4.7$0.0018$0.005$0.046$0.11$5.00

At standard rates, for the newest model of each Grok family. A token is about 4 characters of English text, so 1,000 tokens is roughly 750 words. xAI counts tokens with its own tokenizer, so the same text can be a different number of tokens.

How batch, prompt caching and long context change the price

Batch API. 3 of the 7 priced Grok models have a batch API price. Requests sent as a batch are processed within 24 hours and cost 20% less: Grok 4.7 drops from $2 input and $6 output to $1.6 and $4.8 per million tokens. See batch API pricing.

Prompt caching. All 7 priced Grok models charge less for cached input, the part of a prompt that repeats across requests: typically 80% less. Grok 4.7 charges $0.5 per million cached input tokens instead of $2. See prompt caching pricing.

Long context. Grok models accept 256K to 1M input tokens. Long prompts cost more on 7 models: Grok Build 0.1 charges $2 input and $4 output per million tokens once a prompt is over 200K tokens, instead of $1 input and $2 output; Grok Code Fast charges $2 input and $4 output per million tokens once a prompt is over 200K tokens, instead of $1 input and $2 output; Grok 4.3 charges $2.5 input and $5 output per million tokens once a prompt is over 200K tokens, instead of $1.25 input and $2.5 output; Grok 4.20 charges $2.5 input and $5 output per million tokens once a prompt is over 200K tokens, instead of $1.25 input and $2.5 output; Grok 4.5 charges $4 input and $12 output per million tokens once a prompt is over 200K tokens, instead of $2 input and $6 output; Grok 4.6 charges $4 input and $12 output per million tokens once a prompt is over 200K tokens, instead of $2 input and $6 output; Grok 4.7 charges $4 input and $12 output per million tokens once a prompt is over 200K tokens, instead of $2 input and $6 output. A 300K-token prompt with 2K output tokens on Grok 4.7 costs $1.22, against $0.61 at the standard rate.

Grok API vs OpenAI and Claude

It depends on the model. The cheapest Grok model, Grok Build 0.1, costs $0.002 per typical request; the cheapest OpenAI model, GPT-5 nano, costs $0.00025. Grok 4.7 ($0.005) is closest in price to GPT-4.1 ($0.006): 1.2× the price.

Grok modelInput / outputTypical requestClosest OpenAI modelClosest Claude model
Grok Build 0.1$1 / $2$0.002GPT-5.4 mini $0.75 / $4.5 · $0.003 · 1.5× the priceClaude Haiku 4.5 $1 / $5 · $0.0035 · 1.8× the price
Grok Code Fast$1 / $2$0.002GPT-5.4 mini $0.75 / $4.5 · $0.003 · 1.5× the priceClaude Haiku 4.5 $1 / $5 · $0.0035 · 1.8× the price
Grok 4.7$2 / $6$0.005GPT-4.1 $2 / $8 · $0.006 · 1.2× the priceClaude Sonnet 5 $2 / $10 · $0.007 · 1.4× the price

For each Grok model, the model from the other provider whose typical request costs the nearest, with its input / output price per million tokens, its typical request, and how that compares with the Grok model.

Questions and answers

How much does the Grok API cost?

As of November 3, 2026, the Grok API costs $1 to $2 per million input tokens and $2 to $6 per million output tokens, across 7 Grok models. Grok Build 0.1 costs $1 input and $2 output; Grok Code Fast costs $1 input and $2 output; Grok 4.7 costs $2 input and $6 output. A typical request of 1,000 input and 500 output tokens costs $0.002 on Grok Build 0.1 and $0.005 on Grok 4.7.

What is the cheapest Grok model?

Grok Build 0.1 (grok-build-0.1), at $1 per million input tokens and $2 per million output tokens.

How much does a Grok API request cost?

A typical request of 1,000 input and 500 output tokens costs $0.002 on Grok Build 0.1, $0.002 on Grok Code Fast and $0.005 on Grok 4.7. A coding agent step with 50K tokens of context and 2K output tokens costs $0.11 on Grok 4.7.

Is the Grok batch API cheaper?

Yes. 3 of the 7 priced Grok models have a batch API price. Requests sent as a batch are processed within 24 hours and cost 20% less: Grok 4.7 drops from $2 input and $6 output to $1.6 and $4.8 per million tokens.

How much does prompt caching save on the Grok API?

All 7 priced Grok models charge less for cached input, the part of a prompt that repeats across requests: typically 80% less. Grok 4.7 charges $0.5 per million cached input tokens instead of $2.

Does long context cost more on the Grok API?

Yes, on some models. Grok models accept 256K to 1M input tokens. Long prompts cost more on 7 models: Grok Build 0.1 charges $2 input and $4 output per million tokens once a prompt is over 200K tokens, instead of $1 input and $2 output; Grok Code Fast charges $2 input and $4 output per million tokens once a prompt is over 200K tokens, instead of $1 input and $2 output; Grok 4.3 charges $2.5 input and $5 output per million tokens once a prompt is over 200K tokens, instead of $1.25 input and $2.5 output; Grok 4.20 charges $2.5 input and $5 output per million tokens once a prompt is over 200K tokens, instead of $1.25 input and $2.5 output; Grok 4.5 charges $4 input and $12 output per million tokens once a prompt is over 200K tokens, instead of $2 input and $6 output; Grok 4.6 charges $4 input and $12 output per million tokens once a prompt is over 200K tokens, instead of $2 input and $6 output; Grok 4.7 charges $4 input and $12 output per million tokens once a prompt is over 200K tokens, instead of $2 input and $6 output. A 300K-token prompt with 2K output tokens on Grok 4.7 costs $1.22, against $0.61 at the standard rate.

Is the Grok API cheaper than OpenAI?

It depends on the model. The cheapest Grok model, Grok Build 0.1, costs $0.002 per typical request; the cheapest OpenAI model, GPT-5 nano, costs $0.00025. Grok 4.7 ($0.005) is closest in price to GPT-4.1 ($0.006): 1.2× the price.

Source: xAI pricing, via the LiteLLM price list.

Other providers

OpenAI API pricingClaude API pricing (Anthropic)Gemini API pricing (Google)Mistral API pricingDeepSeek API pricing