Grok 4.7 API pricing
Grok 4.7 is the flagship Grok model from SpaceXAI for coding, agents and knowledge work, succeeding Grok 4.6, with a 500K-token context window and long outputs. On FastInfra the Grok 4.7 API costs $2.16 per million input tokens and $6.48 per million output tokens, through the same OpenAI-compatible API as every other model.
Prices synced November 3, 2026 · Model ID x-ai/grok-4.7
Grok 4.7 specs and pricing
Grok 4.7 API pricing per token
You pay for prompt tokens at the input rate and generated tokens at the output rate. No subscription, seat fee or minimum — credit never expires.
| Rate | Input / 1M tokens | Output / 1M tokens | Input / 1K tokens |
|---|---|---|---|
| Standard (real-time) | $2.16 | $6.48 | $0.00216 |
What Grok 4.7 costs in practice
Worked examples at the standard rate above. Real token counts depend on your prompts.
| Workload | Tokens | Cost |
|---|---|---|
| 1,000 chatbot replies | 1,500 input + 400 output tokens each | $5.83 |
| Summarise a 100-page report | ≈60,000 input + 1,500 output tokens | $0.14 |
| RAG answers over your docs, 10,000 queries | 4,000 input + 300 output tokens each | $106 |
| Coding-agent session | ≈250,000 input + 25,000 output tokens | $0.70 |
| 1M input + 1M output tokens | the per-million list rates combined | $8.64 |
Grok 4.7 cost calculator
Enter your traffic to estimate daily and monthly spend at the live FastInfra rate.
When to use Grok 4.7
Grok 4.7 is tuned for long-running software engineering tasks and for checking its own work before answering. It accepts text, images and files, supports tool calling, structured outputs and reasoning, and can produce very long responses.
Its output price is low compared with other frontier models, which makes it attractive for generation-heavy work such as writing code, long reports or detailed plans. Through FastInfra you can run it side by side with Claude and GPT models from one key to see which performs best on your tasks.
Good fit
- Long software engineering tasks
- Output-heavy generation: code, reports, plans
- Agents that verify their own work
- A frontier model with a lower output price
Consider another model if
- Very high-volume simple tasks
- Contexts beyond 500K tokens
- Workloads that need open weights
How to call the Grok 4.7 API
Works with the official OpenAI SDKs — change the base URL and API key only. One key covers every model on FastInfra.
| Field | Value |
|---|---|
| Model ID | x-ai/grok-4.7 |
| Capability | Chat (vision) |
| Base URL | https://api.fastinfra.ai/v1 |
| Primary endpoint | POST https://api.fastinfra.ai/v1/chat/completions |
| Auth | Authorization: Bearer YOUR_API_KEY |
| OpenAI Chat SDK | Yes — set base_url to the Base URL |
| Validate model id | GET https://api.fastinfra.ai/v1/models/x-ai/grok-4.7 |
| Docs | Integration reference |
Use multimodal message content (image_url). Same base URL as text chat.
Python
from openai import OpenAI
client = OpenAI(api_key="YOUR_API_KEY", base_url="https://api.fastinfra.ai/v1")
stream = client.chat.completions.create(
model="x-ai/grok-4.7",
messages=[{"role": "user", "content": "Explain vector databases in two sentences."}],
stream=True,
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="")
Node.js
import OpenAI from "openai";
const client = new OpenAI({ apiKey: process.env.FASTINFRA_API_KEY, baseURL: "https://api.fastinfra.ai/v1" });
const response = await client.chat.completions.create({
model: "x-ai/grok-4.7",
messages: [{ role: "user", content: "Hello!" }],
});
console.log(response.choices[0].message.content);
curl
curl https://api.fastinfra.ai/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "x-ai/grok-4.7",
"messages": [{"role": "user", "content": "Hello!"}]
}'
Served over 1 independent route. Requests go to the lowest-cost healthy route and fail over automatically if one is unavailable. Live latency and uptime are on the status page.
Grok 4.7 vs alternatives
Live FastInfra prices per 1M tokens. Every model uses the same API key, so switching is a one-line change.
| Model | Input | Output | Context | |
|---|---|---|---|---|
| Grok 4.7 (this page) | $2.16 | $6.48 | 500K | |
| GPT-5.5 | $5.40 | $32.40 | 1.05M | Compare |
| Claude Opus 5 | $5.40 | $27.00 | 1M | Compare |
| Claude Sonnet 5 | $2.16 | $10.80 | 1M | Compare |
| DeepSeek V4 Pro | $1.73 | $3.46 | 1M | Compare |
| Claude Haiku 5.5 | $0.11 | $0.54 | 1M | Compare |
| Grok Build 0.1 | $1.08 | $2.16 | 256K | Compare |
| Grok 4.20 | $1.35 | $2.70 | 2M | Compare |
Grok 4.7 API — frequently asked questions
How much does the Grok 4.7 API cost?
On FastInfra, Grok 4.7 (x-ai/grok-4.7) costs $2.16/1M input, $6.48/1M output tokens. Billing is per token used from prepaid credit, with no subscription or minimum spend.
What is the Grok 4.7 context window?
Grok 4.7 accepts up to 500,000 tokens of context (about 500K) and can generate up to 450,000 output tokens per response. Prompt and response tokens share that window.
Is Grok 4.7 compatible with the OpenAI SDK?
Yes. Point the OpenAI Python or Node SDK at https://api.fastinfra.ai/v1, use a FastInfra API key and set model to "x-ai/grok-4.7". Chat completions, streaming, tool calling and JSON structured output use the same request shape.
Does Grok 4.7 support tool calling and vision?
Grok 4.7 supports tool (function) calling, JSON structured output, configurable reasoning and image input.
What is a cheaper alternative to Grok 4.7?
DeepSeek V4 Pro costs $1.728/1M input and $3.456/1M output tokens on FastInfra. Both use the same API key, so switching is a one-line change to the model string.
Who makes Grok 4.7?
Grok 4.7 is published by SpaceXAI as the successor to Grok 4.6. On FastInfra its model id is x-ai/grok-4.7.
Start using Grok 4.7 today
Create a free account, add credit from $5 and make your first Grok 4.7 request in under five minutes. Compare every model on the pricing page.