Skip to main content
GET
/
v2
/
threads
/
{thread_id}
/
stats
Error
A valid request URL is required to generate request examples
{
  "completion_cost": 123,
  "completion_cost_details": {
    "raw": {}
  },
  "completion_token_details": {
    "raw": {}
  },
  "completion_tokens": 123,
  "first_start_time": "2023-11-07T05:31:56Z",
  "last_end_time": "2023-11-07T05:31:56Z",
  "last_start_time": "2023-11-07T05:31:56Z",
  "latency_p50_seconds": 123,
  "latency_p99_seconds": 123,
  "prompt_cost": 123,
  "prompt_cost_details": {
    "raw": {}
  },
  "prompt_token_details": {
    "raw": {}
  },
  "prompt_tokens": 123,
  "total_cost": 123,
  "total_tokens": 123,
  "turns": 123
}

Documentation Index

Fetch the complete documentation index at: https://docs.langchain.com/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

X-API-Key
string
header
required
X-Tenant-Id
string
header
required

Path Parameters

thread_id
string
required

Thread ID

Query Parameters

selects
enum<string>[]

selects lists which aggregate stats to compute and return (repeatable query parameter). At least one value is required. Accepts any value of SingleThreadStatsSelectField.

Available options:
TURNS,
FIRST_START_TIME,
LAST_START_TIME,
LAST_END_TIME,
LATENCY_P50,
LATENCY_P99,
PROMPT_TOKENS,
PROMPT_COST,
COMPLETION_TOKENS,
COMPLETION_COST,
TOTAL_TOKENS,
TOTAL_COST,
PROMPT_TOKEN_DETAILS,
COMPLETION_TOKEN_DETAILS,
PROMPT_COST_DETAILS,
COMPLETION_COST_DETAILS
session_id
string<uuid>
required

session_id is the tracing project (session) UUID (required).

Response

aggregate stats for the thread

completion_cost
number

completion_cost is the sum of per-trace completion costs across the thread, in USD. Populated when COMPLETION_COST is selected.

completion_cost_details
object

completion_cost_details is the per-sub-category sum of completion cost details across the thread. Populated when COMPLETION_COST_DETAILS is selected.

completion_token_details
object

completion_token_details is the per-sub-category sum of completion token details across the thread. Populated when COMPLETION_TOKEN_DETAILS is selected.

completion_tokens
integer

completion_tokens is the sum of per-trace completion token counts across the thread. Populated when COMPLETION_TOKENS is selected.

first_start_time
string<date-time>

first_start_time is the earliest trace start time in the thread (RFC3339). Populated when FIRST_START_TIME is selected.

last_end_time
string<date-time>

last_end_time is the latest trace end time in the thread (RFC3339). Populated when LAST_END_TIME is selected.

last_start_time
string<date-time>

last_start_time is the latest trace start time in the thread (RFC3339). Populated when LAST_START_TIME is selected.

latency_p50_seconds
number

latency_p50_seconds is the approximate p50 of trace latency across the thread, in seconds. Populated when LATENCY_P50 is selected.

latency_p99_seconds
number

latency_p99_seconds is the approximate p99 of trace latency across the thread, in seconds. Populated when LATENCY_P99 is selected.

prompt_cost
number

prompt_cost is the sum of per-trace prompt costs across the thread, in USD. Populated when PROMPT_COST is selected.

prompt_cost_details
object

prompt_cost_details is the per-sub-category sum of prompt cost details across the thread. Populated when PROMPT_COST_DETAILS is selected.

prompt_token_details
object

prompt_token_details is the per-sub-category sum of prompt token details across the thread. Populated when PROMPT_TOKEN_DETAILS is selected.

prompt_tokens
integer

prompt_tokens is the sum of per-trace prompt token counts across the thread. Populated when PROMPT_TOKENS is selected.

total_cost
number

total_cost is the sum of per-trace total costs across the thread, in USD. Populated when TOTAL_COST is selected.

total_tokens
integer

total_tokens is the sum of per-trace total token counts across the thread. Populated when TOTAL_TOKENS is selected.

turns
integer

turns is the number of distinct traces (turns) in the thread. Populated when TURNS is selected.