xAI logo

xAI

The pay-per-token API for xAI's Grok models, with a monthly credit program tied to opting in to data sharing.

$1-$4 /1M input depending on model (grok-build-0.1 to Grok 4.5 long-context), output $2-$12

What it actually does

xAI sells API access to the Grok model line, from the cheap grok-build-0.1 at $1/$2 per 1M tokens up to the Grok 4.5 flagship at $2/$6, released July 2026. There is no standing free tier; new accounts get one-time trial credits.

Its distinguishing offer is a data-sharing program: teams that opt in after spending $5 can earn up to $150/mo in API credits, enough to run a small production feature for free, in exchange for sending prompt data to xAI. Grok 4.5 undercuts most frontier flagships and cached input drops to $0.30 (85% off).

Long-context billing is punitive: prompts at or above 200K tokens reprice the whole request at the higher rate, $4/$12 on Grok 4.5. The data-sharing credits are limited to eligible countries and require $5 of prior spend.

xAI vs its main rivals

The tools people actually weigh against xAI: OpenAI, Anthropic Claude, Google Gemini. Same criteria for every column, including where xAI loses.

xAI logoxAIOpenAI logoOpenAIAnthropic Claude logoAnthropic ClaudeGoogle Gemini logoGoogle Gemini
Pricing & access
Free tierNoTrial + credit programNoNoNoOne-time creditsYesOngoing free tier
Starting price$1 /1M in$0.20 /1M in$1 /1M in$0.10 /1M in
Models & capability
Flagship model price$2/$6up to $30/$180$10/$50$4 in (Pro)
Coding & agent benchmark rankCompetitiveStrongLeadsStrong
Multimodal (image)YesImageYesYesYesImageYesYes
Scaling & limits
Max context window256K400K200K-1M1M
No long-context reprice penaltyNoReprices at 200KYesFlatYesTieredNoLong-prompt tier
Cached input discountYes$0.30 (85% off)Yes10% rateYes10% rateYesPaid only
Developer & API
REST API accessPaidPaidPaidFree
OpenAI-compatible endpointYesYesYesNativeNoOwn APIYesCompat mode
Data & compliance
No training on API data by defaultNoOpt-in for creditsYesYesYesYesNoFree tier trains
Worth it for
  • Grok 4.5 at $2/$6 per 1M tokens undercuts most frontier flagships, with cached input at $0.30 (85% off)
  • grok-build-0.1 at $1/$2 is a cheap entry point for high-volume tasks
  • Data-sharing program pays up to $150/mo in credits, enough to run a small production feature free
Watch out for
  • Long-context billing is punitive: prompts at or above 200K tokens reprice the whole request to $4/$12
  • No standing free tier, and the recurring credits require opting in to data sharing
  • Data-sharing credits are limited to eligible countries and need $5 of prior spend

Pay less for it

5 ways found
Data-sharing credits

Up to $150/mo in API credits after $5 prior spend if you accept prompt data sharing

Cached input

Cached tokens billed at $0.30 per 1M, an 85% discount on repeated prompts

Route to grok-build-0.1

Use the $1/$2 tier for simple, high-volume tasks

Stay under 200K tokens

Keep prompts below the long-context threshold to avoid repricing the whole request

Cheaper swap

DeepSeekComparable near-frontier reasoning at roughly a third to a tenth of Grok's per-token cost, without the long-context repricing

See this for your whole stack, with your real numbers

StackTracker tracks what you actually pay for xAI and every other tool, flags overpayment, and shows the dollars you would save by switching.

See plans

Is it the right tool for you

Pick it if
  • You want frontier-class output below Claude and OpenAI flagship prices
  • You are fine trading prompt data for up to $150/mo in credits
  • Your prompts stay comfortably under the 200K long-context threshold
Skip it if
  • You need long-context prompts without a full-request repricing penalty → use Anthropic Claude or Google Gemini
  • You cannot share prompt data and want a free tier → use Google Gemini

Track what xAI and the rest of your stack cost

StackTracker adds up every subscription, plus your hours, so you see the real number.

Prices and limits last verified 2026-07-20.