xAI v1 API is published by xAI on the APIs.io network, described by a machine-readable OpenAPI specification and an AsyncAPI event-driven specification.
Tagged areas include v1. The published artifact set on APIs.io includes an OpenAPI specification, API documentation, an API reference, and an AsyncAPI specification.
This API exposes
33 operations
across 30 paths,
and defines 153 schemas.
It is described by OpenAPI 3.1.0, at version 1.0.0.
Requests are made against the base URL https://api.x.ai/v1.
The identity and technical contract details declared by the specification.
VideoResolution
string
Resolution for video generation.
Function
object
2 properties
2 required
File
object
An uploaded file.
7 properties
5 required
VideoResponse
object
Video generation response.
6 properties
2 required
ReciprocalRankFusion
object
Configuration for reciprocal rank fusion (RRF) reranking.
3 properties
RankingMetric
string
Deprecated: Metric now comes from collection creation.
LocalShellSkill
object
A skill available in the local shell environment.
3 properties
3 required
ServerSideToolUsageDetails
object
6 properties
6 required
ContentPart
object
4 properties
1 required
Message
Chat message objects.
ContentFormat
string
Format of the downloaded file content.
Tool
Definition of one tool that the model can call.
GeneratedVideo
object
Generated video.
3 properties
2 required
HybridRetrieval
object
Document search using a combination of keyword and semantic search.
2 properties
EmbeddingUsage
object
2 properties
2 required
ShellCallOutputResult
object
The content of a shell tool call output that was emitted.
3 properties
1 required
MediaUsage
object
Billing and cost information for media generation requests (image and video).
1 property
1 required
MessageBody
object
Anthropic compatible message body
2 properties
2 required
WebSearchUserLocation
object
5 properties
1 required
MessageTools
object
4 properties
3 required
ListLanguageModelsResponse
object
1 property
1 required
GeneratedImageResponse
object
Image generation response for /v1/image/generations endpoint
2 properties
1 required
KeywordRetrieval
object
Document search using keyword matching (sparse embeddings).
1 property
VideoOutput
object
Output destination for generated video.
1 property
1 required
UploadFileMultipartRequest
object
Multipart form fields accepted by POST /v1/files. The expiresafter field MUST appear before file in the multipart body when both are present (the upload handle…
3 properties
1 required
ToolChoice
Parameter to control how model chooses the tools.
EditVideoRequest
object
Request for editing video for /v1/videos/edits endpoint
5 properties
2 required
OutputTokensDetails
object
1 property
1 required
FileSearchResult
object
4 properties
3 required
Content
Content of each chat message.
RerankerModel
object
Configuration for model-based reranking.
2 properties
PromptUsageDetail
object
Details of prompt usage.
4 properties
4 required
HybridReranker
Reranker configuration for hybrid retrieval.
ResponseFormat
Response format parameter for structured outputs.
GenerateVideoRequest
object
Request to generate video for /v1/videos/generations endpoint
9 properties
CompleteRequest
object
(Legacy) Anthropic compatible complete request on /v1/complete endpoint.
9 properties
ShellEnvironment
object
The environment configuration for a shell tool.
2 properties
1 required
ReasoningText
object
2 properties
2 required
ChatResponse
object
The chat response body for /v1/chat/completions endpoint.
9 properties
5 required
Choice
object
4 properties
2 required
ShellCallOutcome
The outcome of a shell command execution.
VideoAspectRatio
string
Aspect ratio for video generation.
SystemMessagePart
object
3 properties
2 required
ImageAspectRatio
string
Aspect ratio for image generation. Only supported by grok-imagine models.
MessageUsage
object
4 properties
4 required
GeneratedImage
object
Generated images
3 properties
ShellCallOutput
object
The output of a shell tool call, sent by the client after local execution.
4 properties
3 required
ListVideoGenerationModelsResponse
object
1 property
1 required
TopLogProb
object
3 properties
2 required
MessageToolChoice
Tool choice option.
WebSearchCall
object
The output of a web search tool call.
4 properties
2 required
ImageGenerationModel
object
Details of an image generation model
11 properties
11 required
ModelResponse
object
The response body for /v1/responses endpoint.
32 properties
18 required
FileRef
object
2 properties
WebSearchSource
object
2 properties
1 required
LanguageModel
object
Details of a language model
14 properties
14 required
MessageRequest
object
Request message for /v1/messages
12 properties
ModelRequest
object
The request body for /v1/responses endpoint.
26 properties
1 required
Reasoning
object
The reasoning done by the model.
6 properties
2 required
McpCall
object
The output of a MCP tool call.
8 properties
5 required
Model
object
Same as LanguageModel but fully compliant with the OpenAI API.
4 properties
4 required
SampleResponse
object
(Legacy) Response for /v1/completions endpoint
7 properties
5 required
ModelUsage
object
10 properties
7 required
ApiKey
object
12 properties
12 required
VideoUrl
object
Video input for editing and extension requests. Accepts a public URL, a base64-encoded data URL, or a fileid from the xAI Files API.
2 properties
WebSearchFilters
object
2 properties
RetrievalMode
Retrieval mode configuration for document search.
FunctionChoice
object
Function name.
1 property
1 required
ModelInput
Content of the input passed to a /v1/response request.
ShellCallAction
object
The shell commands and limits that describe how to run the tool call.
4 properties
1 required
ChatRequest
object
The chat request body for /v1/chat/completions endpoint.
25 properties
SummaryText
object
2 properties
2 required
MessageResponse
object
Response message for /v1/messages
8 properties
6 required
ModelTool
Definition of one tool that the model can call.
CompactionOutputItem
object
A compaction item from a previous /v1/responses/compact call. Accepted as input in /v1/responses calls. Clients must treat encryptedcontent as opaque — do not…
3 properties
2 required
EditImageRequest
object
Request for editing image
9 properties
1 required
GenerateImageRequest
object
7 properties
OutputFile
object
A file generated during the model's response (e.g., by the code execution tool).
2 properties
2 required
ShellCall
object
A shell command call emitted by the model for local execution.
6 properties
3 required
ModelToolChoice
Parameter to control how model chooses the tools.
CompleteResponse
object
(Legacy) Anthropic compatible complete response on /v1/complete endpoint.
5 properties
4 required
DeleteStoredCompletionResponse
object
Response to delete a stored completion.
3 properties
3 required
ToolCall
object
4 properties
2 required
TokenizeResponseToken
object
3 properties
3 required
VideoErrorCode
string
Machine-readable error codes for video generation failures. These are the codes that can appear in VideoError.code when polling a deferred video generation res…
Annotation
object
5 properties
2 required
EmbeddingModel
object
Details of an embedding model
11 properties
11 required
CompletionUsageDetail
object
Details of completion usage.
4 properties
4 required
DeleteFileResponse
object
3 properties
3 required
ExtendVideoRequest
object
Request for extending a video for /v1/videos/extensions endpoint
5 properties
2 required
ListFilesResponse
object
2 properties
1 required
TokenizeRequest
object
3 properties
LogProbs
object
1 property
EmbeddingResponse
object
4 properties
3 required
StreamOptions
object
Options available when using streaming response.
1 property
1 required
ListEmbeddingModelsResponse
object
1 property
1 required
FileSearchCall
object
The output of a web search tool call.
5 properties
3 required
VideoError
object
Structured error returned when video generation fails.
2 properties
2 required
VideoGenerationModel
object
Details of a video generation model
9 properties
9 required
EmbeddingRequest
object
6 properties
ImageResolution
string
Resolution for image generation. Only supported by grok-imagine models.
MessageMetadata
object
1 property
ModelResponseConfiguration
object
1 property
SearchParameters
object
Parameters to control realtime data.
6 properties
FunctionToolCall
object
A tool call to run a function.
6 properties
4 required
OutputMessage
object
An output message from the model.
5 properties
3 required
SearchResponse
object
SearchResponse defines the response to a search request.
1 property
1 required
Usage
object
7 properties
7 required
GroupBy
object
Group search results by metadata key(s) and keep top-k per group.
2 properties
1 required
InputTokensDetails
object
1 property
1 required
WebSearchOptions
object
3 properties
SampleRequest
object
(Legacy) Request for /v1/completions endpoint
18 properties
ListImageGenerationModelsResponse
object
1 property
1 required
IncompleteDetails
Details about why a response is incomplete.
ReasoningConfiguration
object
3 properties
TokenLogProb
object
4 properties
3 required
DocumentsSource
object
DocumentsSource defines the source of documents to search over.
2 properties
1 required
FunctionToolCallOutput
object
The output of a function tool call.
3 properties
3 required
TokenizeResponse
object
1 property
1 required
ImageUrl
object
Image input for generation and editing requests. Accepts a public URL, a base64-encoded data URL, or a fileid from the xAI Files API.
2 properties
StartDeferredResponse
object
Response for starting a deferred operation.
1 property
1 required
ToolResultContent
Content of a toolresult block. The Anthropic SDK may send this as either a plain string or an array of typed content blocks (e.g. [{"type": "text", "text": "..…
SemanticRetrieval
object
Document search using semantic similarity (dense embeddings).
1 property
SampleChoice
object
3 properties
3 required
ModelResponseFormat
Response format parameter for structured outputs.
MessageToolInputSchema
object
3 properties
2 required
SearchMatch
object
SearchMatch defines a single match from a search request.
7 properties
6 required
Embedding
object
3 properties
3 required
CustomToolCall
object
The output of a custom tool call.
6 properties
4 required
GroupByAggregate
Aggregation function to apply within each group.
SearchRequest
object
SearchRequest defines the request to search for documents.
8 properties
2 required
ChoiceMessage
object
5 properties
1 required
ListModelsResponse
object
2 properties
2 required
CodeInterpreterCall
object
The output of a code interpreter tool call.
5 properties
2 required
ToolResultContentBlock
A single content block within a toolresult's array content.
FunctionDefinition
object
Definition of the tool call made available to the model.
4 properties
2 required
The full machine-readable OpenAPI contract behind this narrative.