← All providers

xAI API Pricing, Models & Rate Limits (2026)

xAI trains the Grok family and ships an API built to be a drop-in swap for the OpenAI and Anthropic SDKs — change the base URL and key, keep the client code. Grok 4.3 and the Grok 4.20 pair are the current lineup, all sharing a 1M-token context window.

Also known as: Grok.

Current models
3
Legacy models
2
Price range /M
$1.56–$3.00
Max context
1M
Median tok/s
98
Next retirement

Models and prices

ModelInput /MOutput /MBlended /M
Grok 4.3$1.25$2.50$1.56
Grok-4.20 Reasoning$2.00$6.00$3.00
Grok-4.20$2.00$6.00$3.00
2 legacy xAI models
Grok-3 Mini$0.26/M blended
Grok-3$2.50/M blended

Speed

Fastest measured xAI model is Grok-4.20 at 104 tokens/sec (290ms TTFT), median across measured xAI models is 98 tokens/sec. See the full speed benchmark methodology.

Operational facts

Verified 2026-08-08 against source.

OpenAI-compatibleYes
API base URLhttps://api.x.ai/v1
Auth modelBearer API key
Prompt cachingNot documented
Batch discountNot documented
Free tierFree starting credits for new accounts
Rate-limit modelPer-model rate limits scaled by account tier
Data residencyNot documented
Trains on API dataNot documented
SLA publishedNo
DocsOfficial pricingStatus page

Lifecycle

xAI has 2 legacy models still routable. Full dates and successors on the model deprecation tracker.

Switching to and from xAI

The closest-priced current model to Grok-4.20 Reasoning ($3.00/M) outside xAI is Mistral Large 3 ($3.00/M, 0%). Same request shape through All AI Ask — swap the model id, keep the rest of your code.
The closest-priced current model to Grok-4.20 ($3.00/M) outside xAI is Mistral Large 3 ($3.00/M, 0%). Same request shape through All AI Ask — swap the model id, keep the rest of your code.

Calling xAI through All AI Ask

curl https://allaiask.com/api/v1/chat \
  -H "Authorization: Bearer $ALLAIASK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "grok-4.3", "messages": [{"role": "user", "content": "Hello"}]}'

FAQ

Is xAI OpenAI-compatible?

Yes — xAI's API base (https://api.x.ai/v1) accepts the OpenAI SDK request/response shape, so existing OpenAI client code works with a base-URL and key swap.

Does xAI support prompt caching?

Not documented as of 2026-08-08 — we did not find a published prompt-caching feature for xAI. If that changes, this page updates.

Does xAI have a free tier?

Yes — Free starting credits for new accounts.

How much does the xAI API cost?

Current xAI models range from $1.56 to $3.00 per million blended tokens (3:1 input:output). Full per-model pricing is in the table below.

Where is xAI API data hosted?

Not documented as of 2026-08-08 — no published data-residency commitment found for xAI.

Try xAI for free

Run real prompts against every current xAI model, and every other provider on this site, in one workspace.

Try It Free