How AI is applied across API Evangelist and APIs.io. Read my AI disclosure →
API Evangelist API Evangelist
Discovery
Learnings
Guidance
Toolbox
Alignment
API Evangelist LLC

xAI Chat API

The Chat API from xAI — 2 operation(s) for chat.

xAI Chat API is one of 17 APIs that xAI publishes on the APIs.io network, described by a machine-readable OpenAPI specification and an AsyncAPI event-driven specification.

Tagged areas include Chat. The published artifact set on APIs.io includes an OpenAPI specification, API documentation, an API reference, and an AsyncAPI specification.

This API exposes 2 operations across 2 paths, and defines 27 schemas. It is described by OpenAPI 3.2.0, at version 1.0.0.

Requests are made against the base URL https://api.x.ai/v1.

2 operations 2 paths 27 schemas 1 GET1 POST

Metadata

The identity and technical contract details declared by the specification.

Specification
OpenAPI 3.2.0
API Version
1.0.0
Base URL
https://api.x.ai/v1
Authentication
HTTP Bearer
Resource Areas
1

Authentication & Security 1

xAI Chat API declares 1 security scheme for authenticating requests. It accepts HTTP bearer tokens (bearerAuth).

Paths & Operations 2

Across 2 paths, the API surfaces 2 operations — 1 GET, 1 POST. Each is listed below with its method, path, parameters, and response codes.

Chat 2
POST
/v1/chat/completions
Create a chat response from text/image chat prompts.
handle_generic_completion_request body → 200400422
GET
/v1/chat/deferred-completion/{request_id}
Tries to fetch a result for a previously-started deferred completion.
handle_get_deferred_completion_request 1 param → 200202400404

Schemas 27

The contract defines 27 schemas that model the data the API accepts and returns. The most detailed are ChatRequest (25 properties), ChatResponse (9 properties), Usage (7 properties), SearchParameters (6 properties). Each schema is shown below with its type and property counts.

TopLogProb
object
3 properties 2 required
Content
Content of each chat message.
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
FunctionDefinition
object
Definition of the tool call made available to the model.
4 properties 2 required
FunctionChoice
object
Function name.
1 property 1 required
Usage
object
7 properties 7 required
ResponseFormat
Response format parameter for structured outputs.
Tool
Definition of one tool that the model can call.
TokenLogProb
object
4 properties 3 required
WebSearchOptions
object
3 properties
ChatResponse
object
The chat response body for /v1/chat/completions endpoint.
9 properties 5 required
SearchSource
Function
object
2 properties 2 required
ContentPart
object
4 properties 1 required
LogProbs
object
1 property
Choice
object
4 properties 2 required
ToolCall
object
4 properties 2 required
ToolChoice
Parameter to control how model chooses the tools.
Message
Chat message objects.
FileRef
object
2 properties
CompletionUsageDetail
object
Details of completion usage.
4 properties 4 required
SearchParameters
object
Parameters to control realtime data.
6 properties
OutputFile
object
A file generated during the model's response (e.g., by the code execution tool).
2 properties 2 required
ChatRequest
object
The chat request body for /v1/chat/completions endpoint.
25 properties
ChoiceMessage
object
5 properties 1 required
PromptUsageDetail
object
Details of prompt usage.
4 properties 4 required
StreamOptions
object
Options available when using streaming response.
1 property 1 required

Specification

The full machine-readable OpenAPI contract behind this narrative.

Source

xai-chat-api-openapi.yml Raw ↑

Other APIs xAI publishes across the network.

xAI Api Key API
xAI Complete API
xAI Completions API
xAI Documents API
xAI Embedding Models API
xAI Embeddings API
xAI Files API
xAI Image Generation Models API
xAI Images API
xAI Language Models API
xAI Messages API
xAI Models API
Where this information came from

This is an independent, third-party profile of xAI Chat API, published by API Evangelist. We do not operate, host, resell, or support these APIs, and we are not affiliated with or endorsed by the company unless stated above. Everything here is built from publicly available information — the company's own site, developer portal, documentation, public repositories, and the specifications it publishes for public use. Nothing is obtained by breaching a system, defeating an access control, or using credentials.

The Kin Score and Agent Readiness rating are independently calculated assessments of a company's public API artifacts, scored against a published rubric. They are not certifications, endorsements, security assessments, or audits.

Corrections, re-scores, and removal are free — no partnership or purchase required, and you do not need to justify the request. A removed company is recorded as unrated, never scored zero for having asked. Acknowledgement within one business day; removal within two.

info@apievangelist.com · Read the full data-sourcing policy →
On a security or compliance team? Put security in the subject line and you will get a person, not a form — we will tell you exactly which public URLs this profile was built from.