Usage and quota
Usage rollup
Run counts, tokens and spend for your organization over a window. Requires usage_read.
The window is half-open, [start_at, end_at), and counts runs created inside it. Omit both bounds for the current UTC calendar month.
GET
/
v1
/
usage
Usage rollup
curl --request GET \
--url https://api.opentype.dev/v1/usage \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.opentype.dev/v1/usage', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.opentype.dev/v1/usage"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"organization_id": "<string>",
"window": {
"start_at": "<string>",
"end_at": "<string>"
},
"runs": {
"total": 1,
"completed": 1,
"failed": 1,
"in_flight": 1
},
"tokens": {
"input_tokens": 1,
"output_tokens": 1,
"total_tokens": 1
},
"spend": {
"reserved_micros": 1,
"settled_micros": 1,
"unsettled_micros": 1
}
}Authorizations
bearerbearer
An API key (otsk_ + 64 hex) or a console session token.
Query Parameters
Window start, exactly YYYY-MM-DDTHH:MM:SSZ (UTC), inclusive. Send it with end_at; omit both for the current UTC calendar month.
Window end, exactly YYYY-MM-DDTHH:MM:SSZ (UTC), exclusive. Send it with start_at.
Usage rollup
curl --request GET \
--url https://api.opentype.dev/v1/usage \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.opentype.dev/v1/usage', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.opentype.dev/v1/usage"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"organization_id": "<string>",
"window": {
"start_at": "<string>",
"end_at": "<string>"
},
"runs": {
"total": 1,
"completed": 1,
"failed": 1,
"in_flight": 1
},
"tokens": {
"input_tokens": 1,
"output_tokens": 1,
"total_tokens": 1
},
"spend": {
"reserved_micros": 1,
"settled_micros": 1,
"unsettled_micros": 1
}
}