Our LLM bill was $18,000 a month, and the honest answer to "what's driving it" was a shrug. The OpenAI dashboard showed total spend by model, which told us GPT-5 was expensive — something we already knew. It didn't tell us which of our 40+ endpoints was actually responsible. One HTTP header, added once, changed that entirely.

TL;DR

1. Provider dashboards can't attribute cost to your app's internal structure — they have no visibility into what a "feature" means to you.
2. A single metadata tag, added to every request at the proxy layer, is enough to unlock cost-by-feature breakdowns retroactively.
3. Once attribution is in place, cost almost always concentrates more than expected — 2-3 features usually account for the majority of spend.

The Before and After

BEFORE: One Number

"Our LLM bill is $18,000/month." No breakdown by feature, no way to know if that's normal, growing, or concentrated in one place. Every conversation about cost starts and ends with the same unhelpful total.

AFTER: A Ranked List

"Our LLM bill is $18,000/month. $7,400 is the AI-generated summary feature. $4,200 of that is running GPT-5 on a task a cheaper model handles identically." Now there's a specific, actionable target.

The Tag Itself

The mechanism is deliberately simple: attach an identifier to each request that names which part of your app triggered it, at the point the request passes through your proxy.

# Before — no way to distinguish this call from any other
response = client.chat.completions.create(
    model="gpt-5",
    messages=[...],
)

# After — tagged with the feature that triggered it
response = client.chat.completions.create(
    model="gpt-5",
    messages=[...],
    extra_headers={"X-Preto-Feature": "document-summarization"},
)

That's the entire technical change. No new infrastructure, no separate logging pipeline — the tag rides along on a request you're already making, and the proxy layer aggregates by it afterward. The cost of adding this is close to zero; the cost of not having it is every future cost conversation defaulting back to a single undifferentiated number.

Want to see this on your own traffic?

Add one header to your API calls. See costs by feature in about 5 minutes.

See Your Cost Per Feature — Free

Add one header to your API calls. See costs by feature in 5 minutes.

What This Reveals, Almost Every Time

The specific dollar figures vary by team, but the shape of what feature-level attribution surfaces is strikingly consistent: cost concentrates far more than intuition suggests. Two or three features typically account for 60-80% of total spend, and at least one of those top features is usually running on a model more capable — and expensive — than its actual task complexity requires. This is the same pattern behind the single most common LLM cost-waste source, and feature-level tagging is the prerequisite for finding it, because "which specific feature is overpowered" is not answerable from a total-spend number alone.

In our case, the $4,200/month figure came from exactly that pattern: a document-summarization feature running GPT-5 on inputs that a mid-tier model handled with no measurable quality difference on our own eval set. The waste had been there the entire time — the tag didn't create it, it just made it visible enough to fix.

Why Retroactive Attribution Doesn't Work

It's tempting to think this data could be reconstructed later from application logs — correlate timestamps, guess at which endpoint was active, stitch together a rough picture after the fact. In practice this is fragile: it depends on logging discipline staying consistent across every code path that ever calls an LLM, and as a codebase grows past a handful of endpoints, that consistency erodes. A new engineer adds a new feature without knowing the logging convention exists; a refactor moves a call site and the log line doesn't follow. Tagging at the infrastructure layer — once, at the proxy — removes that dependency on everyone remembering to do it right, everywhere, forever.

Beyond the First Tag

Once feature-level tagging is in place, the same pattern extends naturally: tag by team if multiple teams share a workspace, tag by user if per-user cost matters for your pricing model, tag by environment (staging vs. production) if that distinction matters for your budget. None of these require new infrastructure — they're all the same header pattern, applied to a different dimension of "what caused this request."

Frequently Asked Questions

What is feature-level cost attribution for LLM spend?
Tagging every LLM request with an identifier for which part of your app triggered it, so cost can be aggregated and compared by that dimension after the fact, rather than showing up only as one undifferentiated total.
Why can't I get this from my provider's dashboard directly?
Provider dashboards typically offer only coarse fields like "user" or "project" — they have no visibility into your application's internal structure and can't attribute cost to a feature unless you tell them, which requires tagging at the point the request is made.
How much overhead does adding a metadata tag add?
Effectively none. It's a single additional header on a request you're already making — no extra round trip, no meaningful latency. The cost is entirely in remembering to set it consistently.
What usually gets found once feature-level attribution is turned on?
Cost almost always concentrates more than expected — 2-3 features typically account for 60-80% of total spend, and at least one of those is usually running a more expensive model than its task requires.

Add the tag. See the breakdown.

One header, added at the proxy layer, turns "our LLM bill is $18K" into a ranked list of exactly what's driving it.

See Your Cost Per Feature — Free

Free forever up to 10K requests. No credit card required.

Gaurav Dagade
Gaurav Dagade

Founder of Preto.ai. 11 years engineering leadership. Previously Engineering Manager at Bynry. Building the cost intelligence layer for AI infrastructure.

LinkedIn · Twitter