The Grok API guide
Use Grok in your own apps, scripts and workflows with xAI model IDs, token billing and server-side API keys.
The Grok API is for developers who want Grok inside software. You send JSON to the xAI endpoint, choose a model, include messages and receive a response your program can process. It is separate from SuperGrok chat plans and bills by usage.
Keep API keys server-side, measure token usage early and verify official prices before production. If you only want to chat with Grok as a person, use the consumer pricing guide instead.
When the API is the right route
| Model ID | Context | Input per 1M | Output per 1M | Best for |
|---|---|---|---|---|
| grok-4.5 | 500,000 | USD 2.00 | USD 6.00 | Current flagship for general chat, coding and reasoning |
| grok-4.3 | 1,000,000 | USD 1.25 | USD 2.50 | Lower-cost general model with a larger 1M context window |
| grok-4.20-0309-reasoning | 1,000,000 | USD 1.25 | USD 2.50 | Harder reasoning, document work and deliberate tool use |
| grok-4.20-0309-non-reasoning | 1,000,000 | USD 1.25 | USD 2.50 | High-volume text tasks that do not need explicit reasoning mode |
| grok-4.20-multi-agent-0309 | 1,000,000 | USD 1.25 | USD 2.50 | Hard multi-step work that benefits from parallel agent-style processing |
| grok-build-0.1 | 256,000 | USD 1.00 | USD 2.00 | Coding-agent and build workflows at lower input cost |
Model data last checked 2026-07-22. Verify current pricing at docs.x.ai.

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": "Say hello in one short sentence." }
]
}'Frequently asked questions
Make a working request
Use the quickstart, then estimate monthly cost before building more.
supergrok.info is an independent guide and resource site. It is not xAI, Grok, X, or an official login, billing, API, app, or support channel. For passwords, subscriptions, API keys, billing, app downloads, account access, incidents and support, use official xAI and Grok links. Grok and xAI are trademarks of their respective owners. This site uses those names only to describe and reference the product.