The Spans Summary endpoint returns aggregated statistics for spans matching the given filters. This is useful for getting quick insights into your LLM usage without fetching all individual spans.
Both GET and POST methods are supported. POST is recommended when using complex filters.
Query parameters
Same parameters as the List spans endpoint:
start_time string: The start time for filtering spans in ISO 8601 format. If not provided, defaults to 1 hour ago.
Example
end_time string: The end time for filtering spans in ISO 8601 format. If not provided, defaults to current time.
Example
-
all_envs string: Whether to include spans from all environments. is_test parameter will override this parameter.
Options: true, false.
-
is_test string: Whether to include test spans only. This parameter will override the all_envs parameter.
Options: true, false.
Body parameters
You can add filter parameters to the request body (same as List spans endpoint):
filters object: The filters to be applied to the spans.
If you want to filter your custom properties, add metadata__ + your custom property name. For example, to filter my_custom_property, use metadata__my_custom_property.
For a complete list of filter operators and examples, see the Filters API Reference.
Example
URL-based Filtering
Just like the List spans endpoint, you can use URL parameters for quick filtering:
See the List spans endpoint for complete URL filtering documentation.
Response
All fields are returned at the top level (consistent with experiments API format):
Total cost in USD for all filtered spans.
Total tokens (prompt + completion) for all filtered spans.
Total number of requests matching the filters.
Aggregated score summaries grouped by evaluator_id. Each evaluator includes:
UUID of the evaluator
URL-friendly identifier for the evaluator
Display name of the evaluator
Type of score: "numerical", "percentage", or "boolean"
Average score for numerical/percentage evaluators. null for boolean evaluators.
Count of true values for boolean evaluators. null for numerical/percentage evaluators.
Count of false values for boolean evaluators. null for numerical/percentage evaluators.
Score Type Behavior:
- Numerical/Percentage evaluators: Only
avg_score is populated
- Boolean evaluators: Only
true_count and false_count are populated
- Other types: String, categorical, and JSON evaluators are not included in aggregations
Use Cases
Monitor monthly costs
Compare model costs
Track customer usage