Skip to content

API: metering

Status: GA Access: token required API contract: 0.3.0 · capability 2026-09-03.1 View as Markdown Open in Claude Open in ChatGPT

Costs By Article

Open as a page →

Per-article cost for a contract: direct spend + amortized collect share.

direct = sum over the article’s own runs (generate/publish, where generated_article_id is set). amortized_collect = the contract’s contract-level cost (its collect runs, where generated_article_id IS NULL) divided by the number of articles in the window — (owner decision: amortize by period, not per collect-run, since collect feeds the reused RAG corpus). imagegen is a deliberately separate ledger and NOT added.

Auth: Authorization: Bearer <token> required

ParameterInRequiredTypeDescription
salescontracts_idqueryyesinteger
fromquerynostring | null
toquerynostring | null

Responses:

CodeMeaningBody
200Successful Responsearray of ArticleCostRow
401Missing or invalid authentication credentialsErrorResponse
422Validation ErrorHTTPValidationError

Costs By Contract

Open as a page →

Per-contract cost rollup (sum over each salescontracts_id).

Auth: Authorization: Bearer <token> required

ParameterInRequiredTypeDescription
ai_company_idquerynointeger | null
fromquerynostring | null
toquerynostring | null

Responses:

CodeMeaningBody
200Successful Responsearray of ContractCostRow
401Missing or invalid authentication credentialsErrorResponse
422Validation ErrorHTTPValidationError

GET /api/v1/metering/costs/by-pipeline-run

Section titled “GET /api/v1/metering/costs/by-pipeline-run”

Costs By Pipeline Run

Open as a page →

Per-run cost rows, newest first.

Auth: Authorization: Bearer <token> required

ParameterInRequiredTypeDescription
ai_company_idquerynointeger | null
fromquerynostring | null
toquerynostring | null
limitquerynointeger
offsetquerynointeger

Responses:

CodeMeaningBody
200Successful Responsearray of RunCostRow
401Missing or invalid authentication credentialsErrorResponse
422Validation ErrorHTTPValidationError

Costs Summary

Open as a page →

Cost + tokens + brave aggregated by day / contract / model / provider.

Auth: Authorization: Bearer <token> required

ParameterInRequiredTypeDescription
group_byqueryno"day" | "contract" | "model" | "provider"
ai_company_idquerynointeger | null
fromquerynostring | null
toquerynostring | null

Responses:

CodeMeaningBody
200Successful Responsearray of CostSummaryRow
401Missing or invalid authentication credentialsErrorResponse
422Validation ErrorHTTPValidationError