Usage and quota
Daily usage
One row per UTC day: runs created that day, their tokens and their spend. Requires usage_read.
Rows run from the start date through the day of the last instant before end_at, oldest first. Days without activity are present at zero. The window spans at most 92 days; omit both bounds for the current UTC calendar month.
GET
/
v1
/
usage
/
daily
Daily usage
curl --request GET \
--url https://api.opentype.dev/v1/usage/daily \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.opentype.dev/v1/usage/daily', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.opentype.dev/v1/usage/daily"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"organization_id": "<string>",
"window": {
"start_at": "<string>",
"end_at": "<string>"
},
"days": [
{
"date": "<string>",
"runs": 1,
"input_tokens": 1,
"output_tokens": 1,
"spend_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. At most 92 days after start_at.
Daily usage
curl --request GET \
--url https://api.opentype.dev/v1/usage/daily \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.opentype.dev/v1/usage/daily', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.opentype.dev/v1/usage/daily"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"organization_id": "<string>",
"window": {
"start_at": "<string>",
"end_at": "<string>"
},
"days": [
{
"date": "<string>",
"runs": 1,
"input_tokens": 1,
"output_tokens": 1,
"spend_micros": 1
}
]
}