Track cost per feature
Use metadata and customer identifiers to build per-feature and per-user cost breakdowns.
Use metadata and customer identifiers to build per-feature and per-user cost breakdowns.
“How much does our summarization feature cost?” “Which users are the most expensive?” These questions are hard to answer when all your LLM calls look the same in billing.
This cookbook shows how to tag requests with metadata so you can break down costs by feature, user, team, or any dimension you care about.
Add metadata and customer_identifier to every LLM call:
Be consistent across your codebase. Here’s a practical schema:
Centralize your metadata tagging so it’s consistent:
Once your requests are tagged, go to the Dashboard:
metadata.feature to see cost per feature over timeFor per-user cost control, set budgets on individual customers:
When a user exceeds their budget, Respan blocks further requests and returns a 429 status. See User budgets for details.