What is xAI API?
The xAI API is the developer platform of SpaceXSI, the company formerly called xAI, which SpaceX acquired in February 2026. It keeps the x.ai domains: you sign up at console.x.ai and call https://api.x.ai/v1 with the native xai-sdk, the OpenAI SDK or the Vercel AI SDK.
It sells the Grok text models, led by Grok 4.7 with a 500K-token context, older Grok 4.3 and 4.20 models with 1M-token contexts, and grok-build-0.1 for coding. Alongside them are Grok Imagine image and video models, Grok Voice 3.0 for speech-to-speech, speech-to-text and text-to-speech. Server-side tools cover web search, X search, code execution, file search over Collections and remote MCP servers.
In October 2026 it added moderation guidelines that let a developer set limits for NSFW content, violence and profanity per request.
How much does xAI API cost?
| Plan | Price | What you get |
|---|---|---|
| Grok 4.7 | $2 / $6 per 1M tokens | |
| Grok 4.3 | $1.25 / $2.50 per 1M tokens | |
| Grok Voice 3.0 | $0.08 per minute |
Pay per use from prepaid credit. Grok 4.7 $2 input / $6 output per 1M tokens under 200K-token prompts, $4 / $12 at or above; Grok 4.3 $1.25 / $2.50. Imagine images from $0.02, video from $0.02 per second; Grok Voice 3.0 $0.08 per minute. Batch 20% off text; US endpoint 10% extra.
Is xAI API worth it?
If your product needs to know what people are saying right now, most model APIs make you bolt on a separate search service and pay twice.
The xAI API puts that inside the model call. Its X search tool reads posts and profiles from X directly, at $5 per 1,000 posts and $10 per 1,000 profiles returned, and web search costs $5 per 1,000 calls, half what OpenAI and Anthropic charge. Grok 4.7, the flagship, costs $2 per million input tokens and $6 per million output for prompts under 200K tokens. If you need a longer window, Grok 4.3 keeps a 1M-token context at $1.25 and $2.50.
It is also one key for media. Imagine makes images from $0.02 each and video from $0.02 a second on the Lite model, and Grok Voice 3.0 runs live speech-to-speech for $0.08 a minute, about $4.80 an hour. The API speaks the OpenAI SDK's format, so moving a prototype across is mostly a base URL and a key.
The data terms are plain. SpaceXSI says it never trains on API inputs or outputs without your explicit permission, keeps requests for 30 days for abuse audits and holds a SOC 2 Type 2 report. Zero data retention can be switched on for a whole team in the Console, but it turns off the stateful Responses API, Files, Batch and stored media, and the docs advise most customers not to use it.
The catch: this is a young platform under an owner that keeps changing shape. The company has had three names in 2026, and Grok 4.6 shipped in August only to be replaced by Grok 4.7 in September. Prompts of 200K tokens or more pay double for every token, not just the excess. The US-only endpoint costs 10% more and serves only Grok 4.7 and 4.6, with no image, video or voice. There are no free credits; you prepay before the first call.
Rate limits are generous from the start, though. Even Tier 0 allows Grok 4.7 150 requests a second and 50M tokens a minute, and tiers never drop once reached.
Our take: the xAI API is the right second provider for anything that reads X or needs cheap search; as the only provider behind a product, it asks you to trust a roadmap that has changed more this year than its rivals' have in three.
Where it earns its place
A two-person analytics start-up selling brand monitoring to PR agencies
Summarise what people on X are saying about a client each morning
One Grok 4.7 call with the X search tool pulls posts and writes the brief; 2,000 posts a day cost about $10 in search fees before tokens, with no separate scraping service.
A developer at a call-centre software company
Prototype a voice agent that answers inbound calls
Grok Voice 3.0 handles speech-to-speech at $0.08 a minute, so a 1,000-minute pilot costs $80 plus $0.004 per text input; voice history is lost if the team turns on zero data retention.
A data team running nightly classification jobs
Tag a million product reviews a month at the lowest cost
The Batch API takes 20% off Grok text models, smaller than the 50% OpenAI and Anthropic give, so the older Grok 4.3 at $1.25 and $2.50 per million tokens is the cheaper choice for short prompts.
Before you commit
- Setup
- Create an account at console.x.ai, buy credit and an API key, then point the OpenAI SDK or xai-sdk at https://api.x.ai/v1; a first request takes minutes.
- Integrations
- Responses and Chat Completions endpoints; xai-sdk, OpenAI SDK and Vercel AI SDK; web search, X search, code execution, Collections file search and remote MCP tools; images, video and voice endpoints.
- Data and privacy
- No training on API inputs or outputs without explicit permission; requests kept 30 days for audits; SOC 2 Type 2; BAA on request. Team-wide zero data retention disables Responses state, Files, Collections, Batch and stored media. Which AI tools train on your data?
- Cost at scale
- Tool calls bill on top of tokens: code execution $5 and file search $2.50 per 1,000 calls; speech-to-text $0.10 an hour; text-to-speech $15 per 1M characters. Batch saves only 20% on text models.
- Limits
- Tiers by cumulative spend since 1 January 2026: Grok 4.7 gets 150 requests a second and 50M tokens a minute at Tier 0, 500 and 100M at Tier 4 after $5,000; Grok 4.7 has a 500K context.
What’s good
- X search tool with live posts and profiles
- Web search at $5 per 1,000 calls
- Grok 4.7 at $2/$6 per 1M tokens; 1M context on Grok 4.3
- Text, image, video and voice under one key
- High starting rate limits that never downgrade
What’s not
- No free credits; prepay before the first call
- Prompts of 200K tokens or more double every token
- US endpoint serves only two text models, at 10% extra
- Zero retention turns off Responses state, Files and Batch
- Company renamed twice in 2026; fast model turnover
Best for
Developers who need live X data or cheap web search inside a model call, ideally alongside a second provider.