LLM Cost & Behavior Tracing
Every LLM call across the platform is traced — model, tokens, prompt, answer and USD cost — and surfaced in an admin dashboard, so AI spend and behavior are never a black box.
- Category
- ai_rag
- Tech stack
- FastAPI, Python, Claude API, OpenAI API
- Metrics
- 100% of LLM calls traced, Per-call USD cost attribution
- Role
- Design + build
Content
A tracing layer wraps every model call in Alex OS (Claude and OpenAI) and writes a structured record per call: model, token counts, prompt, response and computed USD cost. Traces are rendered in a dedicated LLM tab on the admin analytics page, making it possible to audit any AI feature end-to-end and spot cost regressions immediately.
Problem
AI features quietly accumulate API costs and it is hard to answer "what did that answer cost, and what prompt produced it?" after the fact.
Outcome
Complete per-call audit trail of AI usage and spend across the whole platform.