Tools & SDKs
OpenAI SDK
Use the official OpenAI SDK with XMAI’s OpenAI-compatible endpoint.
XMAI works with the official OpenAI SDK. Change the base URL and API key; the
rest of your code can stay OpenAI-compatible.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Use the official OpenAI SDK with XMAI’s OpenAI-compatible endpoint.
from openai import OpenAI
client = OpenAI(
api_key="your-XMAI-api-key",
base_url="https://xmapi.site/v1",
)
response = client.chat.completions.create(
model="claude-opus-4-8",
messages=[{"role": "user", "content": "Explain what a race condition is."}],
)
print(response.choices[0].message.content)
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "your-XMAI-api-key",
baseURL: "https://xmapi.site/v1",
});
const response = await client.chat.completions.create({
model: "claude-opus-4-8",
messages: [{ role: "user", content: "Explain what a race condition is." }],
});
console.log(response.choices[0].message.content);