Skip to content

Get started

Build with Grok — intelligent, fast, and cost-effective models across code, text, voice, image, and video.

Models

We offer a range of models supporting multiple use cases and modalities.

Code API

Agentic coding with Grok Build (), our coding model, on the API and CLI.

  • Agentic coding workflows
  • Powers Grok Build
  • Available on the API in early access

Responses API

Generate text, have conversations, use tools, and build AI-powered applications.

  • Generate text
  • Multi-turn chat
  • Function calling

Voice API

Convert text to natural speech or transcribe audio with our voice models.

  • Text to speech
  • Speech to text
  • Real-time voice

Imagine API (Images)

Generate stunning images from text, edit existing images, and understand visual content.

  • Generate images
  • Edit images
  • Precise control

Imagine API (Video)

Bring an image to life, start from a simple text prompt, or refine a complex cinematic sequence.

  • Generate videos
  • Edit videos
  • Precise control

Quick Start

python
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_XAI_API_KEY",
    base_url="https://api.x.ai/v1",
)

response = client.responses.create(
    model="grok-4.5",
    input="Fix this function and explain the bug: function median(a){a.sort();return a[a.length/2]}",
)

print(response.output_text)
bash
curl https://api.x.ai/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $XAI_API_KEY" \
  -d '{
    "model": "grok-4.5",
    "input": "Fix this function and explain the bug: function median(a){a.sort();return a[a.length/2]}"
}'

Get Started

Build

Resources

💬