Account and Usage API
export BASE_URL="https://api.xairouter.com"
export API_KEY="sk-Xvs..."Endpoints
| Method and path | Scope | Permission | Description |
|---|---|---|---|
GET /dashboard/status | Current account | Any account | Identity, balance, and capability flags |
GET /dashboard/info | Current account | Any account | Configuration, limits, and credit details |
GET /dashboard/live | Current account | Any account | info plus live usage for today and this month |
GET /dashboard/bill | Current account | Any account | Billing by date with per-model details |
GET /dashboard/logs | Management operations of the current account | Manager | Operation log |
GET /dashboard/news | Current account | Any account | System, group, and personal notices |
GET /dashboard/ips | Current account | Any account | The addresses this key was used from |
GET /x-bill | Descendant accounts | Manager | Aggregated billing and account ranking |
/dashboard/*shares the entry point of model calls and acceptsAuthorization,x-api-key, orx-goog-api-key;/x-billaccepts onlyAuthorization.GET /dashboard/*stays available when an account is frozen for low balance, or over its daily or monthly credit, so you can see why.- There is also
GET /dashboard/models(the same model catalog as/v1/models, still reachable when frozen or over credit). Other/dashboard/*paths return404;/dashboard/*has no/v1form.
Account status
curl "$BASE_URL/dashboard/status" -H "Authorization: Bearer $API_KEY"| Field | Description |
|---|---|
object | Always user_status |
id, name, alias, email, dna | Account identity and its lineage path in the account tree |
public_key | Public identifier (pk-Xvs...), used for referral sign-up and pricing catalog queries |
balance | Current available balance |
role, factor | Billing tier and price factor |
manage | Whether the account has manager permission (can manage sub-accounts) |
owner | Whether the account is a tenant owner |
plan_follows_parent | Whether plan and pricing follow the parent account |
suspended | Whether the account is frozen for low balance |
user_api_balance | Minimum balance required for manager permission |
user_min_balance | Freeze threshold (calls are suspended below this balance) |
support_qr_url | Support QR code URL (may be omitted) |
role decides how credit and rate limits are enforced: 0 and 1 skip daily and monthly credit checks and rate limits; 2 enforces them strictly; 3 is a subscription account, which switches to its pay-as-you-go balance, if any, when the subscription credit runs out or the daily or monthly credit is exceeded.
Account info
curl "$BASE_URL/dashboard/info" -H "Authorization: Bearer $API_KEY"object is user_info. Main fields:
| Field | Description |
|---|---|
id, name, alias, email, billing_email, dna | Account identity |
level, tier, role, factor | Routing group, tier, billing tier, and price factor |
balance | Available balance |
credit_used | Cumulative credit used |
credit_balance | Array of credit entries {amount, balance, reference, granted_at, expires_at}; each entry has its own expiry |
daily_limit, hard_limit, soft_limit | Daily credit, monthly credit (rejected when exceeded), monthly reference value (not used for admission) |
rpm, rph, rpd, tpm, tph, tpd | Account-level request and token rate limits; 999999999999999999 means unlimited |
user_limit, user_n | Maximum and current number of sub-accounts |
requests | Cumulative request count |
resources | Resource (path) allowlist; empty means unrestricted |
allow_ips, allow_models, allow_levels | IP, model, and Level allowlists (omitted when empty) |
model_limits | Model-level limits {model: {rpm, rph, rpd, tpm, tph, tpd}} |
model_mapper, level_mapper | Account-level mappings |
create_at | Creation time (the field really is named so) |
Live usage
curl "$BASE_URL/dashboard/live" -H "Authorization: Bearer $API_KEY"On top of all fields of /dashboard/info (object is user_live), daily_usage and monthly_usage are added. The fields of these two objects are PascalCase:
| Field | Description |
|---|---|
Requests | Request count |
Prompt, Completion, Reasoning | Input, output, and reasoning tokens |
CreditUsed | Credit used |
Find, PageN, QueryN | File-search count, pages, search and tool-call count |
ImageN, ImageCost, SizeHigh, SizeMedium, SizeLow | Image count, cost, and size-tier distribution |
CachedDetails, PromptDetails, CompletionDetails | Cache and modality details |
ModelUsage | The same structure split by model name |
Suited to dashboard polling; use /dashboard/bill for historical trends.
Billing history
GET /dashboard/bill # today
GET /dashboard/bill?date=2026-11-18 # one day
GET /dashboard/bill?start=2026-11-01&end=2026-11-18 # range (inclusive)
GET /dashboard/bill?days=7 # today and the 7 days before, 8 calendar days| Parameter | Alias | Description |
|---|---|---|
date | d | A single day; highest priority |
start | s, start_date | Start date |
end | e, end_date | End date, default today |
days | none | Number of days to look back |
- A malformed date returns
400 Invalid date format. Please use YYYY-MM-DD format. - A query spanning more than 30 days incurs one management call fee; beyond 3 years, the start is truncated to 3 years back and 5 more fees are charged. The management call fee defaults to 0.012 USD per call and appears in the bill under the model name
XAPI.
Response structure
/dashboard/bill and /x-bill share the following structure (object is bill_info):
| Field | Description |
|---|---|
daily_costs[] | Ascending by date: timestamp, date, line_items[] ({name, cost, usage}, split by model), the day's total_*, usage_analysis, token_summary |
usage_summary | Per-model summary over the whole range; each value is {model_stats, usage_analysis, token_summary} |
total_requests, total_credit_used | Request and cost totals |
total_prompt, total_completion, total_reasoning | Token totals |
total_find, total_page_n, total_query_n | File-search, page, search, and tool-call totals |
total_image_n, total_size_high, total_size_medium, total_size_low | Image totals |
total_cached_details, total_prompt_details, total_completion_details | Detail totals (may be omitted) |
token_summary | input_total, input_uncached, cache_read, cache_write, cache_related, output_total, reasoning_output, processed_total |
{
"object": "bill_info",
"daily_costs": [
{
"timestamp": 1763395200,
"date": "2026-11-18",
"total_requests": 24,
"total_prompt": 18200,
"total_completion": 3600,
"total_credit_used": 1.42,
"line_items": [{"name": "gpt-6.2-sol", "cost": 1.42, "usage": {}}]
}
],
"usage_summary": {"gpt-6.2-sol": {}},
"total_requests": 24,
"total_prompt": 18200,
"total_completion": 3600,
"total_reasoning": 0,
"total_credit_used": 1.42,
"token_summary": {"input_total": 18200, "cache_read": 6400, "output_total": 3600, "processed_total": 21800}
}Descendant usage
GET /x-bill?start=2026-11-01&end=2026-11-18
GET /x-bill?user=42&days=30Covers all descendant accounts below the current account, excluding the current account itself. Requires manager permission and incurs no management call fee itself.
| Parameter | Description |
|---|---|
date/d, start/s/start_date, end/e/end_date, days | Same as /dashboard/bill |
user/u | Filter descendants: numeric ID, account name, email (contains @), DNA prefix (starts with .), or L<n>/G<n>/R<n>/T<n>/F<x> (by Level, Gear, Role, Tier, Factor). A non-descendant or no match returns 404 User not found |
For ranges longer than 3 years, the bill covers the 36 months ending on the requested end date.
On top of the shared structure, /x-bill adds usage_users, which contains only accounts with requests in the range, sorted by cost from high to low:
| Field | Description |
|---|---|
id, name, alias, email | Account identity |
top_cost_model, top_request_model | Model with the highest cost and the most requests |
total_*, token_summary | The account's totals |
usage_analysis.request_percentage, usage_analysis.cost_percentage | Share of all descendants' requests and cost (two decimals) |
Operation log
GET /dashboard/logs?page=1&size=24Requires manager permission.
| Parameter | Description |
|---|---|
page | Page number, starting at 1 |
size | Items per page, 1 to 100, default 24 |
action | Return only the given action type |
The response is {logs, total, page, size, has_more}. Each log entry has id, timestamp, pid, parent_name, action, user_id, user_name, details, ip, user_agent.
Account-management action values: add_user, update_user, delete_user, get_users, create_news, rotate_self. Each account keeps only a short window of recent operations; it is not a complete audit archive.
Notices
curl "$BASE_URL/dashboard/news" -H "Authorization: Bearer $API_KEY"{"sys_news": [], "user_news": [], "dna_news": []}| Field | Source |
|---|---|
sys_news | System announcements published by the service provider |
user_news | Personal notices addressed to the current account; cleared after being read once |
dna_news | Notices addressed to the current account's group (direct children of the same parent) |
Each notice is {title, content, created_at, expires_at, created_by}; expired notices are not returned. To publish notices, see the Account Management API.
Caller addresses
curl "$BASE_URL/dashboard/ips" -H "Authorization: Bearer $API_KEY"{
"object": "caller_ips",
"notify": "on",
"ips": [
{"ip": "203.0.113.7", "user_agent": "codex_cli_rs/0.130.0", "first_seen": "2026-11-27", "last_seen": "2026-11-27"},
{"ip": "2001:db8:1:2::/64", "user_agent": "OpenAI/Python 2.8.1", "first_seen": "2026-10-02", "last_seen": "2026-11-27"}
]
}| Field | Description |
|---|---|
ips[] | The addresses this key was used from, most recently used first. An IPv4 address is recorded as it is, an IPv6 host by its /64 |
user_agent | The User-Agent it was last seen with, cut to 256 bytes; empty when none was recorded |
first_seen, last_seen | The dates it was first and last seen |
notify | on: a new address is announced; learning: the account's first 7 days of record, noted but not announced; muted: the notices have stopped; allow_list: the account has an IP allow-list, so nothing is announced |
- An account keeps at most 8 addresses, and one not seen for 32 days is forgotten. Only the account itself can read them.
- A new address is announced by an email to the account's address and a personal notification. An account gets at most one email a day, naming every new address it has not yet been told of, each with its User-Agent; when new addresses turn up 3 days in a row its addresses are evidently not stable, and the last email says that no more will be sent.
- An address is not recorded on every call. It is looked at on three occasions: the first call after the account has been idle for a while, calls on the account management API and from the console, and one in every 1000 model calls. On a busy account an address used only now and then may therefore not appear.
Choosing an endpoint
- Current balance and live totals for today and this month:
/dashboard/live - The current account for one day, a range, or split by model:
/dashboard/bill - Overall consumption and ranking of all descendants:
/x-bill