API DocsManagement APIUsage

Pull Usage Records

🔐 PAT required (User permission)

Paginated consume usage records for the authenticated account. Data comes from consume-type usage logs and is intended for metering and reconciliation. This endpoint does not push data — callers pull on demand.

Base URL

  • https://api.autorouter.top — Production

Authentication

This endpoint requires a system access token (PAT) + Auto-Api-User. sk-xxx API Keys are not supported.

HeaderDescription
AuthorizationSystem access token. Format: Bearer {system_access_token}. Generate it in Personal Center → Profile → Access Token. The Bearer prefix is optional.
Auto-Api-UserCurrent logged-in user ID. Must match the user that owns the token. Copy it from Personal Center → Profile → User ID.

After authentication, the response includes consume records for the entire account. Use token_name to narrow results to a specific token.

Endpoints

GET /api/usage/records

Pull usage records

🔐 PAT required (User permission)

Query Parameters

NameTypeRequiredDescription
start_timestampintegerNoStart time (Unix seconds, created_at >=). 0 or omitted means no lower bound
end_timestampintegerNoEnd time (Unix seconds, created_at <=). 0 or omitted means no upper bound
model_namestringNoFilter by model name (contains match)
token_namestringNoFilter by token name (exact match)
request_idstringNoFilter by request ID (exact match)
pintegerNoPage number starting at 1, default 1
page_sizeintegerNoPage size, default 10, max 100

Only consume-type records are returned; you do not pass a type parameter.

Responses

200: Success

Content-Type: application/json

401: Missing access token, or missing Auto-Api-User

An invalid access token still returns HTTP 200, with success set to false.

Response Fields

Top level
FieldTypeDescription
successbooleanWhether the request succeeded
messagestringError message; empty string on success
dataobjectPaginated payload
data pagination
FieldTypeDescription
pageintegerCurrent page
page_sizeintegerPage size
totalintegerTotal matching records
itemsarrayUsage record list
data.items[] usage record
FieldTypeDescription
created_atintegerSettlement write time (Unix seconds)
model_namestringModel name
token_namestringToken name
token_idintegerToken ID
request_idstringRequest ID
amountnumberFinal amount due for this request in USD. For the same request_id, total consume amount minus total refund amount. Surcharge deltas are included and are not returned as separate rows. Full refunds are 0.
billing_statusstringcharged: amount is still due and counts toward reconciliation. refunded: the charge was fully returned, amount is 0, and it does not count as usage
prompt_tokensintegerPrompt tokens (0 when not applicable)
completion_tokensintegerCompletion tokens (0 when not applicable)
resolutionstringVideo output resolution (e.g. 480p / 720p / 1080p / 4k). Empty when not video or not recorded
duration_secondsnumberVideo duration in seconds. Omitted when absent
is_taskbooleanWhether this was an async generation task
task_idstringTask ID. Omitted when absent

Notes

  • One settled consume record corresponds to one billable usage event. Aggregate hourly/daily by created_at and resolution on the caller side if needed.
  • resolution depends on billing-path instrumentation; some models or pricing modes may leave it empty — treat empty as unknown.
  • Reconcile by summing amount only where billing_status is charged. refunded means the charge was fully returned.
  • The time window filters the original consume time. Later refunds or surcharges still change that row's amount.

Request Examples

curl -X GET "https://api.autorouter.top/api/usage/records?start_timestamp=1717200000&end_timestamp=1717286400&page_size=50&p=1" \
  -H "Authorization: Bearer YOUR_SYSTEM_ACCESS_TOKEN" \
  -H "Auto-Api-User: YOUR_USER_ID"

Response Examples

{
  "success": true,
  "message": "",
  "data": {
    "page": 1,
    "page_size": 50,
    "total": 2,
    "items": [
      {
        "created_at": 1717234567,
        "model_name": "seedance-1.5-pro",
        "token_name": "prod-key",
        "token_id": 42,
        "request_id": "req_abc123",
        "amount": 0.3,
        "billing_status": "charged",
        "prompt_tokens": 0,
        "completion_tokens": 0,
        "resolution": "1080p",
        "duration_seconds": 5,
        "is_task": true,
        "task_id": "task_xyz"
      },
      {
        "created_at": 1717234000,
        "model_name": "gpt-4o",
        "token_name": "prod-key",
        "token_id": 42,
        "request_id": "req_def456",
        "amount": 0.0064,
        "billing_status": "charged",
        "prompt_tokens": 120,
        "completion_tokens": 80,
        "resolution": "",
        "is_task": false
      }
    ]
  }
}

On this page