ACCOUNT API

Account & usage API

Bring your balance, request records, and costs into your own systems for balance monitoring, record syncing, and cost reporting.

Use separate APIs for model calls and account data

Applications and agents use model APIs to generate content. Monitoring and reporting use the Account API to read data. The endpoints and keys serve different purposes and are not interchangeable.

Model inference API
router-api.xiu.ai
Use a model API key and an exact model ID to send text, image, or video requests through a protocol the model supports. Find the required base URL and request path in the model details and setup guide.
Account & usage API
api.xiu.ai
Use a separate Account API key to read its XiuAI account’s balance, request records, and cost summaries. These endpoints cannot generate content, add funds, or change the account.

Connect to your team’s existing workflows

Monitor your balance

Read your current balance and total spend. Show them in an internal dashboard and set up alerts using your own rules.

GET/open/v1/balance

Sync request records

Filter requests by time, model, or API key. Sync usage, cost, and status for each request for review and reconciliation.

GET/open/v1/requests

Report on costs

Get usage and cost totals for a time range, grouped by model and API key, to include in your existing reports.

GET/open/v1/requests/summary

Connect both APIs to an application or agent

  1. Run the task

    Configure the model API key on your application server or a trusted client. Clients such as Codex and Claude Code still use model APIs. Do not put the Account API endpoint in the model base URL setting.

  2. Read account reports

    Keep the Account API key on your server. Read balances and usage records as needed, then pass the required data to internal dashboards or reports. Follow the documentation for filters and pagination.

  3. Enforce data access

    usage:read can read usage across the entire account. Filters such as keyName do not isolate projects or customers. When exposing reports or agent tools, enforce authorization on your server and return only the data the caller may access.

Get a key yourself in the console

  1. Sign in

    Sign in with your XiuAI account and open the Account API page.

  2. Issue a key

    Name it, select balance or usage access, and set an expiration if needed.

  3. Save it on your server

    The full key is shown only once. Copy it into a server environment variable or secret manager.

  4. Adjust anytime

    Rename it, change its permissions, or revoke it when no longer needed. Changes take effect immediately.

A separate, read-only key with scoped access

The Account & usage API uses a separate Account API key that can only read data for its XiuAI account. Model API keys continue to be used for model requests and are managed separately. Sign in to the console to issue, edit, and revoke keys yourself.

Balance access
Read the current balance and total spend.
Usage access
Read request records and usage and cost summaries.