Key takeaways
- Name the customer with the ib-user header (or user) and the feature with ib-tags. Both stay with Inference Bureau and add nothing to a request's cost.
- Logs filter with user = and tag =, the project Overview ranks the top end users and tags by charge, and GET /v1/usage filters by end_user and tag, as JSON or CSV.
- Directives can cap each end user on its own with endUser, and a feature with tagBudgets. A request that doesn't fit returns 402 budget_exceeded naming the budget.
- A tag budget only holds requests that carry the tag, so send the tag from every code path that calls a model.
Say ib/payments runs one Inference Bureau key for all its customers. It summarizes disputes, answers support questions and drafts nightly digests. At the end of the month the bill is one number. Which customer used the most? Did the digest job cost more than the support answers? And what if one customer's script loops all night?
Two small additions to each request answer all three. This article shows what to send, where the cost then shows up and how to cap it.
Name the customer and the feature
The customer goes in the ib-user header, or in the field your SDK already has: user on chat completions, responses, embeddings, /v1/evaluate and /v1/suggest, and metadata.user_id on /v1/messages. When both are sent, the header wins. Use an id that is stable and means nothing outside your system, such as your internal user id or a hash of it, not an email address.
The feature goes in tags: comma-separated in the ib-tags header, or ib.tags in the body. Both together are merged.
curl https://api.inferencebureau.com/v1/chat/completions \
-H "Authorization: Bearer $IB_API_KEY" \
-H "Content-Type: application/json" \
-H "ib-user: ib-user-1042" \
-H "ib-tags: dispute-summary,onboarding" \
-d '{ "model": "openai/gpt-4o-mini", "messages": [{ "role": "user", "content": "Summarize dispute 8812" }] }'
Some rules, all enforced before anything is reserved or charged:
- An end user id is up to 256 characters, without control characters.
- A request takes up to 10 tags. Each is up to 64 characters of letters, digits and
_ . : / -, starting with a letter or digit. Tags are case-sensitive, and a repeated tag counts once. - A value that breaks a rule is refused with
400 invalid_request, naming the header or field. - Neither is sent to the provider:
user,metadataandibare removed before dispatch. The one exception issafety_identifier, which is forwarded as sent.
Read the cost back
Once requests carry them, three places show what each customer and feature cost.
Logs. In the query bar, user = ib-user-1042 or tag = dispute-summary filters the table, and clicking a user or tag in a row adds it to the query. Conditions combine with AND, so tag = dispute-summary AND cost > 0.02 finds the expensive summaries. Export CSV includes both columns.
The project Overview. It lists the top end users and the top tags by charge for the selected range.
The usage API. GET /v1/usage returns end_user and tags on every row, filters by end_user and tag, and pages with a cursor, up to 1,000 rows a page. One customer's spend on one feature is one query:
curl "https://api.inferencebureau.com/v1/usage?from=2026-11-01&to=2026-12-01&end_user=ib-user-1042&tag=dispute-summary&limit=1000&format=csv" \
-H "Authorization: Bearer $IB_API_KEY"
Any key of the team reads the whole team's usage, so a billing job can loop over your customers with one key. The same fields are on the receipt from GET /v1/requests/:id.
Cap each customer
Reading the bill is half of it. The endUser group in Directives limits each end user on its own, so one heavy customer can't use up the team's allowance:
| Field | Limits each end user to |
|---|---|
requestsPerMinute, tokensPerMinute | Requests admitted and tokens reserved per minute |
concurrentRequests | Requests in flight at once, streams included |
requestsPerDay, tokensPerDay | Requests and tokens per UTC day |
dailyUsd, monthlyUsd | Spend in USD per UTC day and month |
A request over a limit or quota returns 429 rate_limit_exceeded with X-RateLimit-Scope: end_user. One over an end user's budget returns 402 budget_exceeded. Other end users, and the team's own limits, are unaffected. End users are counted per environment, so ib-user-1042 in production and in development are two end users.
Two things to know. Each end user's budgets send no threshold alerts, since one per customer would be too many. Instead, the first refusal of an end user in a day or month sends one end_user.budget_exhausted webhook, so you hear about a customer who ran out. And a request that names no end user isn't limited by endUser at all, unless you set endUser.required to true, which refuses it with 400 invalid_request. Auditor's own calls are exempt from that.
Cap each feature
tagBudgets does the same for a feature. It maps a tag to a daily and a monthly budget, on UTC days and months:
{
"tagBudgets": {
"dispute-summary": { "dailyUsd": "20.00", "monthlyUsd": "300.00" }
}
}
- A tag budget applies at the level that sets it. On the team it covers every request of the team carrying the tag; on a key, only that key's. Budgets for the same tag at several levels all apply.
- A request with several budgeted tags is held against each and must fit all of them.
- A request that doesn't fit returns
402 budget_exceeded, naming the tag and the level, such astagBudgets["dispute-summary"].dailyUsd at project scope. - Tag budgets send
budget.thresholdwebhooks at the alert percentages of their level, like other budgets. - Up to 50 tag budgets at each level.
Requests without the tag, and tags with no budget, are unaffected. So a tag budget is only as good as your tagging: a code path that forgets the tag also escapes the cap.
With the management API, add one tag budget and keep everything else:
curl -X PATCH https://api.inferencebureau.com/v1/projects/inference-bureau/directives \
-H "Authorization: Bearer $IB_MANAGEMENT_KEY" \
-H "Content-Type: application/json" \
-d '{ "policy_version": 3, "set": { "tagBudgets.dispute-summary": { "dailyUsd": "20.00", "monthlyUsd": "300.00" } } }'
The table in the Directives page has the same fields, in its End users and Tag budgets groups.
Apps tag their own calls
If the model calls come from a hosted app, you don't have to tag them for the app itself. Every call an app's ai client makes carries app:<slug> and env:<environment> ahead of your own tags, so a tag budget can cap one app or every app's production, and tag = "app:ib-consign" in Logs finds its calls. A call takes up to eight tags of its own, since two are the app's.
A way to start
- Pick the one or two features that spend the most, and tag them from the code that calls the model.
- Send your own user id as
ib-userwherever a customer triggers the call. - After a few days, read the Overview's top end users and tags, and set
tagBudgetsa little above what the busiest day was. - Add
endUserlimits once you know what a normal customer uses.
Frequently asked questions
Do tags and end user ids change what a request costs?
No. They are kept by Inference Bureau and never sent to the provider, so they add nothing to the cost of a request.
Can I put an email address in ib-user?
You can, but the docs advise against it. Use an id that is stable for the user and means nothing outside your system, such as your internal user id or a hash of it.
What happens to a request that carries no tag?
Tag budgets don't hold it. A tag budget covers only requests that carry its tag, so every code path that calls a model should send it.
How do I get a monthly bill per customer?
Page through GET /v1/usage with the end_user filter, or without it and group the rows by their end_user field. Each row carries end_user, tags and the customer charge, and the CSV format has the same columns.