GET
/organization/usage/completionsCompletions
Get completions usage details for the organization.
start_timeintegerrequired
Start time (Unix seconds) of the query time range, inclusive.
end_timeintegeroptional
End time (Unix seconds) of the query time range, exclusive.
bucket_widthstringoptional
Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`.
project_idsarray<string>optional
Return only usage for these projects.
user_idsarray<string>optional
Return only usage for these users.
api_key_idsarray<string>optional
Return only usage for these API keys.
modelsarray<string>optional
Return only usage for these models.
batchbooleanoptional
If `true`, return batch jobs only. If `false`, return non-batch jobs only. By default, return both.
group_byarray<string>optional
Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `model`, `batch`, `service_tier`, `api_source` or any combination of them. When grouped by `api_source`, results use `agents_api` for attributed Agents API activity and `unlabeled` for all other activity. Without source grouping, `api_source` is null.
limitintegeroptional
Specifies the number of buckets to return.
- `bucket_width=1d`: default: 7, max: 31
- `bucket_width=1h`: default: 24, max: 168
- `bucket_width=1m`: default: 60, max: 1440
pagestringoptional
A cursor for use in pagination. Corresponding to the `next_page` field from the previous response.
200Usage data retrieved successfully.
objectstringrequired
dataarray<object>required
has_morebooleanrequired
next_pagestringrequired
400The request parameters are invalid or the requested operation cannot be performed.
errorobjectrequired
403The caller does not have permission to perform this operation.
errorobjectrequired
Details about the permission error.
429The request was rejected because a rate limit was exceeded.
errorobjectrequired
Error handling
A 400 is returned: The request parameters are invalid or the requested operation cannot be performed. A 403 is returned: The caller does not have permission to perform this operation. A 429 is returned: The request was rejected because a rate limit was exceeded.