/ai/token/usage_hourly


GET https://api.sitehost.nz/1.5/ai/token/usage_hourly.json

Returns a token's usage for each hour of one NZ calendar date. Only hours with usage are included. hour is the NZ local hour and bucket is the start of the hour in UTC. On the day daylight saving starts there are 23 hours, and on the day it ends there are 25, with the repeated hour appearing twice with different bucket values. Costs are in NZD (excl. GST).

Query Parameters

ParameterTypeRequiredDescription
client_idintegerYesThe ID for the client.Example: 1
key_idstringYesThe ID of the token.Example: 3f6c2a9e-8b14-4d7a-9c5e-1a2b3c4d5e6f
datestringYesThe date to return. Format is 'YYYY-MM-DD'. Cannot be in the future.Example: 2026-09-27

Code Samples

JavaScript PHP Rails Python
var xmlHttp = new XMLHttpRequest();
xmlHttp.open("GET", "https://api.sitehost.nz/1.5/ai/token/usage_hourly.json?apikey=your_key_here&client_id=1&key_id=3f6c2a9e-8b14-4d7a-9c5e-1a2b3c4d5e6f&date=2026-09-27", false);

xmlHttp.send();

var response = xmlHttp.responseText;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.sitehost.nz/1.5/ai/token/usage_hourly.json?apikey=your_key_here&client_id=1&key_id=3f6c2a9e-8b14-4d7a-9c5e-1a2b3c4d5e6f&date=2026-09-27");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
require 'net/http'
require 'uri'

uri = URI.parse("https://api.sitehost.nz/1.5/ai/token/usage_hourly.json?apikey=your_key_here&client_id=1&key_id=3f6c2a9e-8b14-4d7a-9c5e-1a2b3c4d5e6f&date=2026-09-27")
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Get.new(uri.request_uri)

response = http.request(request)
import requests

uri = 'https://api.sitehost.nz/1.5/ai/token/usage_hourly.json?apikey=your_key_here&client_id=1&key_id=3f6c2a9e-8b14-4d7a-9c5e-1a2b3c4d5e6f&date=2026-09-27'

response = requests.get(uri)

Response

200:

application/json
{
    "return": {
        "date": "2026-09-27",
        "totals": {
            "requests": 140,
            "prompt_tokens": 280000,
            "completion_tokens": 50000,
            "cached_tokens": 70000,
            "estimated_cost_nzd": 0.225,
            "failed_requests": 2
        },
        "hours": [
            {
                "hour": 9,
                "bucket": "2026-09-26T20:00:00Z",
                "requests": 60,
                "prompt_tokens": 120000,
                "completion_tokens": 20000,
                "cached_tokens": 30000,
                "estimated_cost_nzd": 0.093,
                "failed_requests": 0,
                "complete": true,
                "models": {
                    "Qwen/Qwen3.6-27B": 0.093
                }
            },
            {
                "hour": 16,
                "bucket": "2026-09-27T03:00:00Z",
                "requests": 80,
                "prompt_tokens": 160000,
                "completion_tokens": 30000,
                "cached_tokens": 40000,
                "estimated_cost_nzd": 0.132,
                "failed_requests": 2,
                "complete": false,
                "models": {
                    "Qwen/Qwen3.6-27B": 0.132
                }
            }
        ]
    },
    "msg": "Successful",
    "status": true
}