API Reference
Traces
Logged LLM calls with span-level timing and metadata. Read-only — traces are seeded, not created via the API.
GET
/api/tracesList all traces, newest first.
{
"traces": [
{
"id": "trace_002",
"name": "rag.retrieve_and_generate",
"model": "claude-haiku-4-5",
"prompt": "Can I upgrade my plan mid-cycle?",
"completion": "Yes, upgrades take effect immediately and are prorated for the remainder of the billing cycle.",
"status": "success",
"inputTokens": 261,
"outputTokens": 134,
"latencyMs": 2970,
"costUsd": 0.0033,
"timestamp": "2026-07-15T22:22:00.000Z",
"metadata": { "environment": "production", "userId": "user_4821", "route": "/api/chat" },
"spans": [
{ "id": "span_004", "name": "retrieve_context", "startOffsetMs": 0, "durationMs": 55 },
{ "id": "span_005", "name": "llm_generate", "startOffsetMs": 60, "durationMs": 2891 },
{ "id": "span_006", "name": "postprocess", "startOffsetMs": 2955, "durationMs": 18 }
]
}
]
}GET
/api/traces/:traceIdGet a single trace with the same shape as one item in the list above.
curl https://preview.devx-ai.xyz/api/traces/trace_002404 if traceId doesn't match any trace.
Data model
| Field | Type | Notes |
|---|---|---|
| status | "success" | "error" | ~8% of seeded traces are errors |
| costUsd | number | Derived from input/output tokens at a per-model rate |
| spans | TraceSpan[] | startOffsetMs + durationMs; renders as a timeline in the UI |
| metadata | Record<string, string> | Free-form key/value, typically environment/userId/route |