Token and request usage in time buckets (ascending)
curl --request GET \
--url https://api.antarah.dev/v1/organization/usage/completions \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.antarah.dev/v1/organization/usage/completions"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.antarah.dev/v1/organization/usage/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.antarah.dev/v1/organization/usage/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.antarah.dev/v1/organization/usage/completions"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.antarah.dev/v1/organization/usage/completions")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.antarah.dev/v1/organization/usage/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"object": "page",
"data": [
{
"object": "bucket",
"start_time": 1793750400,
"end_time": 1793750400,
"results": [
{
"object": "organization.usage.completions.result",
"input_tokens": 123,
"input_cached_tokens": 123,
"input_uncached_tokens": 123,
"output_tokens": 123,
"num_model_requests": 123,
"project_id": "<string>",
"api_key_id": "<string>",
"model": "<string>"
}
]
}
],
"has_more": true,
"next_page": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>",
"code": "<string>",
"request_id": "<string>",
"param": "<string>",
"errors": [
{
"pointer": "<string>",
"detail": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>",
"code": "<string>",
"request_id": "<string>",
"param": "<string>",
"errors": [
{
"pointer": "<string>",
"detail": "<string>"
}
]
}Token and request usage in time buckets (ascending)
GET
/
v1
/
organization
/
usage
/
completions
Token and request usage in time buckets (ascending)
curl --request GET \
--url https://api.antarah.dev/v1/organization/usage/completions \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.antarah.dev/v1/organization/usage/completions"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.antarah.dev/v1/organization/usage/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.antarah.dev/v1/organization/usage/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.antarah.dev/v1/organization/usage/completions"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.antarah.dev/v1/organization/usage/completions")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.antarah.dev/v1/organization/usage/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"object": "page",
"data": [
{
"object": "bucket",
"start_time": 1793750400,
"end_time": 1793750400,
"results": [
{
"object": "organization.usage.completions.result",
"input_tokens": 123,
"input_cached_tokens": 123,
"input_uncached_tokens": 123,
"output_tokens": 123,
"num_model_requests": 123,
"project_id": "<string>",
"api_key_id": "<string>",
"model": "<string>"
}
]
}
],
"has_more": true,
"next_page": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>",
"code": "<string>",
"request_id": "<string>",
"param": "<string>",
"errors": [
{
"pointer": "<string>",
"detail": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>",
"code": "<string>",
"request_id": "<string>",
"param": "<string>",
"errors": [
{
"pointer": "<string>",
"detail": "<string>"
}
]
}Authorizations
adminKeysession
ak_admin_… Admin API key
Query Parameters
Unix seconds; the first bucket starts at or before it
Required range:
0 <= x <= 253402300799Unix seconds, exclusive. Default: now
Required range:
0 <= x <= 253402300799next_page from the previous response
Required string length:
1 - 2001m buckets: the range is at most 24 h
Available options:
1m, 1h, 1d Buckets per page
Required range:
1 <= x <= 1440