FIELD GUIDE / XAI

xAI Grok API Pricing: Short and Long Context Have Different Tariffs

The xAI developer pricing page checked October 25, 2026 lists grok-4. This is a dated economics guide, not a permanent price guarantee or a personal hands-on benchmark.

As checked 2026-10-25: The xAI developer pricing page checked October 25, 2026 lists grok-4. This is a dated economics guide, not a permanent price guarantee or a personal hands-on benchmark.

Scope: global English reference; USD list prices where shown; local eligibility, currency, taxes, negotiated terms and model release dates require separate confirmation. Dynamic source-page prices have a check date, not a verified initial effective date.

Model and token type have to match

The xAI developer pricing page checked October 25, 2026 lists grok-4.7 in distinct context brackets. For short prompts under 200,000 tokens, the first-party table shows $2 per million input tokens, $0.50 per million cached input tokens and $6 per million output tokens. For long context at or above 200,000 tokens, the listed rates become $4, $1 and $12 respectively. These are observations from a live developer page, not independently established original effective dates.

Threshold mathematics

Take a hypothetical short-context request with 100,000 uncached input and 10,000 output tokens. Applying the documented short tariff gives 0.1 × $2 + 0.01 × $6 = $0.26. A request that crosses the long-context rule should be costed under the long-context schedule according to the service’s documented request-length definition, not by casually assigning the short rate to part of the prompt. Cache behavior and any tool operations must be verified independently.

Do not transpose model identifiers

The same vendor lists different Grok model IDs, including variations in long-context availability, cached input rates and text generation tariffs. An application using an alias or compatibility endpoint must confirm which concrete model version processed the request. Pricing for image, voice and video products may use different units entirely; those require their own modality-specific rows.

How to budget production traffic

Collect tokens and tool calls by actual API response, then aggregate into exact prompt-length buckets. Analyze the share of requests approaching 200k tokens, because small retrieval changes can move an expensive request across a price boundary. Break out failed calls, retries, non-text modalities and any search-related fees. An account dashboard or settled invoice remains the final source for customer-specific charges.

Alternative workflows

If long prompts dominate cost, compress context or retrieve a smaller relevant set and compare quality. If output-heavy jobs dominate, consider a model with a suitable output-price structure after task-specific testing. Cloud intermediaries and subscription chat products have separate commercial schedules, and no comparison rank is implied by this tariff description.

An anti-surprise threshold test

Record the exact field that determines long-context pricing in the live contract, then define automated warning levels well below the published threshold. A research agent that adds retrieved results on every tool loop can grow from a modest prompt to a very large one without an editor noticing. If a vendor reprices the full request after crossing the bracket, the cost impact can exceed the expense of the marginal retrieved passage. Before truncating context, however, preserve the sources that support the user’s decision-critical facts.

Compare actual end-to-end tasks

For two candidate models, hold the acceptance rubric and input documents constant, but record model-specific input/output token counts rather than assuming identical tokenization. Include tool fees, cached input eligibility, context-tier mix, retries and response latency. A cheaper list price on a short prompt can be offset by longer generated answers or repeated calls. The xAI price card provides a rate schedule, not independent evidence of reliability or superior technical performance. Keep comparative rankings with the appropriate independent evaluation team.

Decision checklist

  • Identify the specific plan or API endpoint, model version, region and currency before pricing a job.
  • Measure input, output, caching, generated media and failed-job units separately.
  • Check the official pricing page again before procurement, especially if the SKU has no effective-date notice.
  • Keep source evidence and a timestamped price ID; do not treat unknowns as zero.

Sources & Further Reading

CONTINUE EXPLORINGExplore related files ↗