Grok Code Fast
grok-code-fastPricing
List prices at xAI, in US dollars per million tokens.
| Tier | Input / 1M | Output / 1M | |
|---|---|---|---|
| Standard | $1.00 | $2.00 | |
| Cached input 80% off input | $0.20 | 80% off input | |
| Prompts over 200K tokens | $2.00 | $4.00 |
What it costs a month
At xAI list prices, 30 days.
- Chat assistant5,000 requests a day, 2K in / 0.5K out, cached$378
- RAG over documents2,000 requests a day, 8K in / 0.6K out, cached$360
- Coding agent1,000 requests a day, 40K in / 2K out, cached$648
- Overnight batch20,000 requests a day, 4K in / 0.4K out$2,880
Where to run it
1 host serve Grok Code Fast. The comparison is on blended price, 3 parts input to 1 part output.
| Host | In / out per 1M | Model id | |
|---|---|---|---|
xAILab API grok-code-fast | $1.00 / $2.00 | grok-code-fast |
Capabilities
Core
- Streaming
- Function calling
- JSON mode
- Structured outputs
Multimodal
- Vision
- Image input
- Audio
- Image generation
- Video
Advanced
- Reasoning
- Tool calling
- MCP
- Prompt caching
- Batch API
- Embeddings
- Takes in
- TextImages
- Produces
- Text
- Features
- Prompt caching
Cheaper alternatives
Current models that cost less and keep most of what this one can do: tools, vision, reasoning, structured output, caching and enough context.
Same model, cheaper host
No host sells it for less than xAI.
Smaller xAI models
No cheaper xAI model keeps its key capabilities.
Other frontier labs
- 32% less
- 63% less
- 84% less
- 84% less
Open-weight picks
- 45% less
- 49% less
- 58% less
- 61% less
Call it
Using xAI's API.
import os
from openai import OpenAI
client = OpenAI(base_url="https://api.x.ai/v1", api_key=os.environ["XAI_API_KEY"])
completion = client.chat.completions.create(
model="grok-code-fast",
messages=[{"role": "user", "content": "Hello"}],
)
print(completion.choices[0].message.content)from litellm import completion
response = completion(
model="xai/grok-code-fast",
messages=[{"role": "user", "content": "Hello"}],
)
print(response.choices[0].message.content)Quick answers
How much does Grok Code Fast cost?
On xAI, Grok Code Fast costs $1.00 per million input tokens and $2.00 per million output tokens. Cached input costs $0.20 per million tokens.
Which APIs offer Grok Code Fast?
Grok Code Fast runs on 1 API: xAI.
What is Grok Code Fast's context window?
256K tokens, with up to 256K tokens in one reply.
Is Grok Code Fast being retired?
No retirement date is scheduled for it on any API we track.
What are cheaper alternatives to Grok Code Fast?
Models that cost less and keep most of what it can do: Gemini 3.5 Flash Lite on Google AI Studio (32% less), GPT-5.4 Nano on OpenAI (63% less) and Kimi K2.7 Code on CLF AI Gateway (45% less). Savings are on a mix of 3 input tokens to 1 output token.
What is Grok Code Fast's API model id?
Use grok-code-fast with xAI.
Sources
Raw catalog entry for grok-code-fast on xAI
{
"cache_read_input_token_cost": 2e-7,
"cache_read_input_token_cost_above_200k_tokens": 4e-7,
"input_cost_per_image_token": 0.000001,
"input_cost_per_token": 0.000001,
"input_cost_per_token_above_200k_tokens": 0.000002,
"litellm_provider": "xai",
"max_input_tokens": 256000,
"max_output_tokens": 256000,
"mode": "chat",
"output_cost_per_token": 0.000002,
"output_cost_per_token_above_200k_tokens": 0.000004,
"source": "https://api.x.ai/v1/language-models",
"supports_function_calling": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_tool_choice": true,
"supports_vision": true
}