API Reference
API Reference
Welcome to XAI XAPI documentation. Our platform provides a comprehensive set of APIs for managing AI services, subaccounts, and resources.
API Overview
XAI provides the following API categories:
Core APIs
- Authentication API - API authentication and key management
- AI Service Proxy API - OpenAI/Anthropic compatible endpoints
Console APIs
Admin API - Admin Console specific API
- Provider key management
- System configuration (model mapping, Level routing, pricing override)
- Broadcast notifications
Manage API - Manage Console specific API
- Subaccount management (create, query, update, delete)
- Dashboard queries (status, usage, billing, logs)
Console Guides
- Admin Console Guide - Admin UI instructions
- Manage Console Guide - Manage UI instructions
Quick Start
Authentication
All API requests require Bearer token authentication:
Authorization: Bearer sk-Xvs...
Base URL
https://api.xaixapi.com
Admin API Quick Examples
# Add Provider key
curl -X POST https://api.xaixapi.com/x-keys \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"SecretKey": "sk-...",
"Name": "OpenAI Production",
"Level": 1,
"Provider": "https://api.openai.com"
}'
# Configure model mapping
curl -X PUT https://api.xaixapi.com/x-config \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"MODEL_MAPPER": "gpt-3.5*=gpt-4o-mini"}'
Manage API Quick Examples
# Create subaccount
curl -X POST https://api.xaixapi.com/x-users \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"Name": "prod-account",
"Email": "[email protected]",
"CreditGranted": 500
}'
# Query usage
curl -H "Authorization: Bearer $API_KEY" \
https://api.xaixapi.com/dashboard/bill
Documentation Navigation
By Role
Owner Account:
- Admin API - System configuration and Provider management
- Admin Console Guide - UI instructions
All Users:
- Manage API - Subaccount and usage management
- Manage Console Guide - UI instructions
- AI Service Proxy - Call AI models
By Function
Account Management:
- Create subaccount → Manage API: Create Subaccount
- Query subaccount → Manage API: Query Subaccount
- Update subaccount → Manage API: Update Subaccount
System Configuration:
- Provider management → Admin API: Provider Key Management
- Model mapping → Admin API: System Configuration
- Pricing override → Admin API: Pricing Override
Usage Monitoring:
- Account status → Manage API: User Status
- Usage billing → Manage API: Usage Billing
- Operation logs → Manage API: Operation Logs
Related Resources
- Quick Start - Getting started guide
- Glossary - Core concepts and terminology
- Product Documentation - XAI Router product documentation