What is Grok API?
The Grok API is the developer interface to SpaceXAI's Grok models. It exposes chat and reasoning text models (currently grok-4.7 with a 500k-token context), image and video generation and editing through the Imagine API, a Voice API covering speech-to-speech, text-to-speech and speech-to-text, plus files, collections for retrieval, and built-in tools such as function calling, web search, X search and code execution.
Developers authenticate with an API key and call endpoints over HTTPS at api.x.ai. The documentation provides quickstarts in cURL, Python, the OpenAI-compatible SDK and JavaScript, with example requests to the responses endpoint. Beyond basic calls, the docs cover streaming, structured outputs, batch processing, rate limits, prompt caching, regional endpoints and cost tracking, so teams can use it in production applications, agents and media pipelines.
Key features
- Chat and reasoning text models with up to 500k-token context
- Image generation and editing via the Imagine API
- Video generation, image-to-video and video editing
- Voice API with speech-to-speech, text-to-speech and speech-to-text
- Function calling, web search, X search and code execution tools
- Structured outputs, batch API, prompt caching and rate limits
Who is it for
- Software developers
- AI product teams
- Companies building voice or media apps
Pros and cons
- Broad coverage: text, image, video and voice from one API
- OpenAI-compatible SDK option and quickstarts in several languages
- Usage is billed per token, per image, per second or per character
- Long-context and US regional endpoint requests cost more
Grok API pricing
| Plan | Price | Includes |
|---|---|---|
| grok-4.7 | 2 USD / one-time | Input per 1M tokens, short context; cached input 0.50 USD; output 6 USD per 1M; long context (200k+) input 4 USD and output 12 USD per 1M |
| Voice API - STS | 0.08 USD / one-time | Per minute |
| Voice API - TTS | 15 USD / one-time | Per 1M characters |
| Voice API - STT batch | 0.10 USD / one-time | Per hour |
| Voice API - STT streaming | 0.20 USD / one-time | Per hour |
| Imagine image generation | 0.02 USD / one-time | Starting price per image at 1K/2K resolution |
Prices copied from Grok API pricing, checked October 12, 2026. Currency as shown by the vendor; taxes may apply.
Is Grok API free?
The vendor does not state this clearly on the homepage or pricing page.
Grok API alternatives
| Tool | Price from | Free plan | Category |
|---|---|---|---|
| 0.3 USD input / 1.2 USD output per M tokens | ? | APIs & models | |
| 0.025 USD | trial | APIs & models | |
| 9.99 USD/mo | yes | APIs & models | |
| 0.015 USD | trial | APIs & models | |
| 0.05 USD | ? | APIs & models | |
| not listed | yes | APIs & models |
All alternatives to Grok API →
FAQ
What is Grok API used for?
Official SpaceXAI API for building apps with Grok models: text, image, video, voice, and tool calling, for developers.
Is Grok API free?
The vendor does not state this clearly on the homepage or pricing page.
How much does Grok API cost?
The cheapest paid plan is 0.02 USD (vendor pricing, October 12, 2026).
What are the best Grok API alternatives?
Closest alternatives: MiniMax, Replicate, DeepAI, Z.AI Developer Platform, fal.
Data checked October 12, 2026 on the vendor website (docs.x.ai).
