gRPC API

Models

View as Markdown

xai_api.Models

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

Methods: xai_api.Models

ListLanguageModelsunary

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

ListEmbeddingModelsunary

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

ListImageGenerationModelsunary

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

GetLanguageModelunary

Get details of a specific language model by model name.

GetEmbeddingModelunary

Get details of a specific embedding model by model name.

GetImageGenerationModelunary

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