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

  1. Authentication API - API authentication and key management
  2. AI Service Proxy API - OpenAI/Anthropic compatible endpoints

Console APIs

  1. Admin API - Admin Console specific API

    • Provider key management
    • System configuration (model mapping, Level routing, pricing override)
    • Broadcast notifications
  2. Manage API - Manage Console specific API

    • Subaccount management (create, query, update, delete)
    • Dashboard queries (status, usage, billing, logs)

Console Guides

  1. Admin Console Guide - Admin UI instructions
  2. 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:

All Users:

By Function

Account Management:

System Configuration:

Usage Monitoring: