Frontier
AI
models
for
everything
you
build.
Reasoning, code, voice, images, and video. Trained on the world's largest supercluster.
Explain quantum entanglement simply
Two particles become linked — measuring one instantly determines the other, regardless of distance.
Why is the sky blue?
Shorter blue wavelengths scatter more off air molecules than longer red ones.
How do black holes form?
❯
Migrate auth from sessions to JWT.
Thinking...
▸ read_filesrc/middleware/auth.ts68 lines
▸ grep"session" src/4 matches
▸ read_filesrc/lib/jwt.ts42 lines
|Audit auth middlewareexplore
[running]
|Design token rotationgeneral
[running]
|Find session referencesexplore
[done]
◆Thought for 4.1s
◆Editsrc/middleware/auth.ts
42export async function handler(req) {
43 const token = extractBearer(req);
For developers
One API.
Every modality.
Text, code, voice, images, and video — all through a single unified API. Start building in seconds.
- 1M+
- API calls per day
- <200ms
- Median latency
- 5+
- Model families
import osfrom xai_sdk import Clientfrom xai_sdk.chat import userclient = Client( api_key=os.getenv("XAI_API_KEY"))chat = client.chat.create(model="grok-4.5")chat.append(user("Explain quantum computing"))response = chat.sample()print(response.content)
import OpenAI from "openai";const client = new OpenAI({ apiKey: process.env.XAI_API_KEY, baseURL: "https://api.x.ai/v1",});const response = await client.chat.completions.create({ model: "grok-4.5", messages: [{ role: "user", content: "Explain quantum computing" }],});console.log(response.choices[0].message.content);
curl https://api.x.ai/v1/chat/completions \ -H "Authorization: Bearer $XAI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "grok-4.5", "messages": [ { "role": "user", "content": "Explain quantum computing" } ] }'
Choose how to get started
Build on your own
Launch your AI-powered product with:
- Access to all Grok models
- Usage-based pricing
- Automatically increasing rate limits
- Comprehensive documentation and guides
Get extra support
Custom rate limits and hands-on support for your team.
- Dedicated onboarding support
- Custom rate limits
- Billing via monthly invoices
- Single sign-on and audit logging
- Data residency options



