xAI

xAI API Pricing 2026

Current API prices per 1 million tokens.

Model

ModelRatePrice / 1M tokens
Grok 4.5
xAI's current flagship Grok model with strong reasoning and multimodal input.
500K context · text/image input · reasoning, tools and structured output.
For requests at or above 200K context, xAI lists higher long-context rates; rows marked long-context show those prices.
Input — <200K context$2
Grok 4.5Cached input — <200K$0.3
Grok 4.5Output — <200K$6
Grok 4.5Input — ≥200K context$4
Grok 4.5Cached input — ≥200K$0.6
Grok 4.5Output — ≥200K$12
Grok 4.20
High-performance Grok model with 1M context and agentic tool calling.
1M context · text/image input · reasoning/non-reasoning variants · function calling.
For requests at or above 200K context, xAI lists higher long-context rates; rows marked long-context show those prices.
Input — <200K context$1.25
Grok 4.20Cached input — <200K$0.2
Grok 4.20Output — <200K$2.5
Grok 4.20Input — ≥200K context$2.5
Grok 4.20Cached input — ≥200K$0.4
Grok 4.20Output — ≥200K$5
Grok Build 0.1
xAI coding model for agentic software engineering and workflow tasks.
256K context · text/image input · reasoning, tools and structured output.
For requests at or above 200K context, xAI lists higher long-context rates; rows marked long-context show those prices.
Input — <200K context$1
Grok Build 0.1Cached input — <200K$0.2
Grok Build 0.1Output — <200K$2
Grok Build 0.1Input — ≥200K context$2
Grok Build 0.1Cached input — ≥200K$0.4
Grok Build 0.1Output — ≥200K$4
Grok 4.6
xAI's latest recommended Grok model for coding, chat and agentic workloads.
500K context · short-context and ≥200K long-context pricing tiers.
xAI charges the higher long-context tier when context is at or above 200K tokens.
Input — <200K context$2
Grok 4.6Cached input — <200K$0.5
Grok 4.6Output — <200K$6
Grok 4.6Input — ≥200K context$4
Grok 4.6Cached input — ≥200K$1
Grok 4.6Output — ≥200K$12
Grok 4.7
xAI's latest frontier Grok model for coding, agentic tasks and knowledge work.
500K context · text/image input · no text output limit · reasoning low/medium/high/xhigh.
xAI charges the higher long-context tier when prompt tokens reach 200K or more. Grok 4.7 Fast is a separate Cursor/Grok Build-only variant billed at twice these token rates.
Input — <200K context$2
Grok 4.7Cached input — <200K$0.5
Grok 4.7Output — <200K$6
Grok 4.7Input — ≥200K context$4
Grok 4.7Cached input — ≥200K$1
Grok 4.7Output — ≥200K$12

How API token cost is calculated

Multiply the number of tokens by the provider rate, then divide by 1,000,000.

cost = tokens × price per 1M ÷ 1,000,000

Example: 250,000 input tokens at $2 / 1M = $0.50.

AI Price History