Python (SDK)
import latitudesh_python_sdk
from latitudesh_python_sdk import Latitudesh
from latitudesh_python_sdk.utils import parse_datetime
import os
with Latitudesh(
bearer=os.getenv("LATITUDESH_BEARER", ""),
) as latitudesh:
res = latitudesh.inference.get_inference_usage(project_id="proj_AoW6vRnwkvLn0", from_=parse_datetime("2026-10-01T00:00:00Z"), to=parse_datetime("2026-10-02T00:00:00Z"), granularity=latitudesh_python_sdk.Granularity.SIXH)
# Handle response
print(res)curl --request GET \
--url https://api.latitude.sh/inference/usage \
--header 'Authorization: <api-key>'const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.latitude.sh/inference/usage', 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.latitude.sh/inference/usage",
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: <api-key>"
],
]);
$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.latitude.sh/inference/usage"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<api-key>")
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.latitude.sh/inference/usage")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.latitude.sh/inference/usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"total_estimated_cost": "0.0312",
"total_requests": 412,
"total_tokens": 186240,
"by_model": [
{
"model": "qwen3-30b-a3b-fp8",
"requests": 412,
"input_tokens": 142080,
"output_tokens": 44160,
"estimated_cost": "0.0312"
}
],
"series": [
{
"timestamp": "2026-10-01T00:00:00Z",
"models": {
"qwen3-30b-a3b-fp8": {
"requests": 250,
"estimated_cost": "0.0189"
}
}
},
{
"timestamp": "2026-10-01T06:00:00Z",
"models": {
"qwen3-30b-a3b-fp8": {
"requests": 162,
"estimated_cost": "0.0123"
}
}
}
]
}{
"errors": [
{
"code": "<string>",
"status": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}{
"errors": [
{
"code": "<string>",
"status": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}{
"errors": [
{
"code": "<string>",
"status": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}{
"errors": [
{
"code": "<string>",
"status": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}Inference
Get inference usage for a project
Returns the project’s inference requests, tokens and estimated cost for the window, per model and as a time series. The estimate uses current model prices.
GET
/
inference
/
usage
Python (SDK)
import latitudesh_python_sdk
from latitudesh_python_sdk import Latitudesh
from latitudesh_python_sdk.utils import parse_datetime
import os
with Latitudesh(
bearer=os.getenv("LATITUDESH_BEARER", ""),
) as latitudesh:
res = latitudesh.inference.get_inference_usage(project_id="proj_AoW6vRnwkvLn0", from_=parse_datetime("2026-10-01T00:00:00Z"), to=parse_datetime("2026-10-02T00:00:00Z"), granularity=latitudesh_python_sdk.Granularity.SIXH)
# Handle response
print(res)curl --request GET \
--url https://api.latitude.sh/inference/usage \
--header 'Authorization: <api-key>'const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.latitude.sh/inference/usage', 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.latitude.sh/inference/usage",
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: <api-key>"
],
]);
$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.latitude.sh/inference/usage"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<api-key>")
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.latitude.sh/inference/usage")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.latitude.sh/inference/usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"total_estimated_cost": "0.0312",
"total_requests": 412,
"total_tokens": 186240,
"by_model": [
{
"model": "qwen3-30b-a3b-fp8",
"requests": 412,
"input_tokens": 142080,
"output_tokens": 44160,
"estimated_cost": "0.0312"
}
],
"series": [
{
"timestamp": "2026-10-01T00:00:00Z",
"models": {
"qwen3-30b-a3b-fp8": {
"requests": 250,
"estimated_cost": "0.0189"
}
}
},
{
"timestamp": "2026-10-01T06:00:00Z",
"models": {
"qwen3-30b-a3b-fp8": {
"requests": 162,
"estimated_cost": "0.0123"
}
}
}
]
}{
"errors": [
{
"code": "<string>",
"status": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}{
"errors": [
{
"code": "<string>",
"status": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}{
"errors": [
{
"code": "<string>",
"status": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}{
"errors": [
{
"code": "<string>",
"status": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}Authorizations
Query Parameters
Project ID or Slug
Start of the window (inclusive), truncated to whole seconds
End of the window (exclusive), truncated to whole seconds; at most 31 days after from
Size of each series bucket
Available options:
1h, 6h, 24h Was this page helpful?