Skip to content

client.cost.records

View as Markdown

client.cost.records — the cost.records operations.

On AsyncKindgi every method is the same, awaited.

list(
*,
limit: int | None = None,
cursor: str | None = None,
run_id: str | UUID | None = None,
agent_id: str | UUID | None = None,
conversation_id: str | UUID | None = None,
category: str | None = None,
provider_id: str | UUID | None = None,
model: str | None = None,
served_model: str | None = None,
root_run_id: str | UUID | None = None,
flow_id: str | UUID | None = None,
include_descendants: bool | None = None,
from_: str | None = None,
to: str | None = None,
scope_kind: Literal['tenant', 'org', 'project'] | None = None,
scope_id: str | UUID | None = None,
inherit: bool | None = None,
include: Literal['rawUsage'] | None = None,
timeout: float | None = None,
) -> CostRecordCollectionPage
Signature

List cost records. GET /v1/cost/records

Cursor-paginated. Filters (all AND): runId (with includeDescendants, its whole subtree), rootRunId, flowId, agentId, conversationId, category, providerId, model, servedModel, from, to. Sort order is fixed: occurredAt desc, id desc. Records represent one accounted resource event each — a model call (category llm.inference: one record per call, with its model, usage and what the vendor said about it), tool invocation, storage write, sandbox execution, etc. include=rawUsage adds each model call's usage as the vendor reported it.

get(
record_id: str | UUID,
/,
*,
include: Literal['rawUsage'] | None = None,
timeout: float | None = None,
) -> CostRecord
Signature

Fetch a cost record. GET /v1/cost/records/{recordId}