Skip to main content
GET
Export AI gateway usage (FinOps)
Exports aggregated spend for a period as CSV, grouped by the dimension your finance process needs. group_by is a strict allowlist and a tag key is bound as a query parameter, so there is no injection surface. Every row carries unpriced_requests alongside cost_usd, so a pricing gap is visible in the export rather than hidden inside a total. A model that is not in the pricebook is recorded with cost_source = 'unpriced' — never booked as free.
Cells are quoted and formula-neutralized. Every cell is quoted, and any cell beginning =, +, - or @ is prefixed with a single quote, so a model name or a tag cannot execute as a formula when someone opens the file in a spreadsheet. If you parse this file, parse it as real CSV — do not split on commas.
For the same data as JSON, use Usage & cost. Requires the read capability on ai_gateway. See the control-plane overview for authentication, the {data, meta} envelope, pagination and error types.

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

group_by
string
default:model

Grouping dimension: user, team, agent, model, provider, or tag:<key>.

period
enum<string>
default:30d

The rollup window. Defaults to 30 days.

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

Scope the export to a single agent.

format
enum<string>
default:json

Response format. csv streams a downloadable attachment.

Available options:
json,
csv

Response

The usage export (JSON envelope, or a CSV attachment when format=csv).

data
object

FinOps showback/chargeback rollup, aggregated by the requested dimension.

meta
object

Metadata included with every API response.