Grok 4

Popular
xAI
Text & Chat

xAI's flagship reasoning model with vision and tool use. 256k context, strong at complex reasoning and STEM tasks.

Try Grok 4 now
Send a single prompt and stream a response inline. Hit Cmd+Enter to submit.
Sign in to try this model with €5 free credits.
Sign in
Press Cmd+Enter to send
Response appears here.
TL;DR·Last updated May 16, 2026

Grok 4 is text & chat AI model from xAI, priced at €3.00 per 1M input tokens with a 256K tokens context window.

Try Grok 4

0.7

Direct API access coming soon

Pricing

Price per Generation
Per generationFree

API Integration

Use our OpenAI-compatible API to integrate Grok 4 into your application.

Install
npm install railwail
JavaScript / TypeScript
import railwail from "railwail";

const rw = railwail("YOUR_API_KEY");

// Simple — just pass a string
const reply = await rw.run("grok-4", "Hello! What can you do?");
console.log(reply);

// With message history
const reply2 = await rw.run("grok-4", [
  { role: "system", content: "You are a helpful assistant." },
  { role: "user", content: "Explain quantum computing simply." },
]);
console.log(reply2);

// Full response with usage info
const res = await rw.chat("grok-4", [
  { role: "user", content: "Hello!" },
], { temperature: 0.7, max_tokens: 500 });
console.log(res.choices[0].message.content);
console.log(res.usage);
Specifications
Context window
256,000 tokens
Max output
16,384 tokens
Developer
xAI
Category
Text & Chat
Supported Formats
text
image
Tags
xai
flagship
reasoning
vision
tools
legacy-retiring

Deep dive — xAI's Grok 4

About xAI
Founded 2023 · Palo Alto, USA

xAI was founded in March 2023 by Elon Musk together with researchers from DeepMind, OpenAI, Google Research, Microsoft Research and Tesla including Igor Babuschkin and Tony Wu. The company's stated mission is to build maximally truth-seeking AI. Its flagship product is Grok, an LLM-based assistant deeply integrated into X (formerly Twitter) and available via a standalone app and API. Grok 1 weights were released under Apache 2.0 in November 2023 (314B-parameter MoE), Grok 1.5 added 128K context and vision in early 2024, Grok 2 shipped in mid-2024, Grok 3 launched in February 2025 trained on the Colossus supercluster, and Grok 4 followed in mid-2025 as the next frontier flagship with enhanced reasoning. xAI raised over $12 billion in 2024 across two financing rounds with backers including Andreessen Horowitz, Sequoia, Valor Equity, Lightspeed and Saudi funds. Beyond Grok the company operates the Colossus cluster in Memphis, regarded as the world's largest dedicated AI training site at launch.

Visit xAI
Architecture
Decoder-only Transformer (frontier reasoning successor to Grok 3)

Grok 4 is xAI's successor to Grok 3, released in mid-2025 as the lab's frontier reasoning model. It was trained on the expanded Colossus supercluster in Memphis, which grew from roughly 100,000 NVIDIA H100 GPUs at Grok 3 launch to a target of 200,000+ GPUs by Grok 4. xAI describes the training compute as approximately 10x that of Grok 3. The model is a decoder-only Transformer pretrained on a multi-trillion-token mixture of web text, code, scientific papers, math content and the continuously growing feed of public posts on the X platform. Post-training relies heavily on large-scale reinforcement learning against verifiable rewards, particularly for math, coding and tool-use trajectories, building on the Think and high-effort reasoning modes introduced in Grok 3. Grok 4 ships with an upgraded DeepSearch agent that performs multi-step web and X-platform retrieval before reasoning over the gathered evidence, and supports native tool use, function calling and image input. Context window is increased to 256K tokens. xAI positions Grok 4 as competitive with OpenAI o3 and Gemini 2.5 Pro on math and science benchmarks, with the differentiator being real-time access to X data and a lower refusal rate.

Parameters
Undisclosed (estimated multi-hundred billion parameters)
Context
256K tokens
What it can do
  • 256K token context window
  • Reinforcement-learning-trained reasoning modes with adjustable thinking budget
  • Upgraded DeepSearch agent for X + web retrieval
  • Trained on ~200K H100 Colossus cluster
  • Strong AIME, GPQA and ARC-AGI scores at launch
  • Vision input for images and screenshots
  • Function calling and structured JSON output
  • Native integration with X timeline and DMs in the X app
  • Available via xAI API, X Premium+ and the Grok mobile app
  • Real-time fresh data through built-in retrieval
  • Best for: agentic research, real-time question answering, math/code reasoning, X-platform assistants.
Training & License

Multi-trillion-token pretraining mixture of web text, code, math, scientific papers and X public posts. Knowledge cutoff updated continuously through retrieval. Post-training applies RLHF and large-scale reinforcement learning against verifiable rewards on math, code and tool-use tasks.

License: Proprietary commercial license via xAI API, X Premium+ and the Grok app. Weights not publicly released for Grok 2, 3 or 4.

Known limitations
  • Lower refusal rate increases risk of harmful or biased output
  • Limited published third-party safety evaluations
  • Real-time retrieval depends heavily on the X corpus
  • Regional availability constrained by X service availability
  • Weights not released; reproducibility limited

Frequently asked questions

Start using Grok 4 today

Get started with free credits. No credit card required. Access Grok 4 and 100+ other models through a single API.