--- title: "Summarize account usage and costs" description: "Summarize XiuAI request counts, tokens, and costs by model and API key for a selected time window." image: "https://docs.xiu.ai/og.png" --- > XiuAI documentation index > Full documentation index: https://docs.xiu.ai/en/llms.txt > Check the index for current pages before reading. # Summarize account usage and costs Read request counts, token totals, and costs for a time window, grouped by model and API key name. Requires `usage:read`; [get a key in the console](/en/open-api/#get-a-key) first if needed. ```http GET /open/v1/requests/summary ``` ## Summary parameters All parameters are optional URL query parameters. | Parameter | Type | Description | | --- | --- | --- | | `startTime` | integer | Inclusive start time in Unix seconds; defaults to 24 hours before `endTime` | | `endTime` | integer | Inclusive end time in Unix seconds; defaults to the current time | | `model` | string | Exact model name | | `keyName` | string | Exact API key name | | `outcome` | string | `succeeded`, `interrupted`, or `failed` | The maximum window is 31 days. Both times must be positive, and the start cannot be later than the end. Split longer periods into smaller windows and add their totals. Since both boundaries are inclusive, start each subsequent window one second after the previous end to avoid counting boundary records twice. ```bash curl --fail-with-body --silent --show-error \ --connect-timeout 5 --max-time 15 --get \ https://api.xiu.ai/open/v1/requests/summary \ -H "Authorization: Bearer $XIU_OPEN_API_KEY" \ --data-urlencode "startTime=1794355200" \ --data-urlencode "endTime=1794441599" ``` ## Summary fields ```json { "startTime": 1794355200, "endTime": 1794441599, "requests": 1520, "succeeded": 1490, "interrupted": 6, "failed": 24, "promptTokens": 2840000, "completionTokens": 612000, "cost": "12.481250", "currency": "USD", "groups": [ { "model": "gpt-5", "keyName": "production", "requests": 1520, "succeeded": 1490, "interrupted": 6, "failed": 24, "promptTokens": 2840000, "completionTokens": 612000, "cost": "12.481250" } ] } ``` | Field | Type | Description | | --- | --- | --- | | `startTime`, `endTime` | integer | Actual time bounds, including resolved defaults, in Unix seconds | | `requests` | integer | Total requests, equal to `succeeded + interrupted + failed` | | `succeeded`, `interrupted`, `failed` | integer | Counts by outcome, with the same meanings as request records | | `promptTokens`, `completionTokens` | integer | Total input and output tokens, excluding failed requests | | `cost` | string | Exact total cost with six decimal places | | `currency` | string | Currency, currently `USD` | | `groups` | array | Groups sorted by `model`, then `keyName` | Each group contains the string fields `model` and `keyName`, followed by its own `requests`, `succeeded`, `interrupted`, `failed`, `promptTokens`, `completionTokens`, and `cost`, with the same types as above. To report by model or key alone, add the corresponding groups. A period without requests returns zero totals and an empty `groups` array. For reconciliation, use identical time bounds and filters for records and summaries. After reading every page, the decimal sum of individual `cost` values equals the summary `cost`. The `requestId` filter is available only for individual records, not summaries. For the individual records behind a total, use [List request records](/en/open-api/requests/). See [errors and rate limits](/en/open-api/errors/) for retry guidance. Source: https://docs.xiu.ai/en/open-api/summary/index.mdx