x-ai/grok-4.7

SpaceXAI: Grok 4.7

Context length
500K
Input / 1M tokens
$2.00
Output / 1M tokens
$6.00
Released
2026-09-21
Modality
text+image+file->text

About SpaceXAI: Grok 4.7

Grok 4.7 is SpaceXAI's flagship model for coding, agentic tasks, and knowledge work, succeeding Grok 4.6. It is particularly strong at long-running software engineering tasks, verifying its own work, and...

Call SpaceXAI: Grok 4.7

Via OpenRouter: one base URL for every provider.

curl https://openrouter.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $OPENROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "x-ai/grok-4.7",
    "messages": [{"role": "user", "content": "Say hello"}]
  }'

Direct on xAI (Grok):

curl https://api.x.ai/v1/chat/completions \
  -H "Authorization: Bearer $XAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "grok-4.7",
    "messages": [{"role": "user", "content": "Say hello"}]
  }'

xAI (Grok) keys

OpenRouter keys

OpenRouter keys work for x-ai/grok-4.7 regardless of the upstream provider.