Log a Trace
POST /v1/{project_id}/traces
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | Yes | The prompt or input sent to the model |
output | string | Yes | The model’s response |
model | string | No | Model identifier (e.g. gpt-4o, claude-sonnet-4-20250514) |
latency_ms | float | No | End-to-end latency in milliseconds |
tags | list[string] | No | Arbitrary tags for filtering |
token_usage | object | No | Token counts: prompt_tokens, completion_tokens, total_tokens |
metadata | object | No | Arbitrary key-value metadata |
custom_attributes | object | No | Custom structured attributes for filtering and grouping |
version | string | No | Prompt or model version string |
session_id | string | No | Group related traces into a session |
spans | list | No | Sub-operation spans with name, start/end timestamps, and attributes |
cost | float | No | Total cost in USD for this call |
tool_calls | list | No | Tool/function calls made during the trace |
status | string | No | "success" or "error" (default: "success") |
error | string | No | Error message if status is "error" |
Response
List Traces
GET /v1/{project_id}/analytics/traces
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
limit | int | 100 | Max traces to return (1-1000) |
status | string | — | Filter by "success" or "error" |
start_date | string | — | ISO 8601 datetime lower bound |
end_date | string | — | ISO 8601 datetime upper bound |
Response
Get Trace Details
GET /v1/{project_id}/analytics/traces/{trace_id}