Grok 4
xAI's flagship reasoning model with vision and tool use. 256k context, strong at complex reasoning and STEM tasks.
Grok 4 is text & chat AI model from xAI, priced at β¬3.00 per 1M input tokens with a 256K tokens context window.
0.7
Pricing
API Integration
Use our OpenAI-compatible API to integrate Grok 4 into your application.
npm install railwailimport 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);Deep dive β xAI's Grok 4
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 β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
- 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.
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
Related Models
View all Text & ChatClaude Opus 4
Anthropic's most powerful model. Exceptional at complex analysis, agentic tasks, and extended reasoning.
Claude Sonnet 4
Anthropic's most capable model. Excellent for complex analysis, coding, math, and creative writing.
DeepSeek V3.1
DeepSeek's refreshed V3.1 release. 671B MoE / 37B active. Tops open-weights leaderboards on coding and reasoning.
DeepSeek V4 Pro
DeepSeek's April 2026 flagship. 1.6T MoE / 49B active params, 1M context, rivals top closed-source models on STEM and coding at a fraction of the price.
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.