One endpoint for every AI model
XAPI provides one OpenAI-compatible interface. Keep the SDK you know and change only the base URL and API key to switch across models and providers.
Make your first call in 5 minutes
Create a key, install the SDK, and send your first request. Every model shares the same authentication and balance.
Get an API key
Create a key in the console. It is shown in full only once—store it safely and never commit it to client code or a public repository.
Open consoleInstall the OpenAI SDK
XAPI works with the OpenAI SDK. Existing projects usually only need a client configuration change.
pip install openaiSend a chat request
Model IDs are case-sensitive. Copy a currently available model ID from the model marketplace.
View model listfrom openai import OpenAI
client = OpenAI(
api_key="$XAPI_API_KEY",
base_url="https://api.xapi.love/v1",
)
response = client.chat.completions.create(
model="gpt-5.4",
messages=[{"role": "user", "content": "Hello, XAPI!"}],
)
print(response.choices[0].message.content)Response shape
Successful requests follow the OpenAI Chat Completions format. Log the request_id in production to make troubleshooting easier.
{
"id": "chatcmpl_xapi_01",
"object": "chat.completion",
"model": "gpt-5.4",
"choices": [{
"index": 0,
"message": { "role": "assistant", "content": "Hello!" },
"finish_reason": "stop"
}],
"usage": { "prompt_tokens": 12, "completion_tokens": 4, "total_tokens": 16 }
}Core endpoints
Every request uses Bearer Token authentication and sends JSON over HTTPS.
| Method | Path | Purpose |
|---|---|---|
| POST | /v1/chat/completions | Create a chat completion |
| GET | /v1/models | List available models |
| POST | /v1/responses | Create a Responses task |
| GET | /v1/dashboard/billing | Get account balance and usage |
Error handling
XAPI uses standard HTTP status codes and returns a readable error message. Retry 429 and 5xx responses with exponential backoff.
| Status | Meaning | Recommended action |
|---|---|---|
400 | Invalid request parameters | Check fields, types, and model ID |
401 | Authentication failed | Check the API key and Authorization header |
429 | Too many requests | Reduce concurrency and retry with backoff |
500 | Temporary service failure | Contact support with the request_id |
Keep exploring
When you are ready, read the complete API reference or choose a model for your workload.