xAI API pricing
Prices synced November 22, 2026 from OpenRouter
xAI's API costs $2 per million input tokens and $6 per million output tokens across its 3 current models (November 2026). The cheapest is Grok 4.7 at $2/$6; the most expensive is Grok 4.5 at $2/$6. On the newest, Grok 4.7, a month of daily AI coding comes to roughly $16–$364.
Current models
| Model | Input /1M | Output /1M | Cache read | Context | Coding month* | Released |
|---|---|---|---|---|---|---|
| Grok 4.7 | $2 | $6 | $0.50 | 500k | $16–$364 | Sep 2026 |
| Grok 4.6 | $2 | $6 | $0.50 | 500k | $16–$364 | Aug 2026 |
| Grok 4.5 | $2 | $6 | $0.30 | 500k | $13–$346 | Jul 2026 |
Batch prices
Older models
Released over six months ago or scheduled for retirement. Still callable, priced as listed.
| Model | Input /1M | Output /1M | Cache read | Context | Coding month* | Released |
|---|---|---|---|---|---|---|
| Grok 4.3 | $1.25 | $2.50 | $0.20 | 1M | $7–$188 | Apr 2026 |
| Grok 4.20 Multi-Agent | $1.25 | $2.50 | $0.20 | 2M | $7–$188 | Mar 2026 |
| Grok 4.20 | $1.25 | $2.50 | $0.20 | 2M | $7–$188 | Mar 2026 |
Frequently asked questions
How much does the xAI API cost?
xAI's API costs $2 per million input tokens and $6 per million output tokens across its 3 current models (November 2026). The cheapest is Grok 4.7 at $2/$6; the most expensive is Grok 4.5 at $2/$6. On the newest, Grok 4.7, a month of daily AI coding comes to roughly $16–$364.
Does xAI offer cheaper batch pricing?
Yes. 2 of 3 current xAI models have a batch tier, typically around half the normal price, for jobs that don't need an instant reply.
Does xAI discount cached input?
3 of 3 current models list a cache-read price. In agentic coding most input is re-read context, so the cache price matters more than the headline input price.
Other providers
Coding-month ranges assume 20M–200M tokens of agentic use; see the methodology. Prices are OpenRouter list prices from openrouter.ai/models, which normally match xAI's own. To price a whole build, run the estimator.