AI cost calculator

Grok API pricing calculator

Your monthly Grok API bill at xAI's list price. Grok 4.7 costs $2 per million input tokens and $6 per million output tokens, and every token in a request doubles in price once its prompt reaches 200,000 tokens.

Your inputs

Price per million input / output tokens.
tokens
System prompt, context and the user message. About 750 English words is 1,000 tokens.
tokens
Include thinking tokens: they are billed as output.
%
us.api.x.ai, currently Grok 4.7 and 4.6 only.

Result

$1,650 a month on Grok 4.7

$5.50 per 1,000 requests.

Cost per request
$0.0055
Cost per 1,000 requests
$5.50
Per month
$1,650
Per year
$19,800
Saved by prompt caching
$450.00 a monthagainst the same requests with no cache hits
Cheapest xAI model for this workload
Grok Build 0.1$660.00 a month

Worked examples

Each row is the calculator run on the inputs shown, with every other input at its default.

WorkloadModelRequests a dayTokens in / outPer month
Support chatbotGrok 4.75,0003,000 / 300$697.50
Support chatbot on Grok 4.3Grok 4.35,0003,000 / 300$344.25
Coding agent on Grok BuildGrok Build 0.12,00060,000 / 2,000$1,248
Long prompts over 200kGrok 4.7300250,000 / 3,000$5,949
Nightly batchGrok 4.75,00020,000 / 1,000$5,520

How it is calculated

xAI bills input, cached input and output tokens at a price per million tokens. Each model has a short-context price and a long-context price; once a request's prompt reaches 200,000 tokens, every token in that request is billed at the long-context price.

cost per request = (input x (1 - cached share) x input price + input x cached share x cached price + output x output price) / 1,000,000 month = cost per request x requests per day x days x 0.8 Batch, x 2 Priority x 1.1 US endpoint

The Batch API is 20% off on the Grok 4.x models and returns most results within 24 hours. Priority processing costs twice the standard price. The US regional endpoint keeps inference in the United States for 10% more.

Server-side tools are billed on top of tokens: web search and code execution are $5 per 1,000 calls and collections search $2.50 per 1,000. They are not included here. xAI's API docs are now published under the SpaceXSI name.

Questions

How much does the Grok API cost?

Per million tokens: Grok 4.7 is $2 input, $0.50 cached and $6 output; Grok 4.3 is $1.25, $0.20 and $2.50; Grok Build 0.1 is $1, $0.20 and $2. Prices double once a prompt reaches 200,000 tokens.

What is the Grok long-context price?

For prompts of 200,000 tokens or more, Grok 4.7 costs $4 input, $1 cached and $12 output per million tokens, and the higher price applies to every token in that request.

Is Grok cheaper than Claude or GPT?

Grok 4.7 output is $6 per million tokens against $10 for Claude Sonnet 5.5 and GPT-6.1 Sol, with the same $2 input price. The grey bars in the chart compare them on your workload.

What does Grok cost inside Cursor?

Grok 4.7 is in the weekly usage pool of Cursor's paid plans; beyond the pool Cursor bills the same $2 / $6 rates. See the Cursor pricing calculator.

Sources

Prices and plans change. This page was last checked on 2026-10-29. The data is open: llm-prices.json (CC BY 4.0).

Related calculators