xAI Grok API Pricing & Cost Calculator (2026)
Current xAI Grok API pricing per million tokens with a live cost calculator, worked examples, the output-price advantage explained and when Grok is the cheaper choice.
xAI's Grok API is a frontier-class option with an unusual commercial trait: its output price is close to its input price, where most frontier APIs charge three-to-five times more for output. Combined with a very large context window, that makes Grok surprisingly economical for the response-heavy workloads where other frontier models get expensive. This page explains the pricing shape, walks through a worked example and shows when Grok is the right call. The table above is from a live feed; the cost calculator shows what your usage costs.
How Grok pricing works
Grok is billed per million input and output tokens, with a large context window (up to ~1M tokens) that reduces the need to chunk long inputs. Its defining feature is the flat-ish input/output ratio: because output isn't penalised the way it is elsewhere, the more your workload generates relative to what it consumes, the better Grok looks compared to its frontier peers.
This is exactly the kind of detail a headline "input price" comparison hides — and exactly what the calculator surfaces, because it models your real output length rather than just the input rate.
A worked example
An agent that writes long responses — say 2,000 input tokens but 4,000 output tokens per call, 20,000 calls a month:
input = 2,000 tokens
output = 4,000 tokens (2× the input)
On a typical frontier API where output costs ~5× input, that 4,000-token output dominates the bill. On Grok, with output priced close to input, the same call is far cheaper. Run this output-heavy profile in the calculator against OpenAI and Anthropic and Grok often wins precisely because of the output ratio — whereas on an input-heavy profile (lots of context, short answers) the ranking can flip.
When Grok is the right pick
- Output-heavy workloads — long-form generation, verbose agents, content drafting — where cheap output tokens compound into real savings.
- Long-context tasks that benefit from the large window without chunking.
- Real-time-oriented use cases that suit Grok's knowledge orientation.
Because the economics depend so much on your input/output mix, Grok is a strong example of why per-token sticker prices mislead: model your actual response length before deciding.
How to think about cost
- Estimate your real output length — this is where Grok's advantage lives; don't under-count it.
- Compare per-task, not per-token — as always, a model that succeeds first time beats a cheaper one you retry.
- Use the large context deliberately — it's convenient, but more input is still more cost; don't pad prompts just because you can.
Grok vs the alternatives
For input-heavy, high-volume simple work, cheaper tiers from Google and DeepSeek usually win. For agentic coding and the hardest reasoning, test against Anthropic and OpenAI. Where Grok distinguishes itself is the output-heavy frontier workload — there, its pricing shape can make it the most economical frontier option. The calculator is the fastest way to find out for your specific mix.
Frequently asked questions
Why is Grok cheaper than other frontier models for my agent? Most likely because your workload generates a lot of output, and Grok prices output close to input rather than at a 3–5× multiple. Output-heavy profiles favour Grok.
Does Grok support prompt caching? Where a cached input rate is available it's reflected in the calculator; otherwise input is billed at the standard rate. Check the model's row in the table above.
Is the large context window free? No — more input tokens always cost more. The big window is about capability (fitting more in one request), not free tokens.
When should I not use Grok? For input-heavy, short-output, high-volume tasks, cheaper balanced/fast tiers elsewhere typically come out ahead. Compare your exact scenario.
Compare Grok across the full field in the LLM API cost calculator.
Prices are auto-refreshed from a live source and dated. Confirm current pricing on xAI's page before committing.