xAI · Grok 4 · Frontier
Grok 4 pricing and limits
xAI's reasoning model with a 256K context window. Reasoning tokens are billed as output, and longer prompts move into a higher price band.
| Line | Tokens | Rate / 1M | Cost |
|---|---|---|---|
| Input, uncached | 6,000 | $3.00 | $0.0180 |
| Input, cache read | 6,000 | $0.75 | $0.00450 |
| Output | 5,000 | $15.00 | $0.0750 |
- Input / 1M
- $3.00
- Output / 1M
- $15.00
- Cached / 1M
- $0.75
- Cache write / 1M
- n/a
- Blended 3:1
- $6.00
- Context
- 256K
What drives Grok 4 cost
Grok 4 reasons on every request and bills reasoning tokens at the output rate, so visible answer length understates cost. Track reasoning tokens per tenant to see the real cost per answer.
Cached input is billed at a quarter of the input rate. xAI applies a higher rate to requests above a context threshold, so long-context agents should prune history to stay in the base band.
Cost of a typical call
Take a reasoning request with 12,000 input tokens, 6,000 of them served from cache, and 5,000 output tokens. At Grok 4 list prices ($3.00 input, $0.75 cached input, $15.00 output per 1M) one call costs $0.0975, against $0.1110 with no cache hits. At 60,000 calls a month that is $5,850, or $6,660 uncached.
Blended at a 3:1 input to output ratio, Grok 4 costs $6.00 per 1M tokens. Routing the same call to the fallback in the policy below, GPT-5 mini, costs $0.0117, which is what a tenant pays you in COGS once they cross the hard cap and PALM SOUQ downgrades instead of blocking.
Cost comparison
Grok 4 against three alternatives
The same reasoning request priced on GPT-5, Claude Sonnet 4.5, Gemini 2.5 Pro. Move the sliders to match your traffic; models without a cache-read rate bill every input token in full.
Benchmark quality per task before switching. A cheaper model that needs more steps or longer outputs can cost more per finished task than its rate suggests, which is why PALM SOUQ reports cost per feature, not only per token.
Grok 4 this guide
$0.0975 per call
$4,875 / mo
baseline
GPT-5
$0.0583 per call
$2,913 / mo
-40% vs Grok 4
Claude Sonnet 4.5
$0.0948 per call
$4,740 / mo
-3% vs Grok 4
Gemini 2.5 Pro
$0.0594 per call
$2,968 / mo
-39% vs Grok 4
List prices from the PALM SOUQ LLM Price Index, computed per call as uncached input + cache reads + output. Reasoning tokens count as output on reasoning models.
Rate limits by usage tier
xAI applies requests per minute and tokens per minute per team and model, visible in the xAI console, and raises them with spend and by request.
Exact limits vary by account tier and change over time, so we do not reprint them here. Check the limits page for your own account in the xAI documentation at docs.x.ai. PALM SOUQ enforces your own per-tenant limits in front of the provider's, so a single customer cannot consume the shared allowance that every other tenant depends on.
Circuit-breaker best practices
Use a per-request output ceiling and a per-tenant reasoning token cap, as with other always-reasoning models.
Set a lower max step cap than you would for a non-reasoning model; each step carries reasoning cost on top of the answer.
When a breaker trips, the gateway answers in under 50 ms with HTTP 429 and X-PalmSouq-Reason: circuit_breaker_triggered, before the request reaches xAI. Your agent framework sees a normal rate-limit response and stops, and the audit log records which heuristic fired and for which tenant.
# palmsouq.policy.yaml
policy: grok-4-business
match:
model: grok-4
tier: business # from X-PalmSouq-Tier
budgets:
monthly_usd: 400 # per tenant
soft_cap_pct: 80 # webhook to your app
on_hard_cap: fallback # or: block (HTTP 429)
fallback:
- gpt-5-mini
breakers:
tool_thrashing: { identical_calls: 3, window_steps: 8 }
token_velocity: { max_tokens_per_s: 50000, window_s: 10 }
semantic_echo: { repeats: 3 }
max_steps: 12
max_reasoning_tokens: 15000 # per request
cache:
meter_reads: true- budgetsPer-tenant monthly dollar cap with an 80% soft-cap webhook, keyed by X-PalmSouq-Tenant.
- fallbackAt the hard cap, requests reroute to GPT-5 mini ($0.69 blended per 1M) instead of failing.
- breakersAll four loop heuristics on, evaluated in the request path with under 5 ms added latency.
Where it fits
Reasoning-heavy tasks and teams evaluating multiple frontier providers side by side through one gateway.
Provider documentation: docs.x.ai
Grok 4 pricing questions
How much does Grok 4 cost per million tokens?
At list price Grok 4 costs $3.00 per 1M input tokens and $15.00 per 1M output tokens, with cached input at $0.75 per 1M. Prices were last reviewed in the PALM SOUQ LLM Price Index and are for the standard tier and shortest context band.
Does Grok 4 support prompt caching?
Yes. Cached input is billed at $0.75 per 1M tokens against $3.00 for uncached input. PALM SOUQ records cached tokens per tenant from the provider's usage data, so cache savings show up in each customer's COGS.
What are the Grok 4 rate limits?
xAI applies requests per minute and tokens per minute per team and model, visible in the xAI console, and raises them with spend and by request. For your account's exact numbers, see the xAI documentation at docs.x.ai.
How do I stop runaway Grok 4 agent loops?
Use a per-request output ceiling and a per-tenant reasoning token cap, as with other always-reasoning models. The sample policy on this page enables all four PALM SOUQ heuristics with a max step cap of 12 and falls back to GPT-5 mini at the hard cap.
Is there a batch discount for Grok 4?
No batch tier at list price. Use caching and model routing to lower cost for asynchronous jobs.
Govern Grok 4 spend per customer.
Point your xAI client at gateway.palmsouqltd.com, pass X-PalmSouq-Tenant, and every Grok 4 token is attributed, capped and protected by circuit breakers.
14-day free production trial · 100k requests included · no card required