Attributing AI Cost to Applications

Multi-Router attributes the AI spend of the applications a company builds to each application, feature and customer, down to the model, vendor and region, with budgets that stop a runaway job before the bill does.

Rahul Singh, Founder, Multi-Router 6 min read

Companies now build AI into their own software: a support bot that drafts replies, product search, a pipeline that reads contracts and invoices, an agent that triages tickets, a nightly job that summarizes the day's activity, a CI step that reviews every pull request. Each of these is code the company wrote that calls model APIs in production, separate from the AI tools its employees use, such as Claude Code. To run these applications as a business, a company needs their spend attributed by application, environment, feature and customer, as well as by model, vendor and region. That attribution gives the cost of serving each customer and each feature, the numbers to price an AI feature on, and the warning when a runaway job starts spending before the invoice arrives.

Attributing Spend With Multi-Router

Each application connects to Multi-Router through its own endpoint and its own credential, so every request is attributed to the application that sent it. The support bot, the contract pipeline and the CI reviewer are separate lines of spend from the first request, and a production and a staging deployment of the same application can be separate lines too.

Each request is priced the moment it completes, from the exact model, vendor, variant and region that served it, at the price in effect at that time. Input, output, cache read and cache write tokens are each priced at their own rate, so the cost matches what the vendor charges, and the savings from prompt caching show up per application.

Inside an application, each request can also say what it was for:

Label Sent as Example
FeatureThe X-MR-Feature-Id headersupport/triage, support/reply
CustomerThe user field on Chat Completions, or metadata.user_id on Messagestenant_acme
SessionThe X-MR-Session-Id headerOne conversation or one job run
CorrelationThe X-MR-Correlation-Id headerA ticket or request id from the company's own logs

With these labels, spend breaks down from the application to the feature, to the customer, down to a single conversation, and any request ties back to the company's own logs.

Support · org_3Nw7Rk5TzB

Overview · Traffic

CustomizeSave view
Time:
1h24h7d30d
CustomFilters
Search any id (request/correlation/session)…
Export
Requests
41,826
Success rate
99.7%
5xx errors
38
Tokens
1.62B
Latency · p95
6,840ms
Latency · p99
9,120ms
Cost
$1,108.40
Customers
214
Requests · Count / time41,826
Outcome · 5xx / time38
Latency · p95 / time6,840ms
Cost · Total / time$1,108.40
Requests
Page 125 / page
Columns
TimeRequest IDRouterAliasModelCustomerFeatureIn/OutCostStatus
14:32:11.902req_2Vd6Lp8NsRrt_5Kp8Xv2QmDsupport-botanthropic/claude-haiku-4.5tenant_globexsupport/triage8,420/214$0.0035200
14:32:09.640req_9Bt3Hw5KyErt_5Kp8Xv2QmDsupport-botanthropic/claude-sonnet-5tenant_initechsupport/reply31,250/1,406$0.03200
14:32:07.418req_7Gm4Qx9WcTrt_5Kp8Xv2QmDsupport-botanthropic/claude-sonnet-5tenant_acmesupport/triage46,000/980$0.03200
req_7Gm4Qx9WcT200anthropic/claude-sonnet-5bedrock
Full Request Payload →
Latency
4,182ms
Cost
$0.03
Tokens
46,000 → 980
TTFT
1,104ms
Attempts
1
Router overhead
1.4 ms
Request
Request ID
req_7Gm4Qx9WcT
Timestamp
2026-11-16 14:32:07.418
Organization
org_3Nw7Rk5TzB
API key
support-bot-prod (tok_8Dw3Hn6LqV)
Correlation ID
ticket-48213
Customer
tenant_acme
Feature
support/triage
Session
sess_8Hq2Vn5RkW
Peer IP
203.0.113.58
Routing
Alias
support-bot
Router ID
rt_5Kp8Xv2QmD
Model requested
anthropic/claude-sonnet-5
Model served
anthropic/claude-sonnet-5
Vendor
bedrock
Variant
geo
Region
us-east-1
Wire id
us.anthropic.claude-sonnet-5
Prompt binding
Prompt ID
—
File path
—
Revision
—
Latency
Total
4182ms
TTFT
1104ms
Request upload
0.2 ms
Router overhead
1.4 ms
Upstream
4180ms
Router response
0.3 ms
Tokens
Prompt
46,000
42,800 cached
1,240 cache-write
1,240 at 5 minutes
Completion
980
Request bytes
184,326
Response bytes
6,912
Cost
Total
$0.03
Input
$0.0043
Output
$0.01
Cache read
$0.0094
Cache write
$0.0034
$0.0034 at 5 minutes
Provider response
Request upload
0.2 ms
Router · overhead
1.4 ms
Upstream200
4,180.0 ms
Router · response
0.3 ms
Total 4,181.8 ms
14:32:04.077req_4Rc8Mj2FaZrt_5Kp8Xv2QmDsupport-botanthropic/claude-haiku-4.5tenant_acmesupport/triage6,180/342$0.0037200
14:31:58.315req_6Yn1Ts7GbPrt_5Kp8Xv2QmDsupport-botanthropic/claude-sonnet-5tenant_globexsupport/reply0/0$0429
A request from the support bot in Traffic: its feature, customer, session and correlation id, the model, vendor and region that served it, and its cost by token type.

Workload Identity, No Keys

Production services and CI jobs can call Multi-Router with the identity their platform already gives them, in place of a stored API key: a Kubernetes service account on Amazon EKS, Google GKE or Azure AKS, or a GitHub Actions, GitLab or CircleCI job. There is no key to leak or rotate, and Traffic records the exact workload behind each request, such as the payments/api service account or the billing repository's production deploy, so spend is attributed to the service or pipeline that made the call. LLM API Keys in CI and Production Workloads Considered Harmful covers workload identity in detail.

req_3Vk8Np2HsQ200anthropic/claude-sonnet-5anthropic
Full Request Payload →
Latency
6,148ms
Cost
$0.02
Tokens
6,200 → 900
TTFT
1,302ms
Attempts
1
Router overhead
1.2 ms
Request
Request ID
req_3Vk8Np2HsQ
Timestamp
2026-11-12 09:14:52.087
Organization
org_3Fh8Wq2LdK
API key
—
Identity type
CI
Machine issuer
mii_6Gd2Tz8QwM
Machine subject
repo:example-co/billing:environment:production
Machine binding
mib_K4vB9mZp3L
Correlation ID
—
Customer
—
Session
—
Peer IP
198.51.100.37
Routing
Alias
—
Router ID
rt_8Mc5Jx3VbN
Model requested
—
Model served
anthropic/claude-sonnet-5
Vendor
anthropic
Variant
standard
Region
global
Wire id
claude-sonnet-5
Prompt binding
Prompt ID
—
File path
—
Revision
—
A request from the billing repository's production deployment in Traffic: no API key, with the verified issuer, subject and binding.

Cost Per Customer and Per Feature

Traffic turns those labels into the numbers a product team needs. It filters, charts and breaks down spend by feature and by customer, the Customers view ranks customers by usage and cost, and stats such as cost per request and cost per 1,000 tokens can be added to any view. Spend per feature or per customer also breaks down by model and vendor, so a team sees which model drives the cost of each feature and what moving it to another model would save. For example, support/triage might cost $1,840 this month, with $1,210 on Claude Sonnet 5 and $630 on Claude Haiku 4.5. A label prefix groups related features, so all of support/ can be compared feature by feature.

That gives a company its unit economics: the cost of serving each customer, the cost of each AI feature, the margin on each plan, and the customer or feature behind a jump in spend. Saved views keep the reports a team opens every month, Traffic exports to CSV, and the Traffic API returns the same requests, stats and series for the company's own billing system or data warehouse.

Support · org_3Nv8Qe5RtB

Customers · cost by feature · Traffic

CustomizeSave view
Time:
1h24h7d30d
CustomFilters
Search any id (request/correlation/session)…
Export
Customer · Distinct
5
Customer · Busiest
tenant_acme
Requests · Count
349K
Cost · Total
$4169.18
Latency · total · p95
2,486.3 ms
Cost · Total · by Featuretop 3
Cost · Total · by Customertop 5
Cost · Total · by Customer· 1d buckets
LineSmoothAreaBar
PointsBreak down byCustomer
1s10s1m5m15m1h1d
$0$20.00$40.00$60.00$80.00$100.0010/23202610/2710/3111/411/811/1211/16
Time:2026-11-17 12:00amtenant_acme:$85.43tenant_globex:$51.33tenant_initech:$24.33tenant_umbrella:$17.58tenant_hooli:$8.64
Requests
Page 125 / page
Columns
TimeRequest IDRouterModelCustomerFeatureCostLatencyStatus
14:32:11.482req_Lw4Tn8Vb2ksupport-botanthropic/claude-sonnet-5tenant_acmesupport/triage$0.011,942.6 ms200
14:32:09.107req_9Pc1RmYe4ssupport-botanthropic/claude-haiku-4.5tenant_globexsupport/reply$0.0019641.3 ms200
14:32:07.845req_8Fq2LmXo1csupport-botanthropic/claude-haiku-4.5tenant_initechsupport/summarize$0.0031808.4 ms200
14:32:04.219req_3Zr6KdWq8nsupport-botanthropic/claude-sonnet-5tenant_acmesupport/triage$0.033,214.9 ms200
14:32:02.660req_7Hb5NsTq3wsupport-botanthropic/claude-haiku-4.5tenant_hoolisupport/reply$0.0014412.0 ms200
14:32:00.093req_2Kd8VxRe6msupport-botanthropic/claude-sonnet-5tenant_umbrellasupport/summarize$0.032,871.5 ms200
14:31:58.731req_6Ym2HcPa5tsupport-botanthropic/claude-sonnet-5tenant_globexsupport/reply$0212.4 ms429
14:31:55.318req_5Wt9GpLc1zsupport-botanthropic/claude-sonnet-5tenant_acmesupport/triage$0.022,486.1 ms200
14:31:52.904req_4Qn3BvYk7rsupport-botanthropic/claude-haiku-4.5tenant_initechsupport/reply$0.0022690.7 ms200
14:31:49.556req_8Jv1MzDs2psupport-botanthropic/claude-sonnet-5tenant_globexsupport/triage$0.022,103.8 ms200
A saved view in Traffic for the support bot: cost by feature and by customer over the last 30 days.

Fine-Grained Budgets for Applications

A budget can cover one application, a chosen set of applications, or every application with a tag such as production, which includes new services as soon as they carry the tag. Each budget holds a total, a limit for each application inside it and limits for each model. A team can cap its production support bots at $5,000 a month in total, keep any one application under $2,000, and hold its most expensive model under $1,000.

Rules act before the bill does. A rule can alert when spend is projected to reach a limit within the next two hours, post to the on-call webhook, and block only the application that crossed its line while every other application keeps serving. Budgets stack, so a team budget, an application's budget and a model limit all apply together, and the first one reached takes effect.

Engineering · org_3Fh8Wq2LdK

All budgets

New budget
Status:
allnearingimminentcapped
Search budgets…
Total spend
$18,580
Effective limits
$28,500
Capped
1
Imminent
0
Nearing
1
Unpriced traffic
0.4%
Budgets
1–5 of 525 / page
ColumnsUpdated
NameScopePeriodSpend / effective limitUsedStatusUpdated
Production API
bdg_7Qm2Xc9LpR
Tag · productionMonthly
$4,310/$5,000
86%Nearing2h ago
Production APIbdg_7Qm2Xc9LpRTag · productionMonthly
Detailed usage →
Spent
$4,310
Effective limit
$5,000
Remaining
$690
Per-router limit
$2,000base
Period
Sep 1 – Sep 30resets Oct 1
Pending requests
0
Routers over cap
0 of 4
Spend per day · daily · Sep 1 – Sep 30
SpendEffective limit/day
$0$100$200$300$400
Effective $166.67/day
Sep 1
Sep 8
Sep 15
Sep 22
Sep 29
Request approvers
Requests on
Emailed when someone asks for a higher limit in the Portal. The Portal hides its request button while this list is empty.
priya@example.com
name@example.com
Add
1 of 10
Budget Overrides · this period
Sep 1 – Sep 30 · UTC. Each override replaces one limit until the period ends.
Add Budget Override
TargetBase limitEffective limitChangeSet by
No Budget Overrides this period. Every limit is at its base.
Pending requests
Approving creates a Router override for this period. Adjust the amount before approving.
No pending requests.
Standard Engineering · claude-codePolicy1 request
bdg_2Lk5Pz8NcV
Tag · policy:standard-engineeringMonthly
$288/$200 per router
—No cap1d ago
Support routers
bdg_9Bv3Rt6YfJ
Routers · 3Monthly
$1,500/$1,500
100%Capped3d ago
Engineering org
bdg_4Hn8Ws1KdT
OrgMonthly
$11,842/$20,000
59%On track6d ago
Research sandbox
bdg_6Tx1Jm4GqW
Routers · 1Lifetime
$640/$2,000
32%Lifetime12d ago
Limits are server-resolved effective limits for the current UTC period.
The Budgets page with the Production API budget open: every application tagged production, its spend against $5,000 for the month, approvers and overrides.

People, Tools and Applications

A company's AI spend comes from two places: the people who use AI tools at work, and the applications the company builds. Attributing AI Cost to People and Tools covers the first, and this post the second. Multi-Router attributes and budgets both in one place, priced the same way, so the company sees all of its AI spend in one set of numbers. The Observability and Budgets & Spend Control docs cover each view and setting in detail.

Start for free

Create a router, set your SDK base URL to Multi-Router and see the cost of every request.