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
Filter by work order ID
Filter by run ID
Filter by model name
Start date filter (ISO 8601)
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
Indicates if the request was successful
Usage summary data
Show properties
Show properties
Total input tokens used
Total output tokens used
Total cached input tokens
Total estimated cost in USD
Total number of executions
Number of unique work orders
Total execution duration in milliseconds
Usage breakdown by model
Period start date (ISO 8601)
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
⌘I