← Back to ProxyLLM

Cost tagging

Add an x-proxyllm-tag header to any request and the cost gets attributed to that tag in the dashboard. Useful for splitting spend by feature, customer, environment, or experiment.

How to set a tag

curl https://api.proxyllm.dev/v1/chat/completions \
  -H "Authorization: Bearer pl_your_api_key" \
  -H "x-proxyllm-tag: onboarding-summary" \
  -H "Content-Type: application/json" \
  -d '{...}'

With the OpenAI SDK, pass the header in defaultHeaders when constructing the client, or per-request via the second argument to create():

const res = await client.chat.completions.create(
  { model: "gpt-4o-mini", messages: [...] },
  { headers: { "x-proxyllm-tag": "onboarding-summary" } }
);

Tag conventions

  • Format: any string up to 255 characters. We recommend lowercase + hyphens (e.g. onboarding-summary, customer-acme, experiment-prompt-v2).
  • Missing tag: grouped under untagged in the dashboard.
  • Cardinality:there's no hard limit on distinct tag values, but the dashboard groups the top ~50 by spend — very high-cardinality tags (e.g. per-user IDs) will show in logs but not in the chart breakdown.

Where tags show up

  • Dashboard home — "Spend by tag" chart, current billing period.
  • Logs page — filter rows by tag using the "Filter by tag" input.
  • GET /v1/workspace/spend-by-tag— raw aggregation if you want to build your own report.
  • GET /v1/workspace/logs?tag=<value>— per-tag log search.

Plan availability

Available on all plans. The header is parsed and logged regardless of plan tier — what changes between plans is log retention (7/30/90 days) which limits how far back you can query.