Admin Console

XAI Admin is a graphical configuration management console for owners, used to manage provider keys, system configuration, news broadcasts, and operation logs.

โ€”

Feature Overview

The XAI Admin console includes the following core functional modules:

  1. AI API Documentation - View supported AI service providers and SDK examples
  2. Model Services (Provider Management) - Manage upstream AI provider keys
  3. System Configuration - Configure model mapping, level mapping, resource allowlists, etc.
  4. Broadcast Notifications - Publish system-level or targeted user notifications
  5. Operation Logs - View all account operation records

โ€”

Access Control

  • Owner Only: Only owner accounts (isOwner=true) can log in to the Admin console
  • Local Key Storage: API Key is only stored in browser local storage, never uploaded to server
  • Session Management: Login state is stored in browser, requires re-login after closing page

Feature Details

Common Task Guide

  • Add upstream provider โ†’ open โ€œModel Servicesโ€ โ†’ submit form โ†’ API: POST /x-keys
  • View/filter providers โ†’ โ€œModel Servicesโ€ list โ†’ GET /x-keys, GET /x-conf
  • Configure Model Mapper โ†’ โ€œSystem Configurationโ€ โ†’ PUT /x-config (MODEL_MAPPER)
  • Configure Level Mapper โ†’ โ€œSystem Configurationโ€ โ†’ PUT /x-config (LEVEL_MAPPER)
  • Set Resources allowlist โ†’ โ€œSystem Configurationโ€ โ†’ PUT /x-config (RESOURCES)
  • Set Model Limits โ†’ โ€œSystem Configurationโ€ โ†’ PUT /x-config (MODEL_LIMITS)
  • Publish system/targeted news โ†’ โ€œBroadcast Notificationsโ€ โ†’ POST /x-news / POST /x-news/{target}
  • View operation logs โ†’ โ€œOperation Logsโ€ โ†’ GET /dashboard/logs

Featureโ€“Endpointโ€“Permission Matrix

FeaturePrimary EndpointsPermission
Provider managementGET/POST/PUT/DELETE /x-keys, GET /x-confOwner only
Owner config (Model/Level/Resources/Limits)GET/PUT /x-configOwner only
News (system/targeted)POST/DELETE /x-news, GET /dashboard/newsOwner only (system); Owner/ancestor (targeted)
Operation logsGET /dashboard/logsOwner only

Terminology: uses Model Mapper, Level Mapper, Resources (allowlist), Model Limits, Sleep, Switch Over โ€” see โ€œTerminologyโ€.

1. AI API Tab

Displays platform-supported AI service providers and SDK usage examples.

Features:

  • Model List Link - Dynamic display of /v1/models endpoint link
  • Supported AI Service Providers - Shows 9 major AI services (OpenAI, Anthropic, Perplexity, Mistral, Grok, Gemini, Cohere, DeepSeek, AI21)
  • SDK Example Code - Complete examples for OpenAI SDK and Anthropic SDK
  • One-Click Copy - Example code supports one-click copy

Backend Endpoints:

  • /v1/models - Get available model list

2. Model Services (Provider Management)

Manage upstream AI provider key pools with support for multiple provider types.

Features:

  • Statistics Cards - Display total levels, total keys, active keys
  • Add Provider - Support three configuration types:
    • Standard configuration (OpenAI, Anthropic, etc.)
    • Azure OpenAI configuration
    • Google Vertex AI configuration
  • Provider List - Display all providers grouped by level
  • Edit/Delete Provider - Support modifying provider configuration or deletion
  • Status Management - Enable/disable providers

Add Provider Form Fields:

  • Name - Provider name (optional, for identification)
  • Level - Load pool level (required, for routing)
  • Provider - Upstream API URL (required)
  • SecretKey - API key (required)
  • Standard Config - No additional fields
  • Azure Config - Model Mapping, API Version mapping
  • Vertex Config - Base URL, Project ID, Client Email, Private Key

Backend Endpoints:

  • POST /x-keys - Add new key
  • GET /x-keys - Get key list
  • PUT /x-keys/{id} - Update key
  • DELETE /x-keys/{id} - Delete key

3. System Configuration Tab

Manage owner-level system configuration parameters.

Configuration Items:

Basic Configuration:

  • XAI_MAIL - System notification email
  • RESOURCES - Allowed API resource paths (comma-separated)
  • MODEL_LIMITS - Model-level rate limits (JSON format)

Email Configuration:

  • EMAIL_SMTP - SMTP server address
  • EMAIL_PORT - SMTP port
  • EMAIL_AUTH - Authentication email
  • EMAIL_PASS - Email password
  • EMAIL_TLS - Enable TLS (true/false)

Mapping Configuration:

  • MODEL_MAPPER - System model mapping (format: source=target)
    • Example: gpt-3.5*=gpt-4o-mini,gpt-4=gpt-4o
    • Purpose: Automatically convert requested models to other models
  • LEVEL_MAPPER - Model group mapping (format: model=level)
    • Example: gpt*=1,claude*=2,deepseek*=3
    • Purpose: Specify which level's provider pool handles which models
  • SWITCH_OVER - Model group primary/backup switching (format: primary=backup)
    • Example: 1=10,2=20
    • Purpose: When primary level has >5 errors in 1 minute, auto-switch to backup level

Backend Endpoints:

  • GET /x-config - Get current configuration
  • PUT /x-config - Update configuration

4. Broadcast Notifications Tab

Publish system-level or targeted user notifications.

Features:

  • Create Notification - Fill in title and content to publish notification
  • Notification List - View historical notification records
  • Delete Notification - Delete expired or incorrect notifications

Field Description:

  • title - Notification title (required, max 100 characters)
  • content - Notification content (required, max 1000 characters)

Backend Endpoints:

  • POST /x-news - Create system news
  • POST /x-news/{target} - Create targeted news
  • GET /dashboard/news - Get news list
  • DELETE /x-news - Delete news

5. Operation Logs Tab

View all account operation records with pagination support.

Features:

  • Log Table - Display time, action, target account, details, IP address
  • Auto Pagination - Default 24 records per page
  • Real-time Update - Auto refresh when entering tab

Backend Endpoints:

  • GET /dashboard/logs - Get operation logs

โ€”

Use Cases

Use Case 1: Add Standard Provider

  1. Go to "Model Services" tab
  2. Fill in "Add Provider" form:
    • Name: OpenAI Production
    • Level: 1
    • Provider: https://api.openai.com
    • SecretKey: sk-...
  3. Click "Add Provider"
  4. System automatically adds gpt*=1 mapping to LEVEL_MAPPER

Use Case 2: Configure Azure OpenAI

  1. Go to "Model Services" tab
  2. Select configuration type: "Azure OpenAI Configuration"
  3. Fill in basic info and Azure-specific config:
    • Provider: https://your-resource.openai.azure.com
    • Model โ†’ Deployment mapping: {"gpt-4o": "gpt-4-deployment"}
  4. Click add
  5. System automatically handles Azure-specific request routing

Use Case 3: Set Model Mapping

  1. Go to "System Configuration" tab
  2. In "System Model Mapping" enter:
    gpt-3.5*=gpt-4o-mini,o*=gpt-4o
    
  3. In "Model Group Mapping" enter:
    gpt*=1,claude*=2,deepseek*=3
    
  4. Click "Save Configuration"
  5. System automatically applies new mapping rules

Use Case 4: Publish System Notification

  1. Go to "Broadcast Notifications" tab
  2. Fill in notification title and content:
    • Title: System Maintenance Notice
    • Content: System will undergo maintenance tomorrow 2:00-4:00 AM...
  3. Click "Send Notification"
  4. All users will see this notification in Manage console

โ€”

Best Practices

Provider Management

  1. Group by Service - Put same service provider's keys in same level
  2. Set Backup Switching - Use SWITCH_OVER to configure backups for critical levels
  3. Regular Check Sleeping Keys - View sleeping status in provider list
  4. Reasonable Level Setting - Divide different levels by cost, speed, reliability

Configuration Management

  1. Model Mapping Purpose - Use for smooth migration or cost optimization
  2. Careful RESOURCES Modification - Wrong config may cause API access issues
  3. MODEL_LIMITS Restrictions - Set strict rate limits for expensive models
  4. Regular Config Backup - Use /x-config endpoint to export configuration

Notification Management

  1. Important Notifications First - Use system-level notifications for critical information
  2. Concise Content - Avoid overly long notification content
  3. Timely Cleanup - Delete expired or invalid notifications

โ€”

FAQ

Q: Why can't I log in to Admin console?

A: Only owner accounts can log in to Admin console. Sub-accounts should use Manage console.

Q: Models still can't be used after adding Provider?

A: Check the following:

  1. Does LEVEL_MAPPER include mapping for this model
  2. Is Provider status enabled
  3. Is SecretKey valid

Q: How to view system auto-added LEVEL_MAPPER?

A: You can view and modify in "System Configuration" tab's "Model Group Mapping" field.

Q: Is Azure config's API Version mapping required?

A: No, it's optional. If left empty, system will use default versions configured in environment variables.

Q: How to backup my configuration?

A: Use the following command to export configuration:

curl -H "Authorization: Bearer $API_KEY" \
  https://api.xaixapi.com/x-config > config-backup.json

โ€”