Usage and quota
Run usage
One run’s tokens, spend and spend ceiling, with the attempts that produced them. Requires usage_read.
Accepts run_ followed by 32 hex characters or by a hyphenated UUID, in either case, and returns the hyphenated form.
GET
/
v1
/
usage
/
runs
/
{run_id}
Run usage
curl --request GET \
--url https://api.opentype.dev/v1/usage/runs/{run_id} \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.opentype.dev/v1/usage/runs/{run_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.opentype.dev/v1/usage/runs/{run_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"run_id": "<string>",
"organization_id": "<string>",
"state": "<string>",
"created_at": "<string>",
"tokens": {
"input_tokens": 1,
"output_tokens": 1,
"total_tokens": 1
},
"spend": {
"reserved_micros": 1,
"settled_micros": 1,
"unsettled_micros": 1
},
"ceiling_micros": 1,
"attempts": [
{
"run_id": "<string>",
"retry_ordinal": 1,
"provider": "<string>",
"model_id": "<string>",
"status": "<string>",
"tokens": {
"input_tokens": 1,
"output_tokens": 1,
"total_tokens": 1
},
"cost_micros": 1,
"created_at": "<string>",
"provider_request_id": "<string>"
}
]
}Authorizations
bearerbearer
An API key (otsk_ + 64 hex) or a console session token.
Path Parameters
run_ followed by 32 hex characters or by a hyphenated UUID.
Response
Usage for the run.
GET /v1/usage/runs/{run_id}.
Run usage
curl --request GET \
--url https://api.opentype.dev/v1/usage/runs/{run_id} \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.opentype.dev/v1/usage/runs/{run_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.opentype.dev/v1/usage/runs/{run_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"run_id": "<string>",
"organization_id": "<string>",
"state": "<string>",
"created_at": "<string>",
"tokens": {
"input_tokens": 1,
"output_tokens": 1,
"total_tokens": 1
},
"spend": {
"reserved_micros": 1,
"settled_micros": 1,
"unsettled_micros": 1
},
"ceiling_micros": 1,
"attempts": [
{
"run_id": "<string>",
"retry_ordinal": 1,
"provider": "<string>",
"model_id": "<string>",
"status": "<string>",
"tokens": {
"input_tokens": 1,
"output_tokens": 1,
"total_tokens": 1
},
"cost_micros": 1,
"created_at": "<string>",
"provider_request_id": "<string>"
}
]
}