/
X
x
/
xAI's REST API
Search skmtc…
⌘K
Docs
Sign in
Sign in
APIs
Generators
Stacks
Projects
Docs
History
Schema
Sources
Checked 4h ago · Updated 23h ago
View markdown
x
xAI's REST API
get
List all video generation models available to the authenticating API key with full information.
v
latest
OpenAPI 3.1.0
2026-08-08
43
192
209.2 KB
v1
43
get
Get information about an API key, including name, status, permissions and users who created or modified this key.
post
Create a chat response from text/image chat prompts. This is the endpoint for making requests to chat and image understanding models.
get
Tries to fetch a result for a previously-started deferred completion. Returns `200 Success` with the response body, if the request has been completed. Returns `202 Accepted` when the request is pending processing.
post
(Legacy - Not supported by reasoning models) Create a text completion response. This endpoint is compatible with the Anthropic API.
post
(Legacy - Not supported by reasoning models) Create a text completion response for a given prompt. Replaced by /v1/chat/completions.
post
Search for content related to the query within the given collections.
get
List all embedding models available to the authenticating API key with full information. Additional information compared to /v1/models includes modalities, fingerprint and alias(es).
get
Get full information about an embedding model with its model_id.
post
Create an embedding vector representation corresponding to the input text. This is the endpoint for making requests to embedding models.
get
List files owned by the authenticated team, paginated. The response always returns a `pagination_token`; pass it back as a query parameter to fetch the next page. The end of the list is reached when the returned `data` array is shorter than `limit`.
post
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 attachments). Maximum file size: 50 MB. Files are kept until you delete them, or until `expires_after` elapses if set at upload time.
get
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`.
delete
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 longer be referenced in chat attachments.
get
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 payload; use `GET /v1/files/{file_id}` for metadata only.
post
Create a permanent, unauthenticated public URL for an existing file. The underlying file is unaffected and can still be fetched through the authenticated content endpoint. Use this when you want to share a stored asset (image, video, PDF) outside your API-keyed environment. Public URLs can be revoked at any time via `POST /v1/files/{file_id}/public-url/revoke`.
post
Revoke the active public URL for a file. The underlying file remains available through the authenticated content endpoint. Revoke is idempotent — calling it on a file without an active public URL returns `revoked: false` without an error.
get
List all image generation models available to the authenticating API key with full information. Additional information compared to /v1/models includes modalities, fingerprint and alias(es).
get
Get full information about an image generation model with its model_id.
post
Edit an image based on a prompt. This is the endpoint for making edit requests to image generation models.
post
Generate an image based on a prompt. This is the endpoint for making generation requests to image generation models.
get
List all chat and image understanding models available to the authenticating API key with full information. Additional information compared to /v1/models includes modalities, fingerprint and alias(es).
get
Get full information about a chat or image understanding model with its model_id.
get
Get information about the currently authenticated caller. Works with both API keys and OAuth tokens. Returns identity, team, and ZDR status.
post
Create a messages response. This endpoint is compatible with the Anthropic API.
get
List all models available to the authenticating API key, including model names (ID), creation times, and pricing.
get
Get information about a model with its model_id, including pricing.
post
Generates a response based on text or image prompts. The response ID can be used to retrieve the response later or to continue the conversation without repeating prior context. New responses will be stored for 30 days and then permanently deleted.
post
Compacts a full Responses API input window into a shorter canonical window.
get
Retrieve a previously generated response.
delete
Delete a previously generated response.
get
List input items for a previously generated response.
get
/v1/skills
post
/v1/skills
get
/v1/skills/{skill_id}
delete
/v1/skills/{skill_id}
get
/v1/skills/{skill_id}/content
post
Tokenize text with the specified model
get
List all video generation models available to the authenticating API key with full information.
get
Get full information about a video generation model with its model_id.
post
Edit a video based on a prompt. This is an asynchronous operation that returns a request_id for polling.
post
Extend a video by generating continuation content. This is an asynchronous operation that returns a request_id for polling.
post
Generate a video from a text prompt and optionally an image. This is an asynchronous operation that returns a request_id for polling.
get
Get the result of a deferred video generation request.
v1
List all video generation models available to the authenticating API key with full information.
get
/v1/video-generation-models
Response
Success
ListVideoGenerationModelsResponse
required
models
VideoGenerationModel[]
required
Array of available video generation models.