xAI API via CheapLLM
Access 3 xAI models (Grok 4.7, Grok 4.6, Grok Build 0.1) behind one unified API endpoint with transparent per-million-token pricing, full context windows, and instant OpenAI/Anthropic SDK compatibility.
All xAI models & pricing comparison
Prices verified 2026-11-28| Model | Context | Official (in / out) | CheapLLM (in / out) | Savings |
|---|---|---|---|---|
| Grok 4.7 | 500K | $1.40 / $4.20 | −30% | |
| Grok 4.6 | 500K | $1.40 / $4.20 | −30% | |
| Grok Build 0.1 | 256K | $0.70 / $1.40 | −30% |
Quickstart with xAI
Python (OpenAI SDK)
from openai import OpenAI
import os
client = OpenAI(
base_url="https://api.cheapllm.com/v1",
api_key=os.environ["CHEAPLLM_API_KEY"],
)
response = client.chat.completions.create(
model="x-ai/grok-4.7",
messages=[{"role": "user", "content": "Hello!"}],
)