Skip to content

Get Usage by Model

GET /api/open/v1/usage/models
ParameterInTypeRequiredDefaultDescription
start_timestampqueryintegerNoSee belowStart time (inclusive), unix seconds
end_timestampqueryintegerNoSee belowEnd time (inclusive), unix seconds
limitqueryintegerNo10Number of models to return, from 1 to 100; values outside this range return 400

Time range rules:

  • Both omitted: the last 30 days.
  • Only start_timestamp: 30 days forward, capped at the current time.
  • Only end_timestamp: 30 days backward.
  • The range can be at most 366 days.
Terminal window
curl "https://www.routeapi.ai/api/open/v1/usage/models?start_timestamp=1726400000&end_timestamp=1729000000&limit=10" \
-H "Authorization: Bearer $ROUTEAPI_MANAGEMENT_KEY"
{
"success": true,
"message": "",
"data": {
"items": [
{
"model_name": "gpt-4o",
"prompt_tokens": 120000,
"completion_tokens": 30000,
"total_tokens": 150000,
"amount": 3.20
}
],
"start_timestamp": 1726400000,
"end_timestamp": 1729000000
}
}
FieldTypeDescription
items[].model_namestringModel name
items[].prompt_tokensintegerTotal input tokens for the model in the range
items[].completion_tokensintegerTotal output tokens for the model in the range
items[].total_tokensintegerInput plus output tokens
items[].amountnumberAmount consumed by the model in the site currency, two decimals
start_timestampintegerEffective start time
end_timestampintegerEffective end time
HTTPcodeScenario
400invalid_requestlimit is not an integer between 1 and 100, a timestamp is negative, or the time range is invalid
429—Per-user query rate limit exceeded (default 30/minute); the body may be empty

For other common error codes, see Platform API errors.

  • Results are sorted by total_tokens descending; ties are ordered by model name ascending, so the order is stable.
  • Only consumption (billing) logs are counted; failed requests are excluded.
  • Token counts are raw counts, not millions.
  • Amounts use the site display currency; see Get balance.
  • Each row’s amount is rounded independently, so the sum of rows may differ from a total by up to 0.01.
  • This endpoint shares the per-user query rate limit (default 30/minute) with Usage, Account logs, Export logs, and Usage by Key. See Rate limits.