Skip to content
Models/xai/Grok 4 20

Grok 4 20

xAI (Grok)·xai·grok-4-20·

xAI Grok 4 flagship with 2-million-token context

Context Window
2.0M
Input price / 1M tokens
Free1M tokens
Output price / 1M tokens
Free1M tokens
Cached input / 1M tokens
Free1M tokens
Max Completion
Input Modalities
text
Output Modalities
text
Function callingChatJSONStreamingNew

Description

xAI Grok 4 flagship with 2-million-token context

Available Providers

AllToken can route requests to the providers below based on route priority and policy.

ProviderContext LengthInput PriceOutput PriceCached / MLatency p50Throughput

Best For

复杂推理, 超长上下文

How To Use This Model

Use the exact model ID shown below. This is the safest way to avoid call failures, variant mismatches, or incorrect route assumptions.

curl https://api.alltoken.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-your-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "grok-4-20",
    "messages": [
      {"role": "user", "content": "Hello!"}
    ]
  }'
Supported Parameters
temperaturetop_pmax_tokenstoolsresponse_format
API Key Setup
Smart Routing

Let the platform choose the best provider path automatically.

Default Model

If a request does not specify a model, default the key to grok-4-20.

Forced Model

Always override incoming requests and lock the key to grok-4-20.