xAI Grok API Pricing
xAI's Grok API has aggressive tiered pricing: requests under 200K tokens cost $5/$15 per million (input/output), but requests with 200K+ tokens jump to $25/$75—a 5× increase. This pricing cliff makes Grok expensive for long-context workloads.
Grok Beta supports up to 512K tokens of context, far more than GPT-4o (128K) or Claude 5.5 (200K). However, the pricing structure heavily penalizes using that full capacity. Understanding the 200K threshold is critical for cost optimization.
This article breaks down Grok's tiered pricing, explains when the higher tier applies, and helps you decide whether Grok's capabilities justify the costs for your use case.
Grok's Two-Tier Pricing Structure
xAI applies different rates based on the total size of your request (input tokens + output tokens):
| Total Request Size | Input Price | Output Price | Multiplier |
|---|---|---|---|
| Under 200K tokens | $5.00 | $15.00 | 1× |
| 200K+ tokens | $25.00 | $75.00 | 5× |
Critical detail: Like Claude's Haiku tiers, this pricing applies to the entire request, not just tokens beyond 200K. If your total request is 201K tokens, you pay the higher rate for all 201K tokens, not $5/M for the first 200K and $25/M for the excess.
What "Total Request Size" Means
The tier is determined by: Input Tokens + Generated Output Tokens
Examples:
- 180K input + 15K output = 195K total: Under 200K → lower tier ($5/$15)
- 195K input + 10K output = 205K total: Over 200K → higher tier ($25/$75)
- 150K input + 60K output = 210K total: Over 200K → higher tier ($25/$75)
You must estimate output length when planning costs. Setting max_tokens too high can unexpectedly trigger the higher tier.
The 200K Cliff: A Cost Example
The pricing jump creates a dramatic cliff effect. Here's what happens as you approach and cross 200K tokens:
| Input | Output | Total | Cost | Tier |
|---|---|---|---|---|
| 180K | 10K | 190K | $1.05 | Lower |
| 190K | 9K | 199K | $1.09 | Lower |
| 195K | 5K | 200K | $1.05 | Lower (exactly at threshold) |
| 195K | 6K | 201K | $5.33 | Higher (5× jump!) |
| 200K | 10K | 210K | $5.75 | Higher |
| 250K | 20K | 270K | $7.75 | Higher |
Notice the jump from 200K to 201K tokens: cost increases from $1.05 to $5.33 for just 1,000 additional tokens. That's a 407% cost increase for 0.5% more content.
Comparison to Other Models
How does Grok's high-tier pricing compare to alternatives for long-context requests?
| Model | Cost | Notes |
|---|---|---|
| GPT-4o | $0.60 | 128K limit (can't handle 200K input) |
| Claude 5.5 Sonnet | $0.75 | Supports 200K, flat pricing |
| Gemini 4 Argon | $0.30 | Supports 1M tokens, no tiers |
| Grok Beta | $5.75 | Higher tier (200K+ total) |
At 210K total tokens, Grok costs 8–19× more than alternatives. For long-context workloads, Grok's pricing is prohibitive unless you need capabilities unavailable elsewhere.
When Does Grok Make Sense?
✅ Short-Context Tasks
For requests well under 200K tokens, Grok's lower tier ($5/$15) is competitive with GPT-4o ($2.50/$10) and Claude Sonnet ($3/$15). If you're consistently under 150K total tokens, Grok is viable.
✅ Real-Time Data Needs
Grok has access to real-time X (Twitter) data and internet search. If your use case requires up-to-the-minute information that other models lack, Grok's premium may be justified.
❌ Long-Context Analysis
For processing large documents, codebases, or transcripts (>200K tokens), use Claude 5.5 Sonnet or Gemini 4 Argon. They handle long contexts at flat rates without pricing cliffs.
Optimization Strategies
Chunk Long Documents
Instead of sending 250K tokens in one request, split into two 125K-token requests. Two lower-tier requests cost $2.50 total vs $7.75 for one higher-tier request.
Limit Output Length
Use max_tokens aggressively. If your input is 190K tokens, set max_tokens=9000 to stay under 200K total. Exceeding by even 1 token costs 5× more.
Pre-Filter Content
Use cheaper models (GPT-4o mini, Gemini Flash) to extract relevant sections first, then send only essential content to Grok. This keeps requests under 200K.
Frequently Asked Questions
What happens exactly at 200,000 tokens?
200K tokens exactly is still lower-tier pricing. At 200,001 tokens or more, the higher tier applies. Plan for a safety margin; don't cut it exactly at 200K.
Does Grok count tokens the same as GPT?
xAI hasn't published details about Grok's tokenizer. Anecdotally, token counts are similar to GPT-4o for English text. Use our calculator to estimate, but always verify with xAI's API response for billing accuracy.
Can I batch requests to avoid the cliff?
xAI doesn't currently offer a batch API. However, you can manually batch by splitting one large request into multiple smaller requests that each stay under 200K.
Is Grok's 512K context window usable?
Technically yes, but economically prohibitive. A 500K-token request costs ~$30–40 on Grok vs ~$2–3 on Gemini 4 Argon. Unless you need Grok's unique capabilities, use a model with flat long-context pricing.
Will xAI change this pricing structure?
Unknown. Grok is currently in beta. Pricing may evolve as xAI scales infrastructure and gathers usage data. Always check current pricing at xAI's official site.