LiteLLMModels

Grok 2 API Pricing

As of October 10, 2026, Grok 2 costs $2.00 per 1M input tokens and $10.00 per 1M output tokens on Vercel AI Gateway. It has a 131,072-token context window and returns up to 4,000 tokens per response.

By xAIModel ID vercel_ai_gateway/xai/grok-2Prices updated Checked
Input
$2.00 / 1M tokens
Output
$10.00 / 1M tokens
Context window
131,072 tokens
Max output
4,000 tokens
Providers
1
Added to LiteLLM
February 2025

Grok 2 pricing by provider

1 listing across 1 provider. Token prices are in US dollars per 1M tokens. The highlighted row is the price quoted above.

ProviderModel name in LiteLLMInputOutputContext
Vercel AI Gatewayvercel_ai_gateway/xai/grok-2$2.00$10.00128K

What Grok 2 costs in practice

1,000 requests with 2,000 input and 500 output tokens each

Vercel AI Gateway$9.00

100 long-document requests with 100,000 input and 2,000 output tokens each

Vercel AI Gateway$22.00

Grok 2 features

Use Grok 2 with LiteLLM

Call Grok 2 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.

Python SDK
from litellm import completion

response = completion(
    model="vercel_ai_gateway/xai/grok-2",
    messages=[{"role": "user", "content": "Hello!"}],
)
Proxy config.yaml
model_list:
  - model_name: grok-2
    litellm_params:
      model: vercel_ai_gateway/xai/grok-2
      # credentials: see the provider's LiteLLM docs page
Call the proxy
curl http://0.0.0.0:4000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-1234" \
  -d '{
    "model": "grok-2",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

Grok 2 FAQ

How much does Grok 2 cost?

Grok 2 costs $2.00 per 1M input tokens and $10.00 per 1M output tokens on Vercel AI Gateway.

What is the context window of Grok 2?

Grok 2 has a 131,072-token context window and returns up to 4,000 tokens per response.

Which providers offer Grok 2?

Grok 2 is available from Vercel AI Gateway through LiteLLM, using the model name vercel_ai_gateway/xai/grok-2.

How do I call Grok 2 with an OpenAI-compatible API?

Use the LiteLLM Python SDK with model="vercel_ai_gateway/xai/grok-2", 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 2 support?

Grok 2 supports function calling.

When did LiteLLM add Grok 2?

Grok 2 was added to LiteLLM's model price file in February 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.

LiteLLM docs: Vercel AI Gateway.

Provider pages: Vercel AI Gateway.