# 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.

- Page: https://models.litellm.ai/models/grok-4
- Lab: xAI
- LiteLLM model name: `oci/xai.grok-4`
- Context window: 128,000 tokens
- Max output: 128,000 tokens
- Added to LiteLLM: July 2025
- Prices updated: October 10, 2026

## Pricing by provider

Token prices in USD per 1M tokens.

| Provider | Model name | Input | Output | Cache read | Per image | Per second | 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 |

## Cost examples

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

## Features

Supported: Function calling, Web search.
Not supported: Structured output.

## Use it with LiteLLM

```python
from litellm import completion

response = completion(
    model="oci/xai.grok-4",
    messages=[{"role": "user", "content": "Hello!"}],
)
```

## 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.

Source: LiteLLM model price file, https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json
