Get started with xAI
Intelligent, fast, and cost effective models across text, voice, images, and video.
import os
from xai_sdk import Client
from xai_sdk.chat import user, system
client = Client(
api_key=os.getenv("XAI_API_KEY"),
)
chat = client.chat.create(model="grok-4.3")
chat.append(system("You are Grok, a chatbot inspired by the Hitchhiker's Guide to the Galaxy."))
chat.append(user("What is the meaning of life, the universe, and everything?"))
response = chat.sample()
print(response)Models
Grok 4.3
New
Strong agentic tool calling with minimal hallucinations. Supports non-reasoning mode.
Voice API
Real-time conversations, speech-to-text, and text-to-speech.
Agent$3.00 / hour
TTS$15.00 / 1M characters
STT
LatencySub-second
Imagine API
Turn ideas into reality with image and video generation.
ModesGeneration & editing
Image- / image
Video- / second
Resolution1K & 2K
Jump straight in
Try text, voice, image, and video models below
import os
from xai_sdk import Client
from xai_sdk.chat import user, system
client = Client(
api_key=os.getenv("XAI_API_KEY"),
)
chat = client.chat.create(model="grok-4.3")
chat.append(system("You are Grok, a chatbot inspired by the Hitchhiker's Guide to the Galaxy."))
chat.append(user("What is the meaning of life, the universe, and everything?"))
response = chat.sample()
print(response)