Query thread stats
GET with body payload — no resources created. Returns aggregate statistics for threads in a tracing project.
The response includes the thread counts, run counts, latency percentiles, rates, token totals, and cost totals requested in select.
Self-hosted deployments require LangSmith v0.17 or later.
Body
project_id is the tracing project UUID.
"0190a1b2-c3d4-7ef0-a5b6-6ea3a82e9328"
select lists the aggregate statistics to compute and return. At least one value is required.
1THREAD_COUNT, TRACE_COUNT, TOTAL_TOKENS, TOTAL_COST, ERROR_RATE, STREAMING_RATE, LATENCY_P50, LATENCY_P99, MEDIAN_TOKENS, FIRST_TOKEN_P50, FIRST_TOKEN_P99, PROMPT_TOKENS, COMPLETION_TOKENS, PROMPT_COST, COMPLETION_COST, PROMPT_TOKEN_DETAILS, COMPLETION_TOKEN_DETAILS, PROMPT_COST_DETAILS, COMPLETION_COST_DETAILS, THREAD_FEEDBACK_STATS max_start_time is the exclusive upper bound on thread activity (RFC3339 date-time). Defaults to now (UTC) when omitted.
min_start_time is the inclusive lower bound on thread activity (RFC3339 date-time). Defaults to 1 day before now (UTC) when omitted.
thread_filter narrows eligible threads using a LangSmith filter expression evaluated against the complete thread summary.
"gte(turn_count, 3)"
trace_filter narrows eligible threads to those containing a trace whose root run matches this LangSmith filter expression.
"eq(status, \"error\")"
tree_filter narrows eligible threads to those containing a matching run anywhere in a trace tree.
"has(tags, \"production\")"
Response
aggregate thread statistics
completion_cost is the completion cost across matching traces in USD.
completion_cost_details contains completion-cost totals by category.
completion_token_details contains completion-token totals by category.
completion_tokens is the sum of completion tokens across matching traces.
error_rate is the fraction of matching traces that contain an error.
first_token_p50_seconds is the approximate median time to first token in seconds. Populated when FIRST_TOKEN_P50 is selected.
first_token_p99_seconds is the approximate p99 time to first token in seconds. Populated when FIRST_TOKEN_P99 is selected.
latency_p50_seconds is the approximate median trace latency in seconds. Populated when LATENCY_P50 is selected.
latency_p99_seconds is the approximate p99 trace latency in seconds. Populated when LATENCY_P99 is selected.
median_tokens is the approximate median of total tokens across matching traces. Populated when MEDIAN_TOKENS is selected.
prompt_cost is the prompt cost across matching traces in USD.
prompt_cost_details contains prompt-cost totals by category.
prompt_token_details contains prompt-token totals by category.
prompt_tokens is the sum of prompt tokens across matching traces.
streaming_rate is the fraction of completed matching traces that streamed tokens.
thread_count is the number of distinct threads matching the query. Populated when THREAD_COUNT is selected.
thread_feedback_stats contains aggregate thread-level feedback statistics keyed by feedback key. Populated when THREAD_FEEDBACK_STATS is selected.
total_cost is the total cost across matching traces in USD.
total_tokens is the sum of all tokens across matching traces.
trace_count is the number of traces in the matching threads. Populated when TRACE_COUNT is selected.

