LLM cost allocation by team means tagging every span that carries cost with a team label, pricing each call from its model and token counts, and summing that cost grouped by the label. If one team owns a whole service, set the label once as a resource attribute. If a service is shared, copy the label onto each request’s spans. Spend with no label is unattributed, and you report it as its own line.
Key takeaways
- Invoices split cost by API key or project, not team; the split comes from your telemetry.
- Put
teamon the resource for single-owner services, and copy it from baggage for shared ones. - Use the workflow name as the use case.
- Tracium flags a workflow’s cost spike against that workflow’s own baseline, and the team label tells you who owns it.
Why doesn’t the AI bill show spend by team?
Providers bill per organization, project or key, and teams share keys. When one Aqtos feature cost me $0.1583 per agent call, the invoice showed only a daily total.
Which attributes should you tag?
| Dimension | Where it goes | Example |
|---|---|---|
| Team | Resource, or span for shared services | team=support |
| Use case | Workflow name | ticket-summary |
| Environment | Resource | deployment.environment.name=production |
| Customer | tracium.user.id on every span | acme |
Tracium keeps any attribute outside gen_ai.*, tracium.*, llm.*, traceloop.* and service.name as a custom allocation dimension. If a key is set on both the span and the resource, the span value wins (resource attributes). For the customer label, see tracking LLM cost per customer.
How do you tag LLM calls without a vendor SDK?
- One team per service: set the labels in the environment. OpenLLMetry’s
Traceloop.initbuilds its resource withResource.create, which reads this variable, so model spans carry the labels too.export OTEL_RESOURCE_ATTRIBUTES="team=support,deployment.environment.name=production" - Use case: name your workflows. Tracium assigns each trace to its root span’s workflow. That comes from
gen_ai.agent.name, then Traceloop’s workflow or entity name, thenservice.name(workflows). If a web-framework span is the trace’s root, setgen_ai.agent.nameon that span too. - Shared service: put the team in baggage when a request starts. The contrib
BaggageSpanProcessor(opentelemetry-processor-baggage) then copies it onto every span created under that request.
import os
from opentelemetry import baggage, context, trace
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.processor.baggage import BaggageSpanProcessor
from traceloop.sdk import Traceloop
from traceloop.sdk.decorators import workflow
Traceloop.init(
app_name="assistant-api",
exporter=OTLPSpanExporter(
endpoint="https://api.tracium.ai/v1/traces",
headers={"Authorization": f"Bearer {os.environ['TRACIUM_API_KEY']}"},
),
)
trace.get_tracer_provider().add_span_processor(
BaggageSpanProcessor(lambda key: key == "team")
)
@workflow(name="ticket-summary")
def summarize(ticket):
... # model calls, auto-instrumented
def handle(team, ticket):
token = context.attach(baggage.set_baggage("team", team))
try:
return summarize(ticket)
finally:
context.detach(token)
Baggage travels in outgoing HTTP headers, so keep it to plain labels. Avoid Traceloop.set_association_properties here: it writes traceloop.association.properties.* attributes, and Tracium doesn’t store those as custom dimensions.
How do you turn tagged spans into a spend-by-team report?
For ranges up to 30 days, open Usage, go to the attribute tab and pick team. For a monthly report broken down by team and use case, call your Tracium API’s query endpoint with a read key. It accepts windows of up to 92 days:

curl -s "$TRACIUM_URL/v1/query" \
-H "Authorization: Bearer $TRACIUM_READ_KEY" \
-H "Content-Type: application/json" \
-d '{"view": "calls", "metrics": ["cost", "runs"],
"dimensions": ["attr.team", "workflow"],
"from": "2026-10-01T00:00:00Z", "to": "2026-11-01T00:00:00Z"}'
The allocation sums span cost. The Overview also reconciles against token-usage metrics, so its total can be different (cost and usage).
What should you do with unattributed spend?
In the query API, spans without the key land in an empty attr.team group. The dashboard’s attribute tab leaves them out. To find where it comes from, filter on {"field": "attr.team", "op": "is_empty"} and group by service. Give those services a default team on their resource; baggage still overrides it.
How does team attribution help when spend spikes?
It points the alert at an owner. Tracium scores each workflow’s daily cost, error rate and run volume against that workflow’s trailing baseline with a robust z-score, (observed − median) / (1.4826 × MAD). It flags cost and error-rate spikes, and spikes or drops in runs. If a workflow version first appeared that day or the day before, the anomaly names it. Anomalies are scored per workspace and per workflow, not per team, so the workflow name is what leads you to the owning team.
Cloud plans send alerts to Slack or email (pricing). The open-source core shows them as outliers on the Overview and through the MCP detect_anomalies tool.
When is Tracium a good fit, and when is another tool better?
As of November 2026, per each vendor’s docs:
| Tool | Cost by team or use case | Alerting |
|---|---|---|
| Tracium | Any OTLP attribute | Anomaly detection against each workflow’s baseline; Slack/email on cloud plans |
| Langfuse | Tags in dashboards and Metrics API | Threshold alerts; Slack, PagerDuty, webhook |
| Helicone | Helicone-Property-* headers | Threshold alerts; email, Slack |
| LangSmith | Tags and metadata as filters | Threshold alerts; Slack, PagerDuty, webhook |
Tracium fits if you emit OpenTelemetry and want to know when a workflow leaves its normal range without setting thresholds. Helicone fits teams already on its gateway. Langfuse and LangSmith fit if you want fixed thresholds routed to PagerDuty, or their evaluation tooling.
FAQ
What is the difference between showback and chargeback for AI spend?
Showback reports each team’s AI spend. Chargeback bills that spend to each team’s budget. Both use the same tagged telemetry, but chargeback also needs a rule for who pays the unattributed share.
Should team be a resource attribute or a span attribute?
Resource attribute when one team owns the service, since it needs no code; span attribute, from baggage, when a service handles several teams. In Tracium the span value wins.
Why doesn’t my team report match the Overview total?
Team allocation sums span cost, while the Overview takes the larger of span and token-metric cost per time bucket. Compare team rows with the same query run without the team dimension.
Tracium is open source and self-hostable. Clone it from GitHub, or start free at app.tracium.ai and send your first tagged traces today.