Grok 4

xAI

xAI's Grok 4 model. Direct, candid responses with strong reasoning and real-time knowledge.

Model highlights
  • Direct responses
  • Strong reasoning
  • Real-time knowledge
  • Code generation
  • Creative writing
Modalities
IntextOuttext
Input / output
$1.25 / $2.50USD per 1M tokens
Context
256K
Providers
Live

Playground

Preparing playground

Providers

primary

API

POST/api/v1/chat/completionsOpenAI-compatible
grok-4
curl https://www.ninjachat.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $NINJACHAT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "grok-4",
    "messages": [{ "role": "user", "content": "Hello!" }],
    "stream": true
  }'
messagestemperaturemax_completion_tokenstop_pstopfrequency_penaltypresence_penaltyseedstreamuserroutingresponse_formatreasoningreasoning_effort

Pricing

Input
$1.25/M tokens
Cached input
$0.125/M tokens
Output
$2.50/M tokens

Published USD rates. Actual cost depends on input, output, cache usage and request options.