Grok 4 API
- Input
- $3per 1M tokens
- Output
- $15per 1M tokens
- Cached input
- $0.75per 1M tokens
- Context
- 256K
Grok 4 for OpenAI-style Chat Completions, Anthropic-style Messages, OpenAI-style Responses.
Explore Grok 4 for OpenAI-style Chat Completions, Anthropic-style Messages, OpenAI-style Responses through the unified API. Supported interfaces and current availability are shown below.
- OpenAI-style Chat Completions
- Anthropic-style Messages
- OpenAI-style Responses
Model details
- Context window
- 256K tokens
- Max output
- 256K tokens
- Input
- Text, images
- Output
- Text
- Capabilities
- Reasoning, Vision, Tool calling, Streaming, JSON output
- Interfaces
- OpenAI-style Chat Completions, Anthropic-style Messages, OpenAI-style Responses
Grok 4 API pricing
Prices use the units shown below. No gateway fees. Usage, size and model options may affect the total.
| Metric | Price |
|---|---|
| / 1M input tokens | $3 |
| / 1M output tokens | $15 |
| / 1M cached input tokens | $0.75 |
| / content review | $0.05 |
| / 1M input tokens · Up to 128K input tokens | $3 |
| / 1M output tokens · Up to 128K input tokens | $15 |
| / 1M cached input tokens · Up to 128K input tokens | $0.75 |
| / 1M input tokens · Above 128K input tokens | $6 |
| / 1M output tokens · Above 128K input tokens | $30 |
What Grok 4 costs for real work
Typical workloads at list price, worked out from the rates above. Nothing is added on top.
| Workload | Tokens | Cost |
|---|---|---|
| 1,000 chat replies | 1,500 tokens in, 400 out, each | $10.50 |
| Summarise a 100-page document | 60K tokens in, 2K out | $0.210 |
| 10M tokens of coding-agent work | 10M tokens: 85% cached input, 12% fresh input, 3% output | $14.47 |
| 1M output tokens | Generated text only | $15.00 |
Grok 4 is pay-as-you-go only
Grok 4 is not included in Token Plans. Call it from a pay-as-you-go balance at the list price above, with no gateway fee.
Why teams pick it
- Grok 4 for OpenAI-style Chat Completions, Anthropic-style Messages, OpenAI-style Responses.
Call Grok 4
Grok 4 answers on any of the APIs below — pick the one your code already speaks and just swap in your Inferray key.
curl https://api.inferray.com/v1/chat/completions \
-H "Authorization: Bearer inferray_..." \
-H "Content-Type: application/json" \
-d '{
"model": "grok-4",
"messages": [
{
"role": "user",
"content": "Hello"
}
]
}'curl https://api.inferray.com/v1/messages \
-H "Authorization: Bearer inferray_..." \
-H "Content-Type: application/json" \
-d '{
"model": "grok-4",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "Hello"
}
]
}'curl https://api.inferray.com/v1/responses \
-H "Authorization: Bearer inferray_..." \
-H "Content-Type: application/json" \
-d '{
"model": "grok-4",
"input": "Hello"
}'Conversation compaction is also available at POST /v1/responses/compact.
Use Grok 4 in your tools
Every coding agent below has a setup guide. Set the model to grok-4.
More from xAI
Alternatives to Grok 4
Questions about this model
- How much does the Grok 4 API cost?
- Grok 4 costs $3 per 1M input tokens and $15 per 1M output tokens on Inferray, and cached input is $0.75 per 1M. That is the list price, with no gateway fee on top.
- Is there a free tier for Grok 4?
- No. You add credit and pay Grok 4's list rate for each request — seats, projects, and API keys are free, and pay-as-you-go credit never expires.
- Am I charged for failed requests?
- No. A request that fails without returning a result is not billed. If a response fails part-way, the tokens already processed before the failure are charged.
- Is Grok 4 included in Token Plans?
- No. Grok 4 is pay-as-you-go only; Token Plans cover the other text models in the catalog.
- Can I use Grok 4 in Claude Code?
- Yes. Set ANTHROPIC_BASE_URL to https://api.inferray.com, ANTHROPIC_AUTH_TOKEN to your Inferray key, and ANTHROPIC_MODEL to grok-4. The same key works in Codex, opencode, Cline, and other agents.
- Does Grok 4 support tool calling and vision?
- Grok 4 supports tool calling, image input, reasoning, JSON output and streaming on Inferray.
- Is it the real Grok 4?
- Yes. A request for grok-4 is answered by Grok 4 from xAI, billed at its published list price. Inferray never substitutes a different or smaller model.
Prices from the catalog as of November 12, 2026.