Monthly usage summary
curl --request GET \
--url https://api.getmetacognition.com/usage/summaryimport requests
url = "https://api.getmetacognition.com/usage/summary"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.getmetacognition.com/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://api.getmetacognition.com/usage/summary",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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.getmetacognition.com/usage/summary"
req, _ := http.NewRequest("GET", url, nil)
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.getmetacognition.com/usage/summary")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getmetacognition.com/usage/summary")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"period": "<string>",
"start": "<string>",
"end": "<string>",
"tokens_in": 123,
"tokens_out": 123
}Usage
Monthly usage summary
Read monthly token rollups in UTC.
GET
/
usage
/
summary
Monthly usage summary
curl --request GET \
--url https://api.getmetacognition.com/usage/summaryimport requests
url = "https://api.getmetacognition.com/usage/summary"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.getmetacognition.com/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://api.getmetacognition.com/usage/summary",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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.getmetacognition.com/usage/summary"
req, _ := http.NewRequest("GET", url, nil)
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.getmetacognition.com/usage/summary")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getmetacognition.com/usage/summary")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"period": "<string>",
"start": "<string>",
"end": "<string>",
"tokens_in": 123,
"tokens_out": 123
}Returns a calendar-month usage rollup in UTC. If you omit
Response —
month, the endpoint returns the current month.
Headers
Authorization: Bearer <access_token>
Query
string
"YYYY-MM". Omit for the current month.Response — 200
string
Always
"month".string
First moment of the month in UTC.
string
First moment of the next month in UTC.
integer
Total ingress tokens for the month.
integer
Total egress tokens for the month.
Example
# Current month
curl -H "Authorization: Bearer $JWT" \
https://api.getmetacognition.com/usage/summary
# Specific month
curl -H "Authorization: Bearer $JWT" \
"https://api.getmetacognition.com/usage/summary?month=2026-04"
import httpx
resp = httpx.get(
"https://api.getmetacognition.com/usage/summary",
headers={"Authorization": f"Bearer {jwt}"},
params={"month": "2026-04"},
)
print(resp.json())
Response
{
"period": "month",
"start": "2026-05-01T00:00:00+00:00",
"end": "2026-06-01T00:00:00+00:00",
"tokens_in": 12,
"tokens_out": 27
}
Charting tip
Pull six months in parallel for a rolling chart:import asyncio, httpx
from datetime import date
months = [(date(2026, m, 1)).strftime("%Y-%m") for m in range(1, 7)]
async def fetch(client, m):
r = await client.get("/usage/summary", params={"month": m})
return m, r.json()
async def main():
async with httpx.AsyncClient(
base_url="https://api.getmetacognition.com",
headers={"Authorization": f"Bearer {jwt}"},
) as c:
return dict(await asyncio.gather(*(fetch(c, m) for m in months)))
print(asyncio.run(main()))

