Grok 4.7 API

x-ai/grok-4-7
Grok 4.7 is the flagship large language model by xAI for text generation, coding and reasoning tasks, with a 500K token context window and prompt caching support.
Context
500K tokens
Input
$2.6 / 1M tokens
Output
$7.8 / 1M tokens
Released
Sep 14, 2026

Overview

What Is Grok 4.7 API?

Grok 4.7 is xAI's flagship large language model for text generation, coding and reasoning, with a 500,000-token context window and prompt caching support. It follows Grok 4.5 and Grok 4.6 in the same line and keeps their tiered long-context pricing.

Elon Musk described it publicly as a 2.1-trillion-parameter model, up from 1.5T in Grok 4.6, and “better than 4.6 in every way, except slightly slower to serve, albeit with even better token efficiency”. Those are the vendor's own statements; xAI has not published a parameter count or benchmark card.

Technical Reference

  • Developer: xAI
  • Model ID: x-ai/grok-4-7
  • Alias: grok-4-7
  • Release date: September 14, 2026
  • Context window: 500,000 tokens
  • Modalities: Text, File in → Text out
  • Capabilities: tool calling, parallel tool calls, streaming, file input, prompt caching
  • Endpoint: POST /v1/chat/completions

What Grok 4.7 Brings to the Table

A 500K context window
Long enough for whole repositories, large document sets or extended agent transcripts without chunking.

Tiered long-context pricing
Requests under 200K context bill at the standard rate; above 200K the rate doubles. Worth designing around if prompts sit near the boundary.

Prompt caching
Cached input is a quarter of the standard input rate, which matters for agent loops that re-send the same long prefix.

API Pricing

  • Input: $2.6 / 1M tokens (up to 200K context), $5.2 / 1M above 200K
  • Output: $7.8 / 1M tokens (up to 200K context), $15.6 / 1M above 200K
  • Cached input: $0.65 / 1M (up to 200K), $1.3 / 1M above 200K

Reasoning tokens are billed at the output rate.

Where Grok 4.7 Makes the Most Sense

Agentic workflows
Tool calling and parallel tool calls for loops that plan, call tools and iterate.

Long-context reasoning
Analysis over large codebases and document sets inside the 500K window.

Code
xAI positions the model for code and chat applications.

Sources: https://api.aimlapi.com/v1/models · https://docs.x.ai/developers/models

Uptime and performance

  • Uptime (24h): 86.0%
  • Uptime (7d): 96.0%
  • Availability (24h): 79.0%
  • Error rate (24h): 21.0%
  • End-to-end latency (24h median): 37.1s
  • Throughput (24h median): 64.4 tok/s

Measured on the AI/ML API gateway across live traffic. Figures are medians unless stated. Last updated 2026-10-12.

Use cases

  • Agentic workflows with tool calling and parallel tool calls
  • Long-context reasoning over codebases and document sets
  • Code generation, review and refactoring
  • Conversational assistants needing frontier-level quality

How to use Grok 4.7 API

Install any OpenAI-compatible SDK, point it at api.aimlapi.com/v1, and set the model to x-ai/grok-4-7.
import requests

r = requests.post(
    "https://api.aimlapi.com/v1/chat/completions",
    headers={"Authorization": "Bearer " + AIMLAPI_KEY},
    json={
      "model": "x-ai/grok-4-7",
      "messages": [
        {
          "role": "user",
          "content": "Hello!"
        }
      ]
    },
)
print(r.json())
const r = await fetch("https://api.aimlapi.com/v1/chat/completions", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.AIMLAPI_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "model": "x-ai/grok-4-7",
    "messages": [
      {
        "role": "user",
        "content": "Hello!"
      }
    ]
  }),
});
console.log(await r.json());
curl -X POST https://api.aimlapi.com/v1/chat/completions \
  -H "Authorization: Bearer $AIMLAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"x-ai/grok-4-7","messages":[{"role":"user","content":"Hello!"}]}'

OpenAI-compatible — swap the base URL and it works with your existing SDK.

Grok 4.7 API Pricing

TypePrice
Input
$2.6 / 1M tokens
Output
$7.8 / 1M tokens
Cached input
$0.65 / 1M tokens

Tiered pricing: $2.6/$7.8 per 1M tokens up to 200K context, $5.2/$15.6 above 200K. Cached input: $0.65/1M (≤200K) or $1.3/1M (>200K).

Grok 4.7 Benchmarks

BenchmarkScoreWhat it measuresSourceRetrieved
Intelligence
46.4
Composite score across standardised reasoning, knowledge and problem-solving evaluations, measured independently by Artificial AnalysisSourceSeptember 22, 2026

Frequently asked questions

Yes. Grok 4.7 is live on AI/ML API. Call it on the OpenAI-compatible chat completions endpoint with the model id x-ai/grok-4-7; the short alias grok-4-7 also resolves to it.

Grok 4.7 has a 500,000 token context window, the same as Grok 4.5 and Grok 4.6.

Pricing is tiered by context length. Up to 200K context it is $2.6 / 1M input tokens and $7.8 / 1M output; above 200K both double, to $5.2 and $15.6. Cached input is $0.65 / 1M (≤200K) or $1.3 / 1M (>200K). Reasoning tokens are billed at the output rate.

xAI calls Grok 4.7 the most capable model it has built. Elon Musk described it as a 2.1-trillion-parameter model, up from 1.5T in Grok 4.6, and “better than 4.6 in every way, except slightly slower to serve, albeit with even better token efficiency”. Those are the vendor's own statements — xAI has not published a parameter count or a benchmark card.

Text and file input, text output. Grok 4.7 is a text model — it does not accept images, audio or video.

Requests whose context stays under 200,000 tokens bill at the standard rate. Once a prompt crosses 200K, both the input and output rates double for that request. If your prompts sit near the boundary, it is worth designing around it.

Yes. Like the rest of the Grok 4 line it supports tool calling, parallel tool calls, streaming and prompt caching.

Grok 4.7 was built by xAI as the newest flagship in the Grok 4 family, following Grok 4.5 and Grok 4.6.

Start building with Grok 4.7

Get API Key
1000+ models, one API.