xAI
xAI serves 4 text models on LLM API, all from xAI.
Models and prices
Prices when xAI serves the request.
No xAI model matches your search.
Send requests to xAI
Put xai/ before a model ID and the request goes to xAI. If xAI’s uptime over the last 5 minutes is below 90%, it goes to another provider of the model, unless it sends X-No-Fallback: true. Routing docs
Example: Grok 4.7
POST /v1/chat/completionsSet LLMAPI_KEY to your LLM API key.Chat Completions docs
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.llmapi.ai/v1",
api_key=os.environ["LLMAPI_KEY"],
)
response = client.chat.completions.create(
model="xai/grok-4.7",
messages=[{"role": "user", "content": "Hello"}],
)
print(response.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.llmapi.ai/v1",
apiKey: process.env.LLMAPI_KEY,
});
const response = await client.chat.completions.create({
model: "xai/grok-4.7",
messages: [{ role: "user", content: "Hello" }],
});
console.log(response.choices[0].message.content);curl https://api.llmapi.ai/v1/chat/completions \
-H "Authorization: Bearer $LLMAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "xai/grok-4.7",
"messages": [{"role": "user", "content": "Hello"}]
}'Prices synced November 13, 2026.