Account and Usage API

export BASE_URL="https://api.xairouter.com"
export API_KEY="sk-Xvs..."

Endpoints

Method and pathScopePermissionDescription
GET /dashboard/statusCurrent accountAny accountIdentity, balance, and capability flags
GET /dashboard/infoCurrent accountAny accountConfiguration, limits, and credit details
GET /dashboard/liveCurrent accountAny accountinfo plus live usage for today and this month
GET /dashboard/billCurrent accountAny accountBilling by date with per-model details
GET /dashboard/logsManagement operations of the current accountManagerOperation log
GET /dashboard/newsCurrent accountAny accountSystem, group, and personal notices
GET /dashboard/ipsCurrent accountAny accountThe addresses this key was used from
GET /x-billDescendant accountsManagerAggregated billing and account ranking
  • /dashboard/* shares the entry point of model calls and accepts Authorization, x-api-key, or x-goog-api-key; /x-bill accepts only Authorization.
  • 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 return 404; /dashboard/* has no /v1 form.

Account status

curl "$BASE_URL/dashboard/status" -H "Authorization: Bearer $API_KEY"
FieldDescription
objectAlways user_status
id, name, alias, email, dnaAccount identity and its lineage path in the account tree
public_keyPublic identifier (pk-Xvs...), used for referral sign-up and pricing catalog queries
balanceCurrent available balance
role, factorBilling tier and price factor
manageWhether the account has manager permission (can manage sub-accounts)
ownerWhether the account is a tenant owner
plan_follows_parentWhether plan and pricing follow the parent account
suspendedWhether the account is frozen for low balance
user_api_balanceMinimum balance required for manager permission
user_min_balanceFreeze threshold (calls are suspended below this balance)
support_qr_urlSupport 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:

FieldDescription
id, name, alias, email, billing_email, dnaAccount identity
level, tier, role, factorRouting group, tier, billing tier, and price factor
balanceAvailable balance
credit_usedCumulative credit used
credit_balanceArray of credit entries {amount, balance, reference, granted_at, expires_at}; each entry has its own expiry
daily_limit, hard_limit, soft_limitDaily credit, monthly credit (rejected when exceeded), monthly reference value (not used for admission)
rpm, rph, rpd, tpm, tph, tpdAccount-level request and token rate limits; 999999999999999999 means unlimited
user_limit, user_nMaximum and current number of sub-accounts
requestsCumulative request count
resourcesResource (path) allowlist; empty means unrestricted
allow_ips, allow_models, allow_levelsIP, model, and Level allowlists (omitted when empty)
model_limitsModel-level limits {model: {rpm, rph, rpd, tpm, tph, tpd}}
model_mapper, level_mapperAccount-level mappings
create_atCreation 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:

FieldDescription
RequestsRequest count
Prompt, Completion, ReasoningInput, output, and reasoning tokens
CreditUsedCredit used
Find, PageN, QueryNFile-search count, pages, search and tool-call count
ImageN, ImageCost, SizeHigh, SizeMedium, SizeLowImage count, cost, and size-tier distribution
CachedDetails, PromptDetails, CompletionDetailsCache and modality details
ModelUsageThe 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
ParameterAliasDescription
datedA single day; highest priority
starts, start_dateStart date
ende, end_dateEnd date, default today
daysnoneNumber 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):

FieldDescription
daily_costs[]Ascending by date: timestamp, date, line_items[] ({name, cost, usage}, split by model), the day's total_*, usage_analysis, token_summary
usage_summaryPer-model summary over the whole range; each value is {model_stats, usage_analysis, token_summary}
total_requests, total_credit_usedRequest and cost totals
total_prompt, total_completion, total_reasoningToken totals
total_find, total_page_n, total_query_nFile-search, page, search, and tool-call totals
total_image_n, total_size_high, total_size_medium, total_size_lowImage totals
total_cached_details, total_prompt_details, total_completion_detailsDetail totals (may be omitted)
token_summaryinput_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=30

Covers all descendant accounts below the current account, excluding the current account itself. Requires manager permission and incurs no management call fee itself.

ParameterDescription
date/d, start/s/start_date, end/e/end_date, daysSame as /dashboard/bill
user/uFilter 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:

FieldDescription
id, name, alias, emailAccount identity
top_cost_model, top_request_modelModel with the highest cost and the most requests
total_*, token_summaryThe account's totals
usage_analysis.request_percentage, usage_analysis.cost_percentageShare of all descendants' requests and cost (two decimals)

Operation log

GET /dashboard/logs?page=1&size=24

Requires manager permission.

ParameterDescription
pagePage number, starting at 1
sizeItems per page, 1 to 100, default 24
actionReturn 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": []}
FieldSource
sys_newsSystem announcements published by the service provider
user_newsPersonal notices addressed to the current account; cleared after being read once
dna_newsNotices 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"}
  ]
}
FieldDescription
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_agentThe User-Agent it was last seen with, cut to 256 bytes; empty when none was recorded
first_seen, last_seenThe dates it was first and last seen
notifyon: 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