Grok Code Fast API pricing
xAI charges $1 per million input tokens and $2 per million output tokens for Grok Code Fast (grok-code-fast), and $0.2 per million cached input tokens. A typical request of 1,000 input and 500 output tokens costs $0.002.
The same prices apply to the model ids grok-code-fast-1-0825.
Grok Code Fast price per million tokens
| Token type | Standard |
|---|---|
| Input | $1 |
| Cached input | $0.2 |
| Output | $2 |
API model id: grok-code-fast. Grok Code Fast supports a 256K-token context window, up to 256K output tokens, image input, tool calling and reasoning.
What Grok Code Fast costs per request
| Request | 1 request | 1,000 requests | 1M requests |
|---|---|---|---|
| Short chat message (300 in, 200 out) | $0.0007 | $0.70 | $700.00 |
| Typical request (1K in, 500 out) | $0.002 | $2.00 | $2,000.00 |
| Long document summary (20K in, 1K out) | $0.022 | $22.00 | $22,000.00 |
| Coding agent step (50K in, 2K out) | $0.054 | $54.00 | $54,000.00 |
At standard rates. A token is about 4 characters of English text, so 1,000 tokens is roughly 750 words. xAI counts tokens with its own tokenizer, so the same text can be a different number of tokens.
How Grok Code Fast compares
- For a typical request, Grok Code Fast is cheaper than 59% of the other models on apicost.app.
- GPT-5.4 mini from OpenAI costs $0.75 input and $4.5 output per million tokens, so a typical request is $0.003: 1.5× the price of Grok Code Fast.
- Claude Haiku 4.5 from Anthropic costs $1 input and $5 output per million tokens, so a typical request is $0.0035: 1.8× the price of Grok Code Fast.
- Gemini 3 Flash Preview from Google Gemini costs $0.5 input and $3 output per million tokens, so a typical request is $0.002: about the same price as Grok Code Fast.
Grok Code Fast price history
Grok Code Fast has cost $1 per million input tokens and $2 per million output tokens since apicost.app started tracking prices on October 22, 2026.
Every LLM API price increase, cut, new and retired model, dated: LLM API price changes.
Models with a similar price
| Model | Provider | Input / 1M | Cached input / 1M | Output / 1M | Typical request |
|---|---|---|---|---|---|
| Gemini 2.5 Flash | Google Gemini | $0.3 | $0.03 | $2.5 | $0.00155 |
| Gemini 3.5 Flash Lite | Google Gemini | $0.3 | $0.03 | $2.5 | $0.00155 |
| DeepSeek R1 | DeepSeek | $0.55 | $0.14 | $2.19 | $0.00164 |
| Mistral Large 4 | Mistral | $0.7 | $0.07 | $2.1 | $0.00175 |
| Gemini 3 Flash Preview | Google Gemini | $0.5 | $0.05 | $3 | $0.002 |
| Grok Build 0.1 | xAI | $1 | $0.2 | $2 | $0.002 |
| Grok 4.3 | xAI | $1.25 | $0.2 | $2.5 | $0.0025 |
| Grok 4.20 | xAI | $1.25 | $0.2 | $2.5 | $0.0025 |
Other xAI models
- Grok 4.3 $1.25 / $2.5
- Grok 4.5 $2 / $6
- Grok 4.6 $2 / $6
- Grok 4.7 $2 / $6
- Grok 4.20 $1.25 / $2.5
- Grok Build 0.1 $1 / $2
Every xAI model side by side, with batch, caching and long-context prices: Grok API pricing (xAI). Ways to pay less: batch API, prompt caching, the cheapest models.
Questions and answers
How much does the Grok Code Fast API cost?
xAI charges $1 per million input tokens and $2 per million output tokens for Grok Code Fast (grok-code-fast), and $0.2 per million cached input tokens. A typical request of 1,000 input and 500 output tokens costs $0.002.
Has the Grok Code Fast API price changed?
No. Grok Code Fast has cost $1 per million input tokens and $2 per million output tokens since apicost.app started tracking prices on October 22, 2026.
Is there a cheaper way to use Grok Code Fast?
Prompt caching lowers the price of input that repeats across requests to $0.2 per million tokens.
What is the context window of Grok Code Fast?
Grok Code Fast accepts up to 256,000 input tokens, roughly 192,000 words of English, and writes up to 256,000 output tokens per response. Filling the whole context window once costs $0.26 in input tokens.
Is Grok Code Fast cheaper than GPT-5.4 mini?
Yes. GPT-5.4 mini from OpenAI costs $0.75 input and $4.5 output per million tokens, so a typical request is $0.003: 1.5× the price of Grok Code Fast.
Source: xAI pricing, via the LiteLLM price list.