xAI API

xAI API pricing charges per million tokens, with a second rate card that switches on once a prompt reaches 200k tokens.

Pricing Model:

Pricing Model:

Pure usage, prepaid

Pure usage, prepaid

Pure usage, prepaid

Packaging Model:

Packaging Model:

Good / Better / Best (GBB)

Good / Better / Best (GBB)

Good / Better / Best (GBB)

Credit Model:

Credit Model:

Prepaid balance, or invoicing on an enterprise agreement

Prepaid balance, or invoicing on an enterprise agreement

Prepaid balance, or invoicing on an enterprise agreement

Updated on:

xAI API pricing: one rate card, three places to buy it

xAI API pricing charges per million tokens, with a second rate card that switches on once a prompt reaches 200k tokens. Grok 4.7 and Grok 4.6 both run $2 input and $6 output, and both double above that line. xAI also sells the same models through Microsoft Azure and inside Cursor, and all three surfaces quote the same numbers, so the multipliers on top are where the money moves.

Key takeaways

  • Grok 4.7, 4.6 and 4.5 all cost $2.00 per million input tokens and $6.00 output, a 3x spread. Grok 4.3 runs $1.25 and $2.50 on a 1M context window.

  • Long context isn't a surcharge, it's a second rate card. Cross 200k prompt tokens and every token in the request bills at exactly 2x, cached tokens included.

  • The batch discount is 20% and reaches four models, none of them the flagship, so Grok 4.7 has no cheap asynchronous lane.

  • Every response carries its own price in a cost_in_usd_ticks field, net of caching, at 10 billion ticks to the dollar.

xAI API pricing in 2026

Model

Context

Input

Cached input

Output

grok-4.7

500k

$2.00 / $4.00

$0.50 / $1.00

$6.00 / $12.00

grok-4.6

500k

$2.00 / $4.00

$0.50 / $1.00

$6.00 / $12.00

grok-4.5

500k

$2.00 / $4.00

$0.30 / $0.60

$6.00 / $12.00

grok-4.3

1M

$1.25 / $2.50

$0.20 / $0.40

$2.50 / $5.00

grok-build-0.1

256k

$1.00 / $2.00

$0.20 / $0.40

$2.00 / $4.00

What xAI actually meters

xAI meters tokens, tool calls, media and stored files, and keeps the four apart. Tokens carry one twist worth planning around: the cache discount shrinks on the newest models. Grok 4.5 serves cached input at 15% of base and Grok 4.3 at 16%, but Grok 4.6 and 4.7 at 25%. Files bill again on top, at $0.025 per GiB per day.

Server-side tools bill separately from the tokens they consume. Web search, code execution and attachment search each cost $5 per 1,000 calls, collections search $2.50. X Search charges by item rather than by call: $5 per 1,000 posts returned and $10 per 1,000 profiles. Image understanding and remote MCP tools carry no invocation fee at all.

Three modifiers sit on top. Priority Processing doubles every token type, and xAI charges it only when the response confirms "service_tier": "priority". The US regional endpoint adds 10%, putting Grok 4.7 at $2.20, $0.55 and $6.60. Batch cuts 20%, on Grok 4.3 and the three Grok 4.20 builds alone, so batched Grok 4.3 lands at $1.00 and $2.00. Caching applies before every multiplier.

What the same Grok models cost elsewhere

The same Grok models cost the same elsewhere, nearly to the cent. Microsoft's retail price API lists Grok 4.6 in East US at $0.002 per 1,000 input tokens, $0.0005 cached and $0.006 output, which is $2.00, $0.50 and $6.00 per million: xAI's own figures, long-context tier included. Azure's Data Zone deployment adds exactly 10%, the same premium xAI charges for US-pinned inference. Azure also sells provisioned throughput at $1.00 per unit-hour globally, which xAI doesn't, and stops at Grok 4.6.

Cursor publishes the same $2, $0.50 and $6 for Grok 4.7. One number differs: Cursor puts long context above 256k input tokens and xAI puts it at 200k. We're not picking a winner, because each vendor describes its own serving boundary and both are first-party to the surface they sell. The effect is real, though. A 220k-token prompt bills at double on api.x.ai and at standard rates in Cursor.

What happens when you hit
the limit

Nothing throttles, because nothing is included. You load the account with prepaid credits before the first call, and spending stops when the balance does. Enterprise accounts invoice instead.

Rate limits bite first, and xAI ties them to cumulative spend since 1 January 2026: Tier 0 at $0, then $50, $250, $1,000 and $5,000. Tiers unlock automatically and never downgrade. Limits run per model on requests per second and tokens per minute, and the per-second figure is RPM divided by 48, so a minute's budget can't go out in one burst. Grok 4.7 starts at 150 RPS and 50M tokens per minute and reaches 500 RPS and 100M at Tier 4. Exceeding either returns HTTP 429.

How xAI API pricing has changed

xAI API pricing has held steady through three flagship launches, with every change adding a model or a lever rather than moving a rate. Release notes date by month, so these rows do too.

Date

Milestone

Source

Sep 2026

Grok 4.7 launches at $2 / $0.50 / $6 below 200k prompt tokens, $4 / $1 / $12 above

docs.x.ai/developers/release-notes

Aug 2026

Grok 4.6 launches on the same rate card as 4.7

docs.x.ai/developers/release-notes

Jul 2026

Grok 4.5 ships at $2 input and $6 output, with cached input at $0.30

docs.x.ai/developers/release-notes

Jun 2026

Priority Processing arrives at 2x, charged only when the response confirms the tier

docs.x.ai/developers/release-notes

Apr 2026

Cost tracking lands: every response returns cost_in_usd_ticks for that request

docs.x.ai/developers/release-notes

Nov 2025

Agent tool prices cut by up to 50%, to no more than $5 per 1,000 successful calls

docs.x.ai/developers/release-notes

Source: docs.x.ai/developers/release-notes, read 9 October 2026.

Flexprice’s Take

Returning the exact cost of a request inside the response is the single best billing decision any model provider in this index has made, and nobody else has copied it.

The figure arrives net of caching and tool invocations, in integers at 10 billion ticks to the dollar, so thousands of requests add up without rounding drift. Teams reselling Grok get margin per call for free rather than reconciling against an invoice weeks later.

The card is honest about its own complexity too. xAI says caching applies before multipliers, that priority bills only when the response confirms it, and that long context reprices the whole request.

The gaps are real. The 20% batch discount skips every flagship, which makes it close to decorative on Grok 4.7, and a card that's identical on three surfaces still sets long context at 200k on one and 256k on another.

Best For

Teams that need per-request cost attribution without building it.

Watch Out For

Prompts between 200k and 256k, where the surface you call changes the bill.

Manish Choudhary

CEO & Co-founder, Flexprice

Reselling model access and need per-model, per-customer cost tracking?

Flexprice meters it and reports margin by account.

Flexprice’s Take

Returning the exact cost of a request inside the response is the single best billing decision any model provider in this index has made, and nobody else has copied it.

The figure arrives net of caching and tool invocations, in integers at 10 billion ticks to the dollar, so thousands of requests add up without rounding drift. Teams reselling Grok get margin per call for free rather than reconciling against an invoice weeks later.

The card is honest about its own complexity too. xAI says caching applies before multipliers, that priority bills only when the response confirms it, and that long context reprices the whole request.

The gaps are real. The 20% batch discount skips every flagship, which makes it close to decorative on Grok 4.7, and a card that's identical on three surfaces still sets long context at 200k on one and 256k on another.

Best For

Teams that need per-request cost attribution without building it.

Watch Out For

Prompts between 200k and 256k, where the surface you call changes the bill.

Manish Choudhary

CEO & Co-founder, Flexprice

Reselling model access and need per-model, per-customer cost tracking?

Flexprice meters it and reports margin by account.

Customer
Sentiment Highlights

"anyone using grok 4.6 via API pricing should be aware that while their headline pricing is good, the pricing that actually matters is pretty bad"

Developer on xAI API cache-read rates, Hacker News, August 2026

"I opened a developer API account, loaded 5 dollars and got the free $100s of credits for the month. Like two weeks later, xAI announced they were shutting down the subsidized credits entirely lol"

Former xAI API account holder, Hacker News, August 2026

Frequently Asked Questions

Frequently Asked Questions

How much does the xAI API cost?

Does xAI charge extra for cached input?

Is there a batch discount on the xAI API?

What does web search cost on the xAI API?

Launch usage-based billing this week, not next quarter

Launch usage-based billing this week, not next quarter

Get Instant Feedback on Your Pricing | Join the Flexprice Community with 500+ Builders on Slack

Join the Flexprice Community on Slack