LLM API

xAI API pricing

Review Grok 4.5 token pricing, the 200K long-context threshold, cached-input rates, and additional server-side tool charges.

Decision summary: Shortlist xAI when Grok 4.5 fits the task, then model context-tier changes and tool calls explicitly instead of relying on the short-context token rate alone.
Last checked 2026-07-17high confidence

Pricing overview

xAI prices Grok 4.5 by input, cached input, and output tokens. Requests whose prompt reaches 200K tokens use the higher long-context rate for every token in the request.

Source-tracked model data

xAI API model prices in one table

Example cost uses 1,000,000 input tokens and 300,000 output tokens at each model's default tracked rate, with no cache discount.

ModelInput / 1MCached input / 1MOutput / 1MContextExample cost
Grok 4.5
Stable
$2.00$0.50$6.00500K tokens$3.80

Cost boundary: this example compares token charges only. It does not assume equal output quality, latency, retry rates, or output length across models.

What affects cost

  • Prompt length crossing the 200K long-context threshold
  • Generated output and reasoning tokens
  • Cached-input share
  • Web Search, X Search, code execution, and file tool calls
  • Retries and multi-step agent loops
  • Priority processing when enabled

Lower-cost options from the same provider

  • Grok 4.3 for workloads that pass the same task and quality checks

Alternative providers or products

  • GPT-5.6 Sol
  • Claude Fable 5
  • Gemini 3.1 Pro Preview
  • DeepSeek V4 Pro
  • Kimi K3

Best for

  • teams evaluating Grok 4.5 for coding and agent workflows
  • text and image workloads that fit a 500K context window
  • developers who can track token and server-side tool usage separately

Not ideal for

  • budgets modeled only from the short-context rate
  • workloads with unbounded tool-calling loops
  • teams that require a provider-published maximum-output limit
FAQ

xAI API pricing questions

How much does the Grok 4.5 API cost?

Below 200K prompt tokens, the official rate is $2 per million input tokens, $0.50 per million cached input tokens, and $6 per million output tokens. Requests at or above the threshold use $4 input, $1 cached input, and $12 output per million tokens for the full request.

Does xAI charge separately for search and code execution tools?

Yes. xAI documents separate per-call pricing for server-side tools such as Web Search, X Search, code execution, and file or collection search. StackLens token estimates do not silently include an assumed number of tool calls.

What context window does Grok 4.5 support?

The official Grok 4.5 model page lists a 500,000-token context window. Its higher pricing tier begins when the prompt reaches 200,000 tokens.