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.

Worked example: xAI API at production volume

Take 50M input and 10M output tokens a month — a modest production workload, and a round number we picked — on grok-4.3 at the published rates above.

Monthly
$88
Annual
$1,050
On grok-code-fast-1
$70

Same volume, $210 a year apart. Most workloads are a mix — some of it genuinely needs the frontier model and some of it does not — so the real question is what share of your calls is the routine kind, and that is a measurement, not a guess.

Arithmetic on the published prices above. Your mix will differ — run your own numbers.

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.

How much can routing cut a xAI API bill?

On 50M input and 10M output tokens a month, grok-4.3 costs $88 at published rates and grok-code-fast-1 costs $70 — $210 a year apart for the same volume. What you can actually move depends on how much of your traffic is routine, which is a measurement rather than a guess.

Are these xAI API prices current?

They were last checked against xAI API Pricing (official) and Grok 4.3 on OpenRouter on 2026-07-22. Every price on this page carries that date and a link to its source, and a scheduled check fails our build when any figure goes more than 30 days unverified. Vendors do change pricing between checks — the source link is there so you can confirm before you sign.

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