Grok 4 API Pricing
As of October 10, 2026, Grok 4 costs $3.00 per 1M input tokens and $15.00 per 1M output tokens from Oracle Cloud (OCI), the lowest of 4 providers. It has a 128,000-token context window and returns up to 128,000 tokens per response.
- Input
- $3.00 / 1M tokens
- Output
- $15.00 / 1M tokens
- Context window
- 128,000 tokens
- Max output
- 128,000 tokens
- Providers
- 4
- Added to LiteLLM
- July 2025
Grok 4 pricing by provider
4 listings across 4 providers. Token prices are in US dollars per 1M tokens. The highlighted row is the price quoted above.
| Provider | Model name in LiteLLM | Input | Output | Context |
|---|---|---|---|---|
| Oracle Cloud (OCI) | oci/xai.grok-4 | $3.00 | $15.00 | 128K |
| Azure AI Foundry | azure_ai/grok-4 | $3.00 | $15.00 | 262K |
| Replicate | replicate/xai/grok-4 | $7.20 | $36.00 | – |
| Vercel AI Gateway | vercel_ai_gateway/xai/grok-4 | $3.00 | $15.00 | 256K |
What Grok 4 costs in practice
1,000 requests with 2,000 input and 500 output tokens each
| Oracle Cloud (OCI) | $13.50 |
| Azure AI Foundry | $13.50 |
| Vercel AI Gateway | $13.50 |
| Replicate | $32.40 |
100 long-document requests with 100,000 input and 2,000 output tokens each
| Oracle Cloud (OCI) | $33.00 |
| Azure AI Foundry | $33.00 |
| Vercel AI Gateway | $33.00 |
| Replicate | $79.20 |
Grok 4 features
- Function calling
- Structured output
- Web search
Use Grok 4 with LiteLLM
Call Grok 4 through the LiteLLM Python SDK, or put it behind the LiteLLM proxy and send OpenAI-format requests to /v1/chat/completions. LiteLLM tracks the cost of every request at these prices.
from litellm import completion
response = completion(
model="oci/xai.grok-4",
messages=[{"role": "user", "content": "Hello!"}],
)model_list:
- model_name: grok-4
litellm_params:
model: oci/xai.grok-4
# credentials: see the provider's LiteLLM docs pagecurl http://0.0.0.0:4000/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-1234" \
-d '{
"model": "grok-4",
"messages": [{"role": "user", "content": "Hello!"}]
}'Grok 4 FAQ
How much does Grok 4 cost?
Grok 4 costs $3.00 per 1M input tokens and $15.00 per 1M output tokens from Oracle Cloud (OCI), the lowest of 4 providers.
What is the context window of Grok 4?
Grok 4 has a 128,000-token context window and returns up to 128,000 tokens per response.
Which providers offer Grok 4?
Grok 4 is available from 4 providers through LiteLLM: Oracle Cloud (OCI), Azure AI Foundry, Replicate and Vercel AI Gateway. The lowest price is on Oracle Cloud (OCI).
How do I call Grok 4 with an OpenAI-compatible API?
Use the LiteLLM Python SDK with model="oci/xai.grok-4", or add the model to the LiteLLM proxy's config.yaml and send requests to /v1/chat/completions from any OpenAI client. LiteLLM tracks the cost of every request at the prices on this page.
What features does Grok 4 support?
Grok 4 supports function calling and web search. It does not support structured output.
When did LiteLLM add Grok 4?
Grok 4 was added to LiteLLM's model price file in July 2025.
Sources
Prices come from LiteLLM's open-source model_prices_and_context_window.json, which LiteLLM uses to calculate the cost of every request. Provider pricing pages:
- www.oracle.com/artificial-intelligence/generative-ai/generative-ai-service/pricing
- learn.microsoft.com/en-us/azure/foundry/foundry-models/concepts/models-sold-directly-by-azure
LiteLLM docs: Oracle Cloud (OCI), Azure AI Foundry, Replicate, Vercel AI Gateway.
Provider pages: Oracle Cloud (OCI), Azure AI Foundry, Replicate, Vercel AI Gateway.
