GET /api/usage queries logs and billing records by an exact request_id match, within the user associated with your API key. One query can return multiple records; request IDs are not guaranteed to be unique.
This page follows the API contract dated October 13, 2026. Queries against actual business logs have not been verified. The overseas query node is
https://reqs.anyfast.ai.Quick example
cURL
/api/usage exactly; /api/usage/ returns 404.
Authentication
Bearer is case-insensitive. The API key must begin with lowercase sk-, have a nonempty value after the prefix, and contain no whitespace. Missing prefixes, SK-, a bare sk-, duplicate headers, or invalid tokens return 401.
Authentication precedes parameter validation. An invalid token with invalid parameters returns 401 first.
Queries always use the user associated with your API key. You cannot select another user through user_id, X-User-ID, or other headers. An explicit user_id query parameter returns 400. Records belonging to other users are excluded even if their request IDs match.
Query parameters
Parameter names are case-sensitive. A nonempty request ID retains its leading and trailing spaces for exact matching.
The endpoint returns
400 for a missing or whitespace-only request ID, unknown parameters, repeated parameters, explicit empty values, invalid integer formats or ranges, and invalid query-string encoding. Time ranges, model filters, custom sorting, page, and user_id are not supported.
Pagination and ordering
Start withoffset=0, then increase the offset by the number of records actually returned. Responses contain only the current page, without total, has_more, or a cursor.
Fewer than limit records indicate the last page for this query. Exactly limit records may be followed by an empty page. Every empty page returns 202, including offsets beyond the available records.
Records are ordered by creation time descending, request ID ascending, input tokens descending, output tokens descending, model name ascending, quota descending, af_usage ascending, and other ascending. Nulls in the last three fields sort last. Results are stable while data remains unchanged; identical records are not deduplicated.
Successful response
HTTP200. The following values are illustrative:
code (equal to the HTTP status), msg (a localized message), and data (an array). Empty or failed responses use [], never null. Branch on the status or code rather than message text.
Log fields
Missing, null, noninteger, negative, or out-of-int64-range cache counts return
null. Explicitly recorded zeros return 0. The response excludes raw usage receipts and the old create_time field.
Amounts, discounts, and funding sources
Amounts and discounts are strings computed precisely and rounded toward positive infinity. Zero amounts return"0.000000". Negative amounts follow the same rounding rule.
QUOTA_PER_UNIT=500000, DISPLAY_CURRENCY=USD, and DISPLAY_CURRENCY_RATE=1. The exchange rate represents display currency per USD and is not fetched live. Use the response’s currency; defaults are not a fixed API contract.
Discounts use factors recorded with the bill, rather than current user, group, or model settings. An effective user group factor takes precedence over the group factor, then is multiplied by the user model discount. When only one valid factor is recorded, a missing factor defaults to 1. If no historical factors exist or a selected factor is invalid, discount_rate and original_price are null. A null original quota makes spend and original_price null.
Original price uses the unrounded historical factor. A displayed discount of "0.3334" can come from an actual factor of 0.333333; do not recompute original price using the displayed discount. Unrecognized or damaged usage receipts make related derived fields unavailable. Do not interpret null as zero.
Funding sources appear in Voucher, Wallet, Credit, Subscription order, for example Voucher: USD 0.060000 / Wallet: USD 0.100000. Each amount is independently converted and rounded up to six places. Negative quota is displayed as zero; missing or invalid entries are omitted, while valid zeros remain. Chinese labels are 测试券, 钱包, 授信, 订阅. Currency codes and numeric formatting do not change with language.
Status codes
Empty page (HTTP 202)
Authentication failure (HTTP 401)
Service unavailable (HTTP 503)
401 includes WWW-Authenticate: Bearer. Unsupported methods on /api/usage return 405 with Allow: GET. Failures exclude underlying errors, credentials, and partial results. Malformed HTTP, disconnects, interrupted writes, and proxy-generated responses may not follow the business JSON format.
Language and response headers
Chinese, English, and regional variants are supported, selected byAccept-Language q weights. Missing, invalid, or unmatched values default to Simplified Chinese. Chinese variants such as zh-TW also return Simplified Chinese. For example, zh-CN;q=0.2,en;q=0.9 selects English.
Limits and troubleshooting
Authentication and log queries share a request timeout budget, defaulting to5s. Deployments can configure a positive timeout up to 1m. The application currently implements no rate limiting or 429 response; deployment gateways may impose limits.
The service currently provides no CORS response headers or OPTIONS preflight handling. Cross-origin browser requests with Authorization need deployment-level CORS support or a same-origin proxy.