Skip to main content
GET
Get AI gateway usage

Usage & cost

Returns aggregated AI Gateway usage — request counts, input/output token counts, and estimated USD cost — broken down by provider and model, with tenant-wide totals. See the control-plane overview for authentication and the response envelope — the examples below authenticate with $TOKEN, a short-lived OAuth 2.1 access token minted there.

Get usage

Requires the read capability on ai_gateway. Query parameters
Response
Fields
cost_usd is an estimate derived from KnoxCall’s model price table. When unpriced_requests is non-zero, the true cost for those requests is higher than the reported cost_usd.

Authorizations

Authorization
string
header
required

OAuth 2.1 authentication — recommended for new integrations. Access tokens (kc_ prefix) are minted at the root-host token endpoint https://api.knoxcall.com/oauth/token and passed as Authorization: Bearer <access_token>. Public clients must use PKCE with the authorization_code grant; confidential clients may use client_credentials. The first-party SDKs and the knoxcall login CLI handle token minting, caching, refresh, and DPoP for you.

Query Parameters

period
enum<string>
default:30d

The rollup window. Defaults to 30 days.

Available options:
7d,
30d,
90d
agent_id
string<uuid>

Scope the rollup to a single agent.

Response

The usage rollup.

data
object

Cost and token rollup by model over the requested period.

meta
object

Metadata included with every API response.