Admin API Reference

This page is aligned with the current backend implementation (api/main.go + api/handler/*.go) and includes only public Admin interfaces.


Base Information

  • Base URL: https://api.xaicontrol.com
  • Auth: Authorization: Bearer sk-Xvs...
  • Permission: Owner role can access all endpoints on this page
export BASE_URL="https://api.xaicontrol.com"

Endpoint Overview

ModuleMethodEndpointDescription
Key managementGET/x-keysList keys (filter + pagination)
Key managementGET/x-keys/{id}Filtering
Key managementPOST/x-keysCreate key
Key managementPUT/POST/x-keys/{id}Update key
Key managementDELETE/x-keys/{id}Delete key
Config inspectionGET/x-confRead owner config and key status summary
Config batch updatePOST/x-confBatch update config
Config CRUDGET/PUT/POST/DELETE/x-configOwner config CRUD
User detailGET/x-info?user={id or name}Query detailed user info

1) Key Management (/x-keys)

1.1 List keys

GET /x-keys

Query params:

  • id
  • level
  • provider
  • page, size

Path filters:

  • /x-keys/123
  • /x-keys/L2
  • /x-keys/api.openai.com

Response is an array. Pagination headers: X-Total-Count, X-Page, X-Per-Page, X-Total-Pages.

curl -H "Authorization: Bearer $API_KEY" \
  "${BASE_URL}/x-keys?page=1&size=20&level=2"

1.2 Create key

POST /x-keys

{
  "Name": "OpenAI Primary",
  "Level": 1,
  "Provider": "https://api.openai.com",
  "SecretKey": "sk-xxxxxxxxxxxxxxxxxxxx",
  "Status": true,
  "config": {
    "provider_type": "standard"
  }
}

1.3 Update key

PUT /x-keys/{id} or POST /x-keys/{id}

Updatable fields: Name, Level, Provider, SecretKey, Status, config.

1.4 Delete key

DELETE /x-keys/{id}


2) Batch Config (/x-conf)

2.1 Get config

GET /x-conf

Core fields:

  • Resources
  • LevelMapper
  • ModelMapper
  • ModelFailover
  • ModelLimits
  • SwitchOver
  • SleepingKeys
  • DisabledKeys
  • UserMinBalance
  • UserApiBalance

2.2 Batch update

POST /x-conf

Common fields:

  • Resources
  • LevelMapper
  • ModelMapper
  • ModelFailover
  • ModelLimits

ModelLimits accepts object payloads or command strings (e.g. * to clear, -model to remove).


3) Config CRUD (/x-config)

3.1 Get config

GET /x-config

Returns configs, including MODEL_MAPPER, MODEL_FAILOVER, LEVEL_MAPPER, SWITCH_OVER, RESOURCES, MODEL_LIMITS, PRICING, etc.

3.2 Update config

PUT /x-config or POST /x-config

The backend parses request body as map[string]string; use string values.

3.3 Delete config keys

DELETE /x-config

{
  "keys": ["MODEL_MAPPER", "PRICING"]
}

4) User Detail (/x-info)

GET /x-info?user={id or name}

  • user is required
  • Limited to users inside the current owner tree
  • Returns balances, limits, ACLs, mappings, and usage detail

Internal maintenance/correction interfaces are intentionally excluded from this public document.