gRPC API

Overview

View as Markdown

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


Last updated:September 2, 2026