What it does
xAI API at https://api.x.ai/v1 for Grok language, image, video, voice and embedding models; batch, prompt caching and remote MCP tools. Rate-limit tiers by cumulative spend since 2026-01-01 (Tier 0 $0, Tier 1 $50, Tier 2 $250, Tier 3 $1,000, Tier 4 $5,000); hard RPS and TPM caps per model; 429 when exceeded.
In its API docs
Pricing
What xAI API publishes for buying direct, as listed on its own pages.
Buying direct from xAI API
- Grok (500k context)$2.00 / 1M input tokens
Larger plans through sales. xAI API pricing, checked Sep 29, 2026
Docs
xAI API's own pages, linked as published.
- API referencedocs.x.ai/developers/rest-api-reference/inference/chat-completions
- OpenAPI specdocs.x.ai/openapi.json
- Pricingdocs.x.ai/docs/models
- Rate limitsdocs.x.ai/developers/rate-limits
- Status pagestatus.x.ai
- Websitex.ai
Its OpenAPI document: 43 operations and rate limits
| Method | Path | Summary | Params | Source |
|---|---|---|---|---|
| GET | /v1/api-key | Get information about an API key, including name, status, permissions and users who created or modified this key. | 0 | Spec |
| POST | /v1/chat/completions | Create a chat response from text/image chat prompts. This is the endpoint for making requests to chat and image understanding models. | 0 | Spec |
| GET | /v1/chat/deferred-completion/{request_id} | Tries to fetch a result for a previously-started deferred completion. Returns `200 Success` with the response body, if the request has been | 1 | Spec |
| POST | /v1/complete | (Legacy - Not supported by reasoning models) Create a text completion response. This endpoint is compatible with the Anthropic API. | 0 | Spec |
| POST | /v1/completions | (Legacy - Not supported by reasoning models) Create a text completion response for a given prompt. Replaced by /v1/chat/completions. | 0 | Spec |
| POST | /v1/documents/search | Search for content related to the query within the given collections. | 0 | Spec |
| GET | /v1/embedding-models | List all embedding models available to the authenticating API key with full information. Additional information compared to /v1/models inclu | 0 | Spec |
| GET | /v1/embedding-models/{model_id} | Get full information about an embedding model with its model_id. | 1 | Spec |
| POST | /v1/embeddings | Create an embedding vector representation corresponding to the input text. This is the endpoint for making requests to embedding models. | 0 | Spec |
| GET | /v1/files | List files owned by the authenticated team, paginated. The response always returns a `pagination_token`; pass it back as a query parameter t | 6 | Spec |
| POST | /v1/files | Upload a file to xAI's storage. Returns the file's metadata. Files can be referenced by ID anywhere a `file_id` is accepted (e.g. chat attac | 0 | Spec |
| GET | /v1/files/{file_id} | Retrieve metadata for a single file by ID. Errors with 404 if the file doesn't exist, has been deleted, or has passed its `expires_at`. | 1 | Spec |
| DELETE | /v1/files/{file_id} | Delete a file by ID. After this returns, the file no longer appears in `GET /v1/files`, content download returns 404, and the ID can no long | 1 | Spec |
| GET | /v1/files/{file_id}/content | Download the contents of a file as a stream of raw bytes. The response `Content-Type` is `application/octet-stream`. Use this for the binary | 2 | Spec |
| POST | /v1/files/{file_id}/public-url | Create a permanent, unauthenticated public URL for an existing file. The underlying file is unaffected and can still be fetched through the | 1 | Spec |
| POST | /v1/files/{file_id}/public-url/revoke | Revoke the active public URL for a file. The underlying file remains available through the authenticated content endpoint. Revoke is idempot | 1 | Spec |
| GET | /v1/image-generation-models | List all image generation models available to the authenticating API key with full information. Additional information compared to /v1/model | 0 | Spec |
| GET | /v1/image-generation-models/{model_id} | Get full information about an image generation model with its model_id. | 1 | Spec |
| POST | /v1/images/edits | Edit an image based on a prompt. This is the endpoint for making edit requests to image generation models. | 0 | Spec |
| POST | /v1/images/generations | Generate an image based on a prompt. This is the endpoint for making generation requests to image generation models. | 0 | Spec |
| GET | /v1/language-models | List all chat and image understanding models available to the authenticating API key with full information. Additional information compared | 0 | Spec |
| GET | /v1/language-models/{model_id} | Get full information about a chat or image understanding model with its model_id. | 1 | Spec |
| GET | /v1/me | Get information about the currently authenticated caller. Works with both API keys and OAuth tokens. Returns identity, team, and ZDR status. | 0 | Spec |
| POST | /v1/messages | Create a messages response. This endpoint is compatible with the Anthropic API. | 0 | Spec |
| GET | /v1/models | List all models available to the authenticating API key, including model names (ID), creation times, and pricing. | 0 | Spec |
| GET | /v1/models/{model_id} | Get information about a model with its model_id, including pricing. | 1 | Spec |
| POST | /v1/responses | Generates a response based on text or image prompts. The response ID can be used to retrieve the response later or to continue the conversat | 0 | Spec |
| POST | /v1/responses/compact | Compacts a full Responses API input window into a shorter canonical window. | 0 | Spec |
| GET | /v1/responses/{response_id} | Retrieve a previously generated response. | 1 | Spec |
| DELETE | /v1/responses/{response_id} | Delete a previously generated response. | 1 | Spec |
| GET | /v1/responses/{response_id}/input_items | List input items for a previously generated response. | 4 | Spec |
| GET | /v1/skills | handle_list_skills_request | 3 | Spec |
| POST | /v1/skills | handle_upload_skill_request | 0 | Spec |
| GET | /v1/skills/{skill_id} | handle_retrieve_skill_request | 1 | Spec |
| DELETE | /v1/skills/{skill_id} | handle_delete_skill_request | 1 | Spec |
| GET | /v1/skills/{skill_id}/content | handle_download_skill_content_request | 1 | Spec |
| POST | /v1/tokenize-text | Tokenize text with the specified model | 0 | Spec |
| GET | /v1/video-generation-models | List all video generation models available to the authenticating API key with full information. | 0 | Spec |
| GET | /v1/video-generation-models/{model_id} | Get full information about a video generation model with its model_id. | 1 | Spec |
| POST | /v1/videos/edits | Edit a video based on a prompt. This is an asynchronous operation that returns a request_id for polling. | 0 | Spec |
Showing 40 of 43 operations; the full list is in the spec.
Rate limits
| Limit | Scope | Plan | Endpoint | Burst / concurrency |
|---|---|---|---|---|
| 37 / second | plan | Tier 0 | grok-4.20-0309-reasoning | — / — |
| 50 / second | plan | Tier 1 | grok-4.20-0309-reasoning | — / — |
| 75 / second | plan | Tier 2 | grok-4.20-0309-reasoning | — / — |
| 125 / second | plan | Tier 3 | grok-4.20-0309-reasoning | — / — |
| 208 / second | plan | Tier 4 | grok-4.20-0309-reasoning | — / — |
On 429: Exceeding any RPS or TPM limit returns 429 Too Many Requests. GridRouter never paces above these and backs off on 429, honoring Retry-After. Source, checked Sep 29, 2026
Sources for this page (2)
- xAI models and pricingchecked Sep 29, 2026
- xAI rate limitschecked Sep 29, 2026
