Get Usage Summary
curl --request GET \
--url https://agentgate.mynewapi.com/api/v1/usage/summary \
--header 'Authorization: Bearer <token>'import requests
url = "https://agentgate.mynewapi.com/api/v1/usage/summary"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://agentgate.mynewapi.com/api/v1/usage/summary', 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://agentgate.mynewapi.com/api/v1/usage/summary",
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://agentgate.mynewapi.com/api/v1/usage/summary"
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://agentgate.mynewapi.com/api/v1/usage/summary")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://agentgate.mynewapi.com/api/v1/usage/summary")
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{
"success": true,
"data": {
"totalInputTokens": 123,
"totalOutputTokens": 123,
"totalCachedInputTokens": 123,
"totalCostUsd": 123,
"executionCount": 123,
"workOrderCount": 123,
"totalDurationMs": 123,
"byModel": {},
"periodStart": "<string>",
"periodEnd": "<string>"
}
}Usage
Get Usage Summary
Get aggregated usage summary with totals and per-model breakdown
GET
/
api
/
v1
/
usage
/
summary
Get Usage Summary
curl --request GET \
--url https://agentgate.mynewapi.com/api/v1/usage/summary \
--header 'Authorization: Bearer <token>'import requests
url = "https://agentgate.mynewapi.com/api/v1/usage/summary"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://agentgate.mynewapi.com/api/v1/usage/summary', 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://agentgate.mynewapi.com/api/v1/usage/summary",
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://agentgate.mynewapi.com/api/v1/usage/summary"
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://agentgate.mynewapi.com/api/v1/usage/summary")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://agentgate.mynewapi.com/api/v1/usage/summary")
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{
"success": true,
"data": {
"totalInputTokens": 123,
"totalOutputTokens": 123,
"totalCachedInputTokens": 123,
"totalCostUsd": 123,
"executionCount": 123,
"workOrderCount": 123,
"totalDurationMs": 123,
"byModel": {},
"periodStart": "<string>",
"periodEnd": "<string>"
}
}Get Usage Summary
Returns aggregated usage summary including totals and per-model breakdown.Request
string
Filter by work order ID
string
Filter by run ID
string
Filter by model name
string
Start date filter (ISO 8601)
string
End date filter (ISO 8601)
curl "https://agentgate.mynewapi.com/api/v1/usage/summary?startDate=2024-01-01&endDate=2024-01-31" \
-H "Authorization: Bearer YOUR_API_KEY"
Response
boolean
required
Indicates if the request was successful
object
required
Usage summary data
Show properties
Show properties
number
required
Total input tokens used
number
required
Total output tokens used
number
required
Total cached input tokens
number
required
Total estimated cost in USD
number
required
Total number of executions
number
required
Number of unique work orders
number
required
Total execution duration in milliseconds
object
required
Usage breakdown by model
string
required
Period start date (ISO 8601)
string
required
Period end date (ISO 8601)
Example Response
{
"success": true,
"data": {
"totalInputTokens": 1542000,
"totalOutputTokens": 325000,
"totalCachedInputTokens": 800000,
"totalCostUsd": 52.34,
"executionCount": 145,
"workOrderCount": 42,
"totalDurationMs": 4523000,
"byModel": {
"claude-sonnet-4-20250514": {
"inputTokens": 1200000,
"outputTokens": 250000,
"cachedInputTokens": 650000,
"costUsd": 38.50,
"executionCount": 120
},
"claude-opus-4-20250514": {
"inputTokens": 342000,
"outputTokens": 75000,
"cachedInputTokens": 150000,
"costUsd": 13.84,
"executionCount": 25
}
},
"periodStart": "2024-01-01T00:00:00.000Z",
"periodEnd": "2024-01-31T23:59:59.999Z"
}
}
Use Cases
- Generate monthly usage reports
- Compare costs across models
- Track usage trends over time
- Budget monitoring and alerts