gRPC API
Overview
The xAI gRPC API exposes the same models and services as the REST API over gRPC. The base URL for all services is api.x.ai, and every call must carry the header Authorization: Bearer <your xAI API key>.
The protobuf definitions are published in xai-org/xai-proto. The xAI Python SDK (xai-sdk) uses gRPC natively; install it with pip install xai-sdk.
Using buf curl
Clone the proto definitions and use buf curl to call the API:
Bash
git clone https://github.com/xai-org/xai-proto.git
cd xai-proto
All buf curl examples in this reference assume you run from inside the cloned xai-proto directory.
Services
- Chat —
xai_api.Chat - Image —
xai_api.Image - Video —
xai_api.Video - Batch Management —
xai_api.BatchMgmt - Models —
xai_api.Models - Auth —
xai_api.Auth - Tokenize —
xai_api.Tokenize - Raw Sampling —
xai_api.Sample
Last updated: September 2, 2026