AI cost · xAI

xAI API cost: what you actually pay

Every current Grok model prices output at 2x input and quietly tiers up past 200k total context tokens — the public pricing table doesn't show the long-context rate, and cached-input discounts aren't itemized on xAI's own page at all.

Public pricing

Token rates (USD per 1M tokens)

ModelInputOutputCache read
grok-4.3flagship, 1M context; requests over 200k total tokens bill at an undisclosed higher rate; cached rate per third-party trackers, not shown on xAI's own page$1.25$2.5$0.2
grok-code-fast-1coding-specialized, 256k context, ~20% cheaper input than flagship$1$2$0.2

xAI's current public lineup is narrow (2 named models) versus 2025's Grok 3/4/4-fast spread. Output tokens cost exactly 2x input on every current model. Pricing is tiered by context length: requests whose total tokens exceed 200k roll onto a higher, undisclosed-on-the-marketing-page rate.

Last updated: 2026-07-22. Sourced from xAI API Pricing (official), Grok 4.3 on OpenRouter.

Where the real xAI API cost hides

The sticker is the smallest part of the story. For xAI API, these are the line items that quietly inflate the bill:

  • Requests crossing the 200k-total-token threshold roll onto a higher rate not shown on the headline pricing table — long-context RAG or repo-wide coding calls can cross this without warning.
  • Output tokens cost exactly 2x input on every current Grok model, so verbose/chain-of-thought-style completions are the single biggest cost lever, more than the choice between the two available model tiers.
  • xAI has iterated model names rapidly with older endpoints retired from the pricing page; pinning to a dated model string avoids silent resolution to a different-priced default.

What an audit finds on xAI API

Coding agents default to the flagship grok-4.3 for every call, including trivial completions, when grok-code-fast-1 is roughly 20% cheaper on input and purpose-built for code, and teams rarely benchmark whether the flagship's extra cost buys anything on simple tasks.

xAI API pricing FAQ

Does xAI cache repeated prompt prefixes automatically?

Third-party trackers report an automatic cached-input rate around $0.20/M tokens on both current models, well below the $1.00-$1.25/M standard input rate, though xAI's own pricing page doesn't itemize it.

Why did my long-context request cost more than expected?

xAI tiers pricing by context length — requests totaling more than 200,000 tokens move to a higher rate band that isn't broken out on the public pricing table.

What is xAI API really costing you?

Spendassay connects your xAI API spend to actual usage and engineering output — a proof-level AI cost report with the wasted dollars named. Neutral across every AI vendor.

Free · read-only · no card

More: the complete AI cost management guide · every tool, with prices · cost per outcome · compare platforms · how we measure