gRPC API

Models

xai_api.Models

An API service that let users get details of available models on the platform.

Methods of xai_api.Models

ListLanguageModels

unary

Lists all language models available to your team (based on the API key).

ListEmbeddingModels

unary

Lists all embedding models available to your team (based on the API key).

ListImageGenerationModels

unary

Lists all image generation models available to your team (based on the API key).

GetLanguageModel

unary

Get details of a specific language model by model name.

GetEmbeddingModel

unary

Get details of a specific embedding model by model name.

GetImageGenerationModel

unary

Get details of a specific image generation model by model name.

List available models

import os
import xai_sdk

client = xai_sdk.Client(api_key=os.getenv("XAI_API_KEY"))

# List language models
for model in client.models.list_language_models():
    print(f"{model.name} (aliases: {', '.join(model.aliases)})")

# List image generation models
for model in client.models.list_image_generation_models():
    print(f"{model.name}")

Last updated: September 2, 2026