API Reference
REST API
All endpoints are served from your Kalmia instance. Replace localhost:3000 with your deployed URL in production.
Proxy Endpoints
Forward LLM requests through Kalmia to automatically capture traces.
/api/v1/chat/completionsOpenAI-compatible proxy. Forwards to api.openai.com and captures a trace for each request.
/api/v1/messagesAnthropic-compatible proxy. Forwards to api.anthropic.com and captures a trace for each request.
Trace Endpoints
Ingest, list, and search traces.
/api/v1/traces/ingestIngest pre-built trace objects. Accepts a single trace or an array of traces.
/api/v1/tracesList captured traces. Supports ?project= and ?provider= query filters.
/api/traces/searchFull-text search across trace content. Returns matching traces with relevance scores.
Experiment Endpoints
Register experiments and fetch aggregated trace data.
/api/experimentsRegister a new experiment. Pass a name and an array of correlationIds to group traces.
/api/experimentsList all experiments in the current workspace.
/api/experiments/:batchIdFetch a single experiment with live trace data from Braintrust. Includes preprocessed metrics.
/api/experiments/:batchId/analysisRun AI-powered analysis on experiment traces. Returns insights about agent behavior.
Braintrust Trace Endpoints
Fetch traces directly from your Braintrust project.
/api/braintrust/tracesList recent traces from Braintrust. Supports pagination and project filters.
/api/braintrust/traces/:idFetch a single trace by ID with full span data.
Annotations & Behaviors
Create behavior definitions and annotate traces.
/api/behaviorsList all behavior definitions for the current workspace.
/api/behaviorsCreate a new behavior definition with a label and plain-language description.
/api/annotationsList annotations. Supports ?trace_id= and ?label= filters.
/api/annotationsCreate an annotation on a trace. Includes label, confidence, and optional notes.
/api/behaviors/detectRun AI-powered behavior detection on a set of traces. Auto-creates annotations on matches.
Example: Register an Experiment
curl -X POST https://your-kalmia.app/api/experiments \
-H "Content-Type: application/json" \
-d '{
"name": "RAG vs no-RAG",
"correlationIds": [
"run-abc-123",
"run-def-456"
]
}'{
"id": "exp-uuid-789",
"name": "RAG vs no-RAG",
"correlationIds": ["run-abc-123", "run-def-456"],
"createdAt": "2026-03-01T..."
}
