Grok Pricing in 2026: API Costs and Calculator
< BlogFundamentals
September 18, 2026
8 minutes read

Grok Pricing in 2026: API Costs and Calculator

Xavier Francuski
Xavier FrancuskiAI Researcher

For the xAI API, Grok pricing starts at $1 per million input tokens and $2 per million output tokens for Grok Build 0.1. Grok 4.3 and the Grok 4.20 family cost $1.25/$2.50, while Grok 4.5 and 4.6 cost $2/$6 — all this applies only for prompts below 200K tokens.

At 200K prompt tokens or more, xAI doubles the input, cached-input, and output rates for the entire request. Grok and SuperGrok consumer subscriptions are charged separately from xAI API usage.

Prices quoted here were verified against xAI's pricing documentation on September 18, 2026.

Grok API pricing by model

Here's a summary of how xAI bills its users' input, cached input, and output tokens:

Grok modelInput per 1M tokensCached input per 1MOutput per 1M tokensContext window
Grok Build 0.1$1.00$0.20$2.00256K
Grok 4.3$1.25$0.20$2.501M
Grok 4.20 family$1.25$0.20$2.501M
Grok 4.5$2.00$0.30$6.00500K
Grok 4.6$2.00$0.50$6.00500K

The Grok 4.20 family currently includes reasoning, non-reasoning, and multi-agent variants at the same token rates.

What happens when a Grok prompt reaches 200K tokens?

Every model switches to long-context pricing at 200K prompt tokens or more: cross that line and the higher rate applies to the entire request, including the tokens below the threshold. Cached tokens count toward the threshold as well.

So, if a request with 199K input tokens and 1K output tokens costs:

  • 199K × $2/M = $0.398 input
  • 1K × $6/M = $0.006 output
  • Total = $0.404

And you add just 1K more input tokens, long-context pricing applies:

  • 200K × $4/M = $0.800 input
  • 1K × $12/M = $0.012 output
  • Total = $0.812
Comparison showing a 199K-token Grok 4.6 request costing $0.404 at standard rates versus a 200K-token request costing $0.812 once long-context pricing applies to the entire request.

How to calculate Grok API cost

For a request below 200K prompt tokens:

Grok API cost = (input tokens ÷ 1M × input rate) + (output tokens ÷ 1M × output rate)

Say an application makes 10,000 Grok requests per month, averaging:

  • 2,000 input tokens per request
  • 500 output tokens per request

That produces 20 million input tokens and 5 million output tokens per month.

Grok modelInput costOutput costTotal monthly cost
Grok Build 0.1$20$10$30
Grok 4.3 / 4.20$25$12.50$37.50
Grok 4.5 / 4.6$40$30$70
Diagram showing Grok API cost calculated as input tokens plus output tokens, with a worked example of 20 million input and 5 million output tokens on Grok 4.6 totaling $70 per month.

Caching, reasoning, tools, and other Grok costs

Several xAI features can change the amount charged beyond the standard input/output calculation:

Cost factorPricing effect
Cached input$0.20–$0.50/M below 200K, depending on model
Reasoning tokensBilled at the model's output-token rate
Priority Processing2× standard token rates when served at the priority tier
Batch API20% discount for Grok 4.3 and Grok 4.20 variants
US regional endpoint1.1× token rates; currently Grok 4.6 only
Web Search$5 per 1,000 calls
Code Execution$5 per 1,000 calls
File Attachments search$10 per 1,000 calls
Collections Search$2.50 per 1,000 calls

xAI automatically caches matching prompt prefixes, although cache hits aren't guaranteed. Using x-grok-conv-id with Chat Completions or prompt_cache_key with the Responses API increases the chance that related requests reach the same cache. Cached input costs less, but those tokens still contribute to the 200K long-context threshold.

Reasoning tokens use the model's output rate. Priority Processing doubles input, output, cached, and reasoning-token prices when xAI actually serves the request at the priority tier. The 20% Batch discount applies only to Grok 4.3 and Grok 4.20 variants; other models bill Batch requests at standard rates.

Overview of Grok cost factors: Priority Processing (2x), US regional endpoint (1.1x), Batch API (-20%), and separate usage fees for web search, code execution, file attachments, and collections search.

Starting September 21, 2026, X Search's pricing changes from a flat $5 per 1,000 calls to $5 per 1,000 posts fetched plus $10 per 1,000 user profiles fetched.

How memory can reduce Grok token costs

Long-running agents build up substantial conversation history and prior task context. Grok has no memory of its own between requests, so every earlier turn an agent still needs has to be re-sent as billed input tokens. The longer a task runs, the more each new request costs, and agents that keep re-reading their own history are especially likely to cross xAI's 200K long-context threshold.

An AI agent memory layer like cognee can preserve information across sessions and retrieve only the relevant context subset for the current request instead.

Take a Grok 4.6 workload with 10,000 monthly requests and 500 output tokens per request:

Context strategyInput per requestMonthly input costOutput costTotal Grok cost
Send 20K tokens of prior context20,000$400$30$430
Retrieve 3K relevant tokens3,000$60$30$90

Reducing the context from 20K to 3K tokens would cut monthly Grok input spend from $400 to $60 in this example, an 85% reduction. Total model spend would drop from $430 to $90 — about 79%.

Comparison showing a Grok request without memory sending 20,000 tokens for $450 total monthly cost versus a request with a persistent memory layer retrieving 3,000 relevant tokens for $90 total, an 85% reduction in input tokens.

That calculation covers Grok usage only, though. Naturally, persistent memory comes with its own ingestion, storage, retrieval, and update costs. Our token-cost study of persistent AI memory measured that tradeoff directly and found a break-even point after roughly 23–26 repeated queries for the corpora tested.

xAI already provides prompt caching for repeated prefixes and context compaction for long conversations. Compaction replaces earlier conversation history with a smaller state representation, reducing the context carried into subsequent requests, however the compaction step itself still consumes input and output tokens.

Persistent memory extends beyond the current conversation by storing information that can be retrieved again in later tasks or sessions.

FAQ

Answers to the most common questions from this guide.

Can you see the exact cost of each Grok API request?

Yes. xAI returns a cost_in_usd_ticks value with each inference response. It reflects the amount actually charged after applicable discounts and includes token usage and server-side tool invocation costs. One US dollar equals 10 billion ticks.

Why can Grok's billed prompt-token count be higher than a tokenizer estimate?

xAI says its inference endpoints add predefined tokens when processing a request. Those additional tokens are included in API prompt-token consumption, so a tokenizer estimate based only on the text you provide can be lower than the billed count.

How does xAI bill for Grok API usage?

Prepaid credits are the standard billing method. xAI calculates API costs as requests are made and deducts them from the available credit balance. Monthly invoiced billing is also available by request, with prepaid credits consumed first. Prepaid API credits are generally non-refundable except where required by law.

Get started

Cognee is the fastest way to start building reliable Al agent memory.

Cognee Cloud
Latest
Grok Pricing in 2026: API Costs and Calculator
Top AI Podcasts for Engineers: 10 Shows Worth Your Time in 2026
AgentBench Explained: Grading LLMs as Multi-Step Agents