Token-Cost Attribution From Traces: Per-Feature LLM Spend Without a Rewrite
This article proposes a method for detailed cost attribution of Large Language Model (LLM) usage within applications. It suggests augmenting existing tracing data with custom attributes like 'app.feature' and 'app.tenant_id' to identify which specific features or customers are driving LLM expenses. The approach leverages OpenTelemetry conventions and advocates for calculating costs at the time of the LLM call rather than relying solely on provider billing dashboards, enabling more granular financial insights without requiring extensive code rewrites. AI
IMPACT Enables granular tracking of LLM spend by feature and tenant, improving cost management and resource allocation for AI applications.