x-cave-* headers turn a single project’s spend into cost per workflow, per session, per customer, and per team. This guide shows which headers to send, how to set them from code, and where each one shows up in the console.
Labels identify traffic for reporting. They do not grant access or change authorization. People are only attributed through personal keys, never through headers; see Coding agent analytics.
Prerequisites
Your app already calls the gateway with a project key. If not, start with Connect a workload.Attribution headers
Header rules:
x-cave-sessionis optional. It accepts letters, digits, and._:-, up to 128 characters. Anything else is ignored.- If
x-cave-workflowis absent, the workflow tag set on the API key applies. x-cave-user-hashis stored as sent and never joined to a person in your organization. Send a hash, not an email address or name.- Separate multiple tags with commas.
Send the headers
x-cave-upstream-key as shown in Connect a workload.
Organize keys and projects for reporting
Headers label individual requests. Keys and projects give you coarser cost centers that need no code changes.- Projects: one project per environment or product line makes each subtotal chargeable.
- Keys: each request carries the key it authenticated with. A key with no member bound holds spend no person can be charged for.
- Labels: label keys on Governance → Keys. A key with two labels counts under both, so label rows can add up to more than the total.
Where app analytics show up
Spend
Analytics → Spend slices cost by Workflows, End users, Keys, Labels, Projects, Task types, Models, Providers, and Endpoints.
Usage reports
Tokens, Cache & compression, Routing, and Traffic shape for the selected window.
Traces
Filter by agent, workflow, or session and open any request.
Dashboards
Chart any label, for example cost by
tags.team or latency by workflow.