Grok 4

Model details

Grok 4

Model
grok-4
Provider
xai
API
openai-completions
Base URL
https://api.x.ai/v1
Input
text
Reasoning
Yes
Context window
256,000
Max tokens
64,000
Cost / million input
$3
Cost / million output
$15
Cost / million cache read
$0.75
Cost / million cache write
$0
Model config JSON
{
  "providers": {
    "xai": {
      "apiKey": "YOUR_API_KEY",
      "models": [
        {
          "id": "grok-4",
          "name": "Grok 4",
          "reasoning": true,
          "input": [
            "text"
          ],
          "contextWindow": 256000,
          "maxTokens": 64000,
          "cost": {
            "input": 3,
            "output": 15,
            "cacheRead": 0.75,
            "cacheWrite": 0
          }
        }
      ],
      "api": "openai-completions",
      "baseUrl": "https://api.x.ai/v1"
    }
  }
}