Self-hosted Langfuse tracing every model call my AI pipelines make — tokens, cost, latency, prompt and output — on the same small VM as the apps it watches.
The problem
AI pipelines were a black box: no way to see what each model call cost, how long it took, or why an output came back wrong.
Architecture
Langfuse web and worker, with ClickHouse for traces, a Redis queue and MinIO storage
Shared Postgres for settings and users
OpenTelemetry SDK in the app, one trace per job
Behind Caddy with automatic HTTPS, sign-up locked
A pricing table so cost appears per call
Results
Every model call traced with tokens, cost and latency
Under half a cent per daily research run
Idle memory brought down to about 1.2 GB
Lost traces recovered by replaying stored raw batches