sk- API key itself.
Query usage logs
Page number, starting from
1.Number of records per page.
Filter by log type.
Filter by API key name.
Filter by model name.
Filter by group.
Filter by request ID.
Start time as a Unix timestamp.
End time as a Unix timestamp.
Query usage summary
quota, rpm, and tpm. For reconciliation, rely on console usage logs and balance changes.
Query current API key usage
sk- API key. It is not the signed-in user’s all-API-key list endpoint.
By default, the data field returns the current API key quota status:
total_granted, total_used, and total_available reflect the site’s current quota display units. The response does not include a unit or symbol. expires_at is a Unix-second timestamp; 0 means no expiry is set.
Query current API key usage for a time range
start_timestamp and end_timestamp for a time-range summary. Use it for scripts that only have an API key and do not have a signed-in session or management access credential. It summarizes only the current API key’s own quota consumption and does not return log details.
Start time as a Unix-second timestamp. The range includes this second. Send it together with
end_timestamp; do not send millisecond timestamps.End time as a Unix-second timestamp. The range includes this second. Send it together with
start_timestamp; end_timestamp must be greater than or equal to start_timestamp.data includes range_used:
range_used uses the same site quota display setting and is rounded to 6 decimal places. Ranges with no usage return a successful response with range_used: 0. Other query parameters are ignored. Disabled or expired API keys cannot query this endpoint; exhausted API keys can still query their own historical summary.
Troubleshooting
- If a record is missing, check the time range and page number first.
- Cross-filter by API key name, model, group, and time window.
- If an automation script only has an API key, use
/api/usage/tokenfor the current API key summary and addstart_timestamp/end_timestampfor time-range usage. - Costs and token counts follow the console usage logs.