π Supported AI Service Providers
β¨ The XAI platform is compatible with virtually all major AI providers and model ecosystems, supporting unified integration and flexible switching.
π§ How It Works
One entrypoint handles auth, routing, and normalization before reaching model providers.
Single entrypoint
Use one XAI API key and a unified base_url.
Smart routing
Policies, model mapping, rate limits, and observability live in the router.
Provider fan-out
Requests go to OpenAI, Claude, Gemini, and more, then normalize on the way back.
π» SDK Code Examples
OpenAI SDK Example
import os
from openai import OpenAI
XAI_API_KEY = os.getenv("XAI_API_KEY")
client = OpenAI(
api_key=XAI_API_KEY,
base_url="",
)
completion = client.chat.completions.create(
model="gpt-5",
messages=[
{"role": "system", "content": "You are AI"},
{"role": "user", "content": "What is the meaning of life, the universe, and everything?"},
],
)
print(completion.choices[0].message)
Anthropic SDK Example
import os
from anthropic import Anthropic
XAI_API_KEY = os.getenv("XAI_API_KEY")
client = Anthropic(
api_key=XAI_API_KEY,
base_url="",
)
message = client.messages.create(
model="claude-sonnet-4-5-20250929",
max_tokens=128,
system="You are AI.",
messages=[
{
"role": "user",
"content": "What is the meaning of life, the universe, and everything?",
},
],
)
print(message.content)
π§ͺ cURL Examples
OpenAI /chat/completions
curl /chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $XAI_API_KEY" \
-d '{
"model": "gpt-5.2",
"messages": [
{
"role": "developer",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Hello!"
}
]
}'
Anthropic /messages
curl /v1/messages \
-H 'Content-Type: application/json' \
-H 'anthropic-version: 2023-06-01' \
-H "X-Api-Key: $XAI_API_KEY" \
-d '{
"max_tokens": 1024,
"messages": [
{
"content": "Hello, world",
"role": "user"
}
],
"model": "claude-sonnet-4-5-20250929"
}'
Add New Provider
Provider List
Loading...
System Configuration Management
Model Pricing (Owner Overrides)
Provide only the deltas from system defaults. Applied immediately; requests prefer Owner overrides and fall back to defaults.
Override examples:
β’ Override an existing model: {"ChatPricing":{"gpt-5":{"InputText":4.5,"OutputText":12.5,"Rates":1}}}
β’ Add a custom model: {"ChatPricing":{"my-model":{"InputText":1,"OutputText":2,"Rates":1}}}
β’ Free model (Rates=0): {"ChatPricing":{"free-model":{"InputText":0,"OutputText":0,"Rates":0}}}
Subscription Plans (Monthly)
Push sellable monthly plans to the frontend. Prices β₯ 100000 hide the plan on the user side for temporary takedowns.
Create New Broadcast
Recent Broadcasts
Operation Logs
| Time | Action | Target | Details | IP |
|---|
Loading logs...
No operation logs found