Fetch a cost record
const url = 'https://example.com/v1/cost/records/example?include=rawUsage';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://example.com/v1/cost/records/example?include=rawUsage' \ --header 'Authorization: Bearer <token>'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”CostRecordId — opaque string identifier chosen by the binding.
Query Parameters
Section titled “Query Parameters”Extra fields, comma-separated. rawUsage: each model call’s usage object exactly as the vendor reported it.
Responses
Section titled “Responses”Cost record.
object
Free-form resource category (llm.inference, tool.invocation, storage.write, sandbox.exec, …). Maps to resourceKind in the runtime.
Metered unit (tokens, seconds, bytes, …).
Kind-specific counters (e.g. { promptTokens, completionTokens }).
object
Free-form filter/display tags — never counters.
object
A model call’s id (category llm.inference); its provenance model-call node carries it too.
The root of the record’s run tree (a flow run, for its agent turns).
The flow of the run tree’s root.
The step that made the call.
The turn’s step number.
What the call was for, beyond the turn’s own model step: guardrail-judge:<guardrail id>.
The model actually called.
The exact model version the vendor reported (vendors alias).
The router picked a fallback provider for the turn.
ok: the provider answered. failed: the call threw.
The call’s tokens. promptTokens / completionTokens are the totals; cacheReadTokens / cacheWriteTokens are parts of promptTokens, reasoningTokens of completionTokens, present when the provider reports them.
object
The vendor’s id for the request.
HTTP attempts the call took, the client’s retries included.
Why a model call failed (status: failed).
object
The vendor’s own usage object, exactly as it reported it. Only with include=rawUsage.
object
object
Example
{ "status": "ok"}Missing / malformed / expired / revoked bearer token.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}No cost record with that id under this tenant.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}