xAI: Grok 4.7
X-ai
Sep 21, 2026
x-ai/grok-4.7
Context Length500,000
Input Price$2.00/1M tokens
Output Price$6.00/1M tokens
Max Output
Blended Price$3.00/1M tokens

Grok 4.7 is xAI's flagship multimodal reasoning model, built on a new, larger base model than Grok 4.6 (reportedly ~2.1T parameters vs. 1.5T) with a longer reinforcement-learning run weighted toward multi-hour tasks. It accepts text and images, supports a 500K-token context window, four reasoning levels (low, medium, high, xhigh), and native understanding of the Grok Bot harness for agentic coding and knowledge work. xAI reports stronger self-verification, long-context handling, and document/presentation generation, at the same per-token price as Grok 4.6.

Input Modalitiestext, image
Output Modalitiestext
Modalitytext+image->text
TokenizerGrok
Provider Details

x-ai

JSON
Input Cost$2.00/1M tokens
Output Cost$6.00/1M tokens
Context Length500,000
Max Output500,000
Latency-
Throughput-
Pricing Details
Input Cost$2.00/1M tokens
Output Cost$6.00/1M tokens
Input Cache Read Cost$0.50/1M tokens
Input Cost (>200K input)$4.00/1M tokens
Output Cost (>200K input)$12.00/1M tokens
Supported Parameters
Parameter
Type
X-AI
Core (Sampling & basic generation)
max_tokensMaximum tokens to generate.
number
1 to 500000
stopSequences where generation stops.
array
temperatureControls randomness of output.
number
0 to 2
top_kLimits sampling to top K tokens.
number
≥ 0
top_pNucleus sampling threshold.
number
0 to 1
Reasoning (Reasoning Controls)
reasoning_effortReasoning effort before answering.
string
"low", "medium", "high", "xhigh"default: high
Tool Use (Function Calls & Tools)
tool_choiceHow the model should use tools.
string
"auto", "required", "none"
toolsTool/function definitions available to the model.
array
Output & Format (Response Formatting)
response_formatStructured output format configuration.
string
"text", "json_object", "json_schema"

Throughput

Latency

Make Your First API Call

Get started by making your first request to FastRouter. Use your favorite SDK or make direct API calls.

Copy
from openai import OpenAI
client = OpenAI(
base_url="https://api.fastrouter.ai/api/v1", # FastRouter base URL
api_key= "<FASTROUTER_API_KEY>", # Replace with your FastRouter API key
)
completion = client.chat.completions.create(
model="x-ai/grok-4.7", # Replace with your model ID
messages=[
{ "role": "user", "content": "What is the meaning of life?" }
]
)
print(completion.choices[0].message.content)

Before you run this code:

  1. Replace <FASTROUTER_API_KEY> with your actual API key
  2. Install the OpenAI SDK: pip install openai
  3. Run the code, then check your dashboard for analytics
Frequently Asked Questions

More models from X-ai
x-ai/grok-4.6

Grok 4.6 is xAI's frontier multimodal reasoning model for coding, long-running agentic tasks, knowledge work, and interactive/visual projects, released as the successor to Grok 4.5. It accepts text and images and returns text, with a 500,000-token context window, a February 1, 2026 knowledge cutoff, and four reasoning-effort levels (low, medium, high, xhigh, with high as default). It supports function calling, JSON-schema structured outputs, web search, X search, code execution, and prompt caching, and received a longer supplemental training run than 4.5 with curated technical and agentic reasoning data.

x-ai/grok-imagine-video-1.5

Grok Imagine Video 1.5 is xAI’s next-generation AI video model for animating still images into short, cinematic clips. It preserves the source image’s composition and identity while adding motion, camera movement, and synchronized audio such as dialogue, effects, ambience, and music.

x-ai/grok-4.5

Grok 4.5 is xAI’s flagship multimodal reasoning model optimized for coding, agentic workflows, and knowledge work, with support for very long contexts (up to ~500K tokens) and tools. It accepts text and images and can call tools for search, code execution, and other actions via the xAI API. Designed as an Opus-class model, it targets high performance at aggressive per-token pricing for large, tool-heavy sessions.

x-ai/grok-3-beta

Grok 3 Beta is xAI's flagship model featuring specialized domain expertise in finance, healthcare, law, and scientific fields. This enterprise-focused solution delivers exceptional performance in data extraction, code generation, and text summarization tasks. Released in 2025, the model particularly excels in structured tasks and achieves superior results on challenging benchmarks like GPQA, LCB, and MMLU-Pro, consistently outperforming the smaller Grok 3 Mini even when the latter operates at high thinking levels. Grok 3's sophisticated knowledge architecture makes it particularly valuable for professional and technical applications requiring deep contextual understanding in regulated industries. The model offers dual deployment options: a standard endpoint optimized for quality and a fast endpoint prioritizing throughput, allowing users to select the appropriate performance profile based on their specific application requirements.

x-ai/grok-3-mini-beta

Grok 3 Mini Beta is xAI's lightweight reasoning model designed specifically for quantitative problem-solving with transparent thinking processes. Unlike conventional AI systems that generate immediate answers, this model implements explicit reasoning steps before responding, making it particularly effective for mathematics, puzzles, and logical reasoning tasks. The model defaults to low reasoning effort but can be configured with increased reasoning capacity (reasoning: { effort: high }) for more complex problems. With accessible thinking traces, users can examine the model's step-by-step problem-solving approach, providing valuable insights into its reasoning process. This beta release offers early access to xAI's reasoning capabilities through dual endpoint options: a standard endpoint optimized for quality and a fast endpoint prioritizing throughput for latency-sensitive applications.

x-ai/grok-4

Grok 4, launched by xAI in July 2025, represents a significant leap in large language model development. Building on earlier versions like Grok 3 and the original 2023–24 models, Grok 4 introduces several key enhancements aimed at performance, versatility, and real-world application. It features an extended context window of up to 256,000 tokens, enabling it to process long documents, codebases, or conversations with greater depth and continuity. The model demonstrates strong performance in advanced reasoning tasks, including mathematics and programming. Its architecture supports multimodal input, with capabilities for vision and voice currently in development, and introduces advanced voice interaction with faster response times and more natural flow.

x-ai/grok-4-fast

Grok-4-Fast is xAI’s latest efficiency-focused generative AI model, designed to deliver high-speed responses with significant improvements in cost and latency over the original Grok 4. It features a unified architecture that seamlessly handles both reasoning and non-reasoning tasks; this allows it to produce quick replies for simple queries and dive deeply into complex coding or reasoning problems when needed. One of its standout capabilities is the very large 2 million token context window, enabling it to process lengthy documents, multi-hour transcripts, or entire codebases in one go. Grok-4-Fast achieves roughly 40% greater token efficiency than Grok 4, reducing computational cost by up to 98% in benchmark tasks while maintaining state-of-the-art performance in reasoning, search, and coding benchmarks such as GPQA Diamond and AIME 2025. The model supports advanced features like multimodal input (text, image, voice), tool and web search integration, and function calling for structured outputs, making it suitable for both enterprise automation and consumer apps.

x-ai/grok-4.1-fast

Grok 4.1 Fast by xAI is a state-of-the-art large multimodal language model, specifically designed for agentic tool-calling, long-context workflows, and production-grade low-latency inference. It features a massive 2 million token context window, making it ideal for complex, multi-hour conversations, deep research, and supporting tasks like customer support, code execution, and document retrieval.

x-ai/grok-4.20-beta

Grok 4.20 Beta is xAI’s newest flagship large language model that uses four specialized “agents” working together to answer complex questions more accurately and with deeper reasoning than prior Grok versions.

x-ai/grok-4.3

Grok-4.3 is xAI's advanced reasoning model, launched in late April 2026, designed for complex tasks like advanced logic, math, scientific analysis, and multi-step agentic workflows.

x-ai/grok-build-0.1

grok-build-0.1 is xAI's specialized, ultra-fast AI model explicitly engineered for agentic software engineering and multi-step coding workflows. Rather than operating as a general-purpose conversational chatbot, it is optimized to run tools, handle debugging, and execute complex programming instructions autonomously.

x-ai/grok-code-fast-1

Grok-Code-Fast-1 is a fast, cost-efficient reasoning model built for agentic coding. It can autonomously perform multi-step development tasks, issue tool calls, and refine solutions with transparent reasoning traces. Optimized for speed, it delivers near-instant suggestions that enable smooth, interactive coding workflows. With a 256K token context window, it handles entire codebases and large logs without losing comprehension, making it highly practical for real-world software development.

x-ai/grok-imagine-image

Grok Imagine Image is xAI’s text-to-image generation model for creating visuals from prompts, with support for both text and image inputs. xAI describes it as a model for generating images through the Grok Imagine API, and its docs list it as available for image generation with configurable output sizes.

x-ai/grok-imagine-image-quality

Grok Imagine Image Quality is xAI’s higher-fidelity image generation and editing model, designed to produce sharper, more realistic images than the standard Grok Imagine mode. It emphasizes stronger text rendering, richer textures, more accurate compositions, and more realistic lighting/physics, but it is a bit slower than the speed-focused version.

x-ai/grok-imagine-video

x-ai/grok-imagine-video is xAI’s video generation model for creating short clips from text or images, with native synchronized audio such as dialogue, sound effects, and music. It supports text-to-video, image-to-video, and video editing/extending workflows, making it useful for cinematic clip generation and iterative creative editing.

Model scores sourced from ArtificialAnalysis