curl --request POST \
--url https://api.example.com/trace/usage \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"project_id": "<string>",
"filter": {
"op_names": [
"<string>"
],
"input_refs": [
"<string>"
],
"output_refs": [
"<string>"
],
"parent_ids": [
"<string>"
],
"trace_ids": [
"<string>"
],
"call_ids": [
"<string>"
],
"thread_ids": [
"<string>"
],
"turn_ids": [
"<string>"
],
"trace_roots_only": true,
"wb_user_ids": [
"<string>"
],
"wb_run_ids": [
"<string>"
]
},
"query": {
"$expr": {
"$and": [
{
"$literal": "<string>"
}
]
}
},
"include_costs": false,
"limit": 10000
}
'{
"call_usage": {}
}Compute per-call usage for a trace, with descendant rollup.
curl --request POST \
--url https://api.example.com/trace/usage \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"project_id": "<string>",
"filter": {
"op_names": [
"<string>"
],
"input_refs": [
"<string>"
],
"output_refs": [
"<string>"
],
"parent_ids": [
"<string>"
],
"trace_ids": [
"<string>"
],
"call_ids": [
"<string>"
],
"thread_ids": [
"<string>"
],
"turn_ids": [
"<string>"
],
"trace_roots_only": true,
"wb_user_ids": [
"<string>"
],
"wb_run_ids": [
"<string>"
]
},
"query": {
"$expr": {
"$and": [
{
"$literal": "<string>"
}
]
}
},
"include_costs": false,
"limit": 10000
}
'{
"call_usage": {}
}Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
Request to compute per-call usage for a trace, with descendant rollup.
This endpoint returns usage metrics for each call in the trace, where each call's metrics include the sum of its own usage plus all descendants' usage. Use this for trace view where you want to see rolled-up metrics per call.
Note: All matching calls are loaded into memory for aggregation. For very large result sets (>10k calls), consider using more specific filters or pagination at the application layer.
Filter to select calls. Typically use trace_ids to get all calls in a trace.
Show child attributes
Additional query conditions for filtering calls.
Show child attributes
If true, include cost calculations in the usage.
Maximum number of calls to process. Acts as a safety limit to prevent unbounded memory usage.
Successful Response
Response with per-call usage metrics (each includes descendant contributions).
Show child attributes
Was this page helpful?