How Tagging Works
Tags are passed as standard HTTP headers on each request through the Cloudidr proxy, alongside yourX-Cloudidr-Key authentication header. Cloudidr logs each tag value alongside the request’s token count, cost, model, and timestamp. The result is a fully attributed cost record — queryable by any tag dimension in your LLM Ops dashboard.
The Three Tag Dimensions
| Header | Purpose | Example values |
|---|---|---|
X-Department | Business unit, org division, or team | Engineering, Marketing, Sales, Data-Science |
X-Project | Specific initiative, workload, or product area | Customer-Search, Seo-Pipeline, Lead-Gen-v2 |
X-Agent | Individual agent, service, or use case name | Monitoring, SEO, Lead Gen, API Service |
X-Departmentcan represent a department or a team — whichever fits your org structure. Some organizations tag by formal department (Engineering,Marketing). Others use it as a team label (Backend,DevOps,Content). Both are valid. If you only have one level of group hierarchy, useX-Departmentfor it.
Flexibility — Use What You Need
All three tags are completely optional. Use none, one, two, or all three — any combination works.| Tags used | What you get in the dashboard |
|---|---|
| None | Organization-wide token and cost totals only |
X-Agent only | Per-agent cost and savings breakdown |
X-Department only | Cost rollup by business unit or team |
X-Department + X-Agent | Department-level rollup with per-agent drill-down |
X-Project + X-Agent | Project-level cost with per-agent attribution |
| All three | Full cost attribution: department → project → agent |
X-Agent and add more dimensions as your observability needs grow.
Code Examples
Python — Anthropic
Python — OpenAI
JavaScript / Node.js — Anthropic
JavaScript / Node.js — OpenAI
cURL — Anthropic
cURL — OpenAI
Real-World Tagging Patterns
Pattern 1 — Agent Only
Suitable for single-team setups or early-stage cost tracking. Immediately surfaces per-agent cost breakdown in Agent Explorer.Pattern 2 — Department as Team Label
UseX-Department to represent a team when your org doesn’t distinguish department from team hierarchy.
Backend) with per-agent detail (API Service).
Pattern 3 — Full Attribution (Recommended for Scale)
Full three-tag setup gives the complete org cost picture — department → project → agent — in a single dashboard view.- Department:
Marketing→ $900/month - Project:
SEO-Pipeline→ $900/month - Agent:
SEO→ $900/month, 91.2% savings rate
Pattern 4 — Multi-Agent Project
Tag each agent call with the same project so the dashboard rolls them up into a single project cost view.Outbound-Pipeline total cost shown in one view, split across Lead Research, Email Drafter, and Lead Qualifier.
What You See in the Dashboard
Once tags are flowing, the LLM Ops dashboard lets you:- Slice by any tag dimension — filter spend by
X-Department,X-Project, orX-Agent - Compare across departments/teams — see which group drives the most spend and at what savings rate
- Set Budget Guard limits per agent — Budget Guard uses the
X-Agentvalue to enforce per-agent monthly budgets - Track project-level ROI — tie token spend directly to a business initiative using
X-Project - Identify runaway agents — an agent with unexpectedly high token consumption shows up immediately in Agent Explorer
Tag Naming Conventions
⚠️ Tag values are case-sensitive and matched by exact string.Recommended: use Title Case for all tag values.Engineeringandengineeringare stored as two separate groups in the dashboard. A single inconsistency across your codebase will split what should be one group into two. Establish your convention once and enforce it everywhere.
X-Department→Engineering,Marketing,Inside Sales,Data ScienceX-Agent→Lead Gen,Monitoring,SEO,API Service,Content WriterX-Project→Customer-Search,SEO-Pipeline,Lead-Gen-V2(hyphenated Title Case works well for programmatic names)
marketing and another using Marketing creating two separate cost groups.
Other conventions to follow:
- Use hyphens for multi-word project names —
Customer-SearchnotCustomer Search(spaces can cause issues in some header parsers) - Keep values short and stable — these become filter labels and budget group identifiers; changing them mid-deployment splits your historical data
- Never mix conventions — if you start with
Engineering, don’t switch toengineeringorENGINEERINGmid-project
Summary
| Header | Required | Description | Example |
|---|---|---|---|
X-Cloudidr-Key | Yes | Your Cloudidr tracking key | trk_xxxx... |
X-Department | No | Department or team | Engineering |
X-Project | No | Project or workload | Customer-Search |
X-Agent | No | Agent or service name | Lead Gen |
For questions or integration help → support@cloudidr.com · llm-ops.cloudidr.com

