Skip to main content
Docs

One endpoint,
every model.

Tare is an OpenAI-compatible gateway in front of every model you use — ours and the ones you bring yourself. One base URL, one key, and every token accounted for.

BillingCost attribution

Cost attribution

What this solves: Lets you see "where this money went" and break spend down by customer, product line, task, and stage.

Attribution isn't a bill-download feature. It's finer-grained than an API bill, recording each model call separately by key, model, business label, and task stage.

To see spend by business line, the call must carry labels

If you want to see cost by customer, product line, task, or stage, you need to have your engineering team include fields like usage_label, task_id, and stage_code in the request body. Tare records them on this call and strips them before forwarding upstream, so the provider never sees them.

This is an action item: without labels, you can never break it down afterward. If you can't change the call code for now, there are only two alternatives:

  1. Have your engineering team add the business labels to the request body;
  2. Split into different Child keys by customer, business line, or environment.

With neither labels nor separate keys, there's no reliable way to break historical spend back down by business line.

Before reading reports, tell the two numbers apart

The console can break spend down by model, by key, by product line, and by time. Before reading a report, tell these two numbers apart:

FieldMeaning
ChargedThe amount the platform charges you, including the governance fee
Attributed spendHow much this call actually cost you, including the BYOK upstream cost

To measure the cost of a single feature, use Attributed spend.

Charged includes the governance fee. It is not the upstream token charge. Attributed spend includes what the provider bills you directly. Do not add the two together.

Two numbers to separate before reading a report: Charged and Attributed spend Charged is what the platform charges you, including the governance fee. Attributed spend is what this call actually cost you, including the BYOK upstream cost. Do not add the two together. Use Attributed spend to measure the cost of one feature. Charged and Attributed spend, kept apart Charged What the platform charges you Governance fee, not upstream tokens Attributed spend What this call actually cost you Includes the provider's direct bill On your own channel, you pay the provider for upstream cost Charged includes the governance fee. Attributed spend includes upstream cost. Do not add them. To measure one feature, use Attributed spend. That is what the call actually cost you. Retry spend, and spend on tools that were offered but never called, are counted on their own.
Two numbers to tell apart before reading a report: Charged and Attributed spend

Details

How to add attribution fields

Attach these fields in the request body; Tare records them on this call and strips them before forwarding, so the provider never sees them:

Attribution fields come in, then get stripped Attribution fields arrive on the request body, are recorded on the call, and are stripped before the forward so the provider never sees them. Official OpenAI returns 400 for unknown body fields. Video generation does not read usage_label. Attribution fields come in, then get stripped Your body carries attribution fields usage_label · task_id · stage_code · action_code · attempt_no Tare records them on this call Split by key, model, label, and stage. Without labels you cannot split it later. Stripped as a batch before the forward Leave them in and it fails: official OpenAI returns 400 for unknown fields Upstream gets the body with the labels removed Other fields are translated or passed through. This step does not normalize them. Why strip: a BYOK channel to api.openai.com would fail every call, and the error would not name the label. models and provider are stripped too, and they are not labels. Video ignores usage_label and keeps no history.
The life of an attribution field: it comes in with the call and is stripped before forwarding
Code / Terminal
{
  "model": "GLM 5.1",
  "messages": [ ... ],

  "task_id": 4821,
  "task_type": "issue-fix",
  "stage_code": "plan",
  "action_code": "draft-patch",
  "attempt_no": 2,
  "usage_label": "acme-corp",
  "available_tool_count": 12,
  "available_tool_choice_mode": "auto"
}

Stripping is necessary: the official OpenAI endpoint returns 400 for unknown body parameters. A BYOK channel pointing at api.openai.com would fail on every call because of this, and the error message has no visible relation to "one extra label was passed".

models and provider (see Routing) are also stripped, but they're not attribution labels: they decide which model and which channel answers this call, and aren't recorded against this call.

Charged and Attributed spend

  • Charged: the amount the platform charges you, including the governance fee.
  • Attributed spend: how much this call cost you, including the part the provider charges you directly. Use this value to measure the cost of a single feature.

Charged includes the governance fee. It is not the upstream token charge. Attributed spend includes what the provider bills you directly. Do not add the two together.

Retries and idle tool calls

The spend on retries, and on "tools were provided but never called once", is counted separately. These two are usually a small share; once their share rises, they're the lowest-cost improvements in the whole table.

Upstream Costs

Console → Upstream Costs shows what you paid your own upstream accounts for BYOK calls. Only calls with a known upstream price appear, so the total is a lower bound. For a provisioning key it shows the combined upstream cost of the child keys it issued.

The console's own read endpoints

The following are the console pages' own logged-in session endpoints, not part of the key-authenticated reconciliation API. For automated reconciliation, use the Reconciliation API.

The Analytics page (GET /v1/analytics) puts usage, per-model share, and success rate together in one endpoint; these three come from the same batch of numbers.

Its time series accepts a granularity (minute / half-hour / hour / day) and can plot spend, request count, tokens, success rate, or average latency; the detail table groups by model, channel, key, or stage, and the console page itself toggles among these five metrics and four groupings. The model-share chart keeps only the 6 models with the most requests and folds the rest into Other; an account that ran thirty models sees the ones that truly dominate, not thirty thin lines squeezed together indistinguishably.

/usage (with query, message, daily-chart, live, cost-series endpoints) provides the data used by the console charts and the "in-flight calls" live view; POST /usage/realtime/ticket is the WebSocket handshake ticket for that live view, expiring after a single use.

Next steps

Docs last updated Nov 27, 2026, 12:56 (UTC+8)