Grok 4.7 API

Grok 4.7 is xAI's flagship large language model for text generation, coding and reasoning, with a 500K token context window and prompt caching support.

Modalities
TextText
In / Out price
$2/$6per 1M
Context window
500K tokens
Released
Sep 14, 2026

Grok 4.7 overview

The pelican test: one prompt, every text model, unedited SVG output from Nov 3, 2026.

SVG of a pelican riding a bicycle, written by Grok 4.7 through AI/ML API

Grok 4.7 by xAI

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.

Grok 4.7 specs

Model ID
x-ai/grok-4-7
Developer
xAI
Context window
500,000 tokens
Input
Text
Output
Text
API
OpenAI-compatible, base URL https://api.aimlapi.com/v1

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

  • 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.

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

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

Capabilities

  • Function calling
  • Streaming
  • File input

Grok 4.7 benchmarks by Artificial Analysis

See how Grok 4.7 compares in intelligence, generation speed and cost per task. Data retrieved Nov 3, 2026.

Intelligence

Index v5.0

Speed

Output tokens / second

Cost per task

USD / benchmark task

Benchmark results

Compare 7 models available on AI/ML API across 4 independent benchmarks.

Humanity's Last Exam

Expert-written questions across academic subjects.

Grok 4.7 API pricing

Grok 4.7 pricing in US dollars
UsagePriceUnit
Input$21M tokens
Output$61M tokens
Cached input$0.51M tokens

Prices from the AI/ML API price list, checked on Nov 4, 2026.

Grok 4.7 vs other models: token prices

AI/ML API input and output rates for 5 models, per million tokens.

AI/ML API model prices in USD per million tokens
ModelInputOutput
Grok 4.7$2$6
Grok Build 0.1$1$2
Grok 4.3$1.25$2.5
Grok 4.6$2$6
Grok 4.5$2$6

How to use the Grok 4.7 API

View docs

Build with your agent

Give your agent the model details, code and documentation.

1Get your API key

Create API key
export AIMLAPI_KEY="8f2b4c7d9a1e6b3f…"

2Make your first request

curl '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": "Write a haiku about the ocean."
    }
  ]
}'

Grok 4.7 FAQ

Is Grok 4.7 available through AI/ML API?

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.

What is the context window of Grok 4.7?

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

How much does Grok 4.7 cost?

Grok 4.7 costs $2 input and $6 output per 1M tokens on AI/ML API, billed as you go with no subscription.

How is Grok 4.7 different from Grok 4.6?

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.

What inputs and outputs does Grok 4.7 support?

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

What is tiered long-context pricing?

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.

Does Grok 4.7 support tool calling?

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

Who created Grok 4.7?

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

What is the Grok 4.7 model ID?

Use x-ai/grok-4-7 as the model parameter. Requests go to the OpenAI-compatible endpoint with your AI/ML API key.

Start building with Grok 4.7

Grok 4.7 API

x-ai/grok-4-7

Build with your agent

Give your agent the model details, code and documentation.

1Get your API key

Create API key
export AIMLAPI_KEY="8f2b4c7d9a1e6b3f…"

2Make your first request

curl '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": "Write a haiku about the ocean."
    }
  ]
}'