Back to Models

Grok 4

xaixai/grok-4

xAI's most powerful reasoning model with 256K token context window. Excels at complex reasoning, coding, and multi-step problem solving with function calling and structured outputs.

Context Length
256K
Max Output
66K
Input Price
$5.40/ 1M tokens
Output Price
$27.00/ 1M tokens

Modalities

textimagetext

Pricing Breakdown

TypeRate
Input$5.40 / 1M tokens
Output$27.00 / 1M tokens

Supported Parameters

temperaturemax_tokenstop_ptoolstool_choiceresponse_formatreasoningstop

API Usage Examples

cURL
curl https://api.therouter.ai/v1/chat/completions   -H "Content-Type: application/json"   -H "Authorization: Bearer $THE_ROUTER_API_KEY"   -d '{
    "model": "xai/grok-4",
    "messages": [
      {"role": "user", "content": "Summarize the key points from this input."}
    ]
  }'