gRPC API Reference
The xAI gRPC API is a robust, high-performance gRPC interface designed for seamless integration into existing systems.
The base url for all services is at api.x.ai. For all services, you have to authenticate with the header Authorization: Bearer <your xAI API key>.
Visit xAI API Protobuf Definitions to view and download our protobuf definitions.
The xAI Python SDK (xai-sdk) uses gRPC natively. Install with pip install xai-sdk.
Using buf curl
Clone the proto definitions and use buf curl to call the API:
git clone https://github.com/xai-org/xai-proto.git
cd xai-proto
All buf curl examples below assume you run from inside the cloned xai-proto directory.