Read the usage by key, model or member
const url = 'https://gpu-kitchen.example.lan/api/v1/usage?group_by=key';const options = {method: 'GET', headers: {cookie: 'gpuk_session=<gpuk_session>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://gpu-kitchen.example.lan/api/v1/usage?group_by=key' \ --cookie gpuk_session=<gpuk_session>Totals over whole UTC days, from and to included; by default the current month to today. Every route counts, local and external models alike. A year of days is kept.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”First UTC day, YYYY-MM-DD.
Last UTC day, YYYY-MM-DD.
Responses
Section titled “Responses”Success.
object
Most tokens first.
object
The key id, the model name or the member id. Null: keys owned by no member.
The key’s label, or the member’s name (enterprise) when grouped by member.
Input and output tokens, estimates included.
Example
{ "group_by": "key"}Error codes: usage_range_invalid, validation_error.
object
object
Stable snake_case code to branch on.
A sentence to show a person.
Optional structured context.
Optional place where the problem is fixed.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": "example", "fix": "example" }}Error codes: auth_required.
object
object
Stable snake_case code to branch on.
A sentence to show a person.
Optional structured context.
Optional place where the problem is fixed.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": "example", "fix": "example" }}Error codes: forbidden.
object
object
Stable snake_case code to branch on.
A sentence to show a person.
Optional structured context.
Optional place where the problem is fixed.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": "example", "fix": "example" }}Error codes: rate_limited.
object
object
Stable snake_case code to branch on.
A sentence to show a person.
Optional structured context.
Optional place where the problem is fixed.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": "example", "fix": "example" }}