{"type":"root","children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"What this solves"}]},{"type":"text","value":": Lets you see \"where this money went\" and break spend down by customer, product line, task, and stage."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"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."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"To see spend by business line, the call must carry labels"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"If you want to see cost by customer, product line, task, or stage, you need to "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"have your engineering team include"}]},{"type":"text","value":" fields like "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"usage_label"}]},{"type":"text","value":", "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"task_id"}]},{"type":"text","value":", and "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"stage_code"}]},{"type":"text","value":" in the request body. Tare records them on this call and "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"strips"}]},{"type":"text","value":" them before forwarding upstream, so the provider never sees them."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"blockquote","properties":{"data-alert":"warning"},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"This is an action item: without labels, you can never break it down afterward."}]},{"type":"text","value":" If you can't change the call code for now, there are only two alternatives:"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"ol","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"Have your engineering team add the business labels to the request body;"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"Split into different Child keys by customer, business line, or environment."}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"With neither labels nor separate keys, there's no reliable way to break historical spend back down by business line."}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"Before reading reports, tell the two numbers apart"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"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:"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"table","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"thead","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"Field"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"Meaning"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"tbody","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Charged"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"The amount the platform charges you, including the governance fee"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Attributed spend"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"How much this call actually cost "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"you"}]},{"type":"text","value":", including the BYOK upstream cost"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"To measure the cost of a single feature, use "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Attributed spend"}]},{"type":"text","value":"."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"blockquote","properties":{"data-alert":"note"},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"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."}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"img","properties":{"src":"diagram:en-attribution-two-numbers","alt":"Two numbers to tell apart before reading a report: Charged and Attributed spend","data-block":"true"},"children":[]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"Details"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{},"children":[{"type":"text","value":"How to add attribution fields"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Attach these fields "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"in the request body"}]},{"type":"text","value":"; Tare records them on this call and "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"strips"}]},{"type":"text","value":" them before forwarding, so the provider never sees them:"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"img","properties":{"src":"diagram:en-attribution-label-flow","alt":"The life of an attribution field: it comes in with the call and is stripped before forwarding","data-block":"true"},"children":[]},{"type":"text","value":"\n"},{"type":"element","tagName":"pre","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["language-json"]},"children":[{"type":"text","value":"{\n  \"model\": \"GLM 5.1\",\n  \"messages\": [ ... ],\n\n  \"task_id\": 4821,\n  \"task_type\": \"issue-fix\",\n  \"stage_code\": \"plan\",\n  \"action_code\": \"draft-patch\",\n  \"attempt_no\": 2,\n  \"usage_label\": \"acme-corp\",\n  \"available_tool_count\": 12,\n  \"available_tool_choice_mode\": \"auto\"\n}\n"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"blockquote","properties":{"data-alert":"tip"},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Stripping is necessary: the official OpenAI endpoint "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"returns 400 for unknown body parameters"}]},{"type":"text","value":". A BYOK channel pointing at "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"api.openai.com"}]},{"type":"text","value":" would fail on every call because of this, and the error message has no visible relation to \"one extra label was passed\"."}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"blockquote","properties":{"data-alert":"note"},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"models"}]},{"type":"text","value":" and "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"provider"}]},{"type":"text","value":" (see "},{"type":"element","tagName":"a","properties":{"href":"routing"},"children":[{"type":"text","value":"Routing"}]},{"type":"text","value":") are also stripped, but they're "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"not"}]},{"type":"text","value":" attribution labels: they decide which model and which channel answers this call, and aren't recorded against this call."}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{},"children":[{"type":"text","value":"Charged and Attributed spend"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Charged"}]},{"type":"text","value":": the amount the platform charges you, including the governance fee."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Attributed spend"}]},{"type":"text","value":": how much this call cost "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"you"}]},{"type":"text","value":", including the part the provider charges you directly. Use this value to measure the cost of a single feature."}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"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."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{},"children":[{"type":"text","value":"Retries and idle tool calls"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"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."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{},"children":[{"type":"text","value":"Upstream Costs"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Console → "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Upstream Costs"}]},{"type":"text","value":" 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."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{},"children":[{"type":"text","value":"The console's own read endpoints"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"blockquote","properties":{"data-alert":"note"},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"The following are the console pages' own "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"logged-in session endpoints"}]},{"type":"text","value":", not part of the key-authenticated reconciliation API. For automated reconciliation, use the "},{"type":"element","tagName":"a","properties":{"href":"integration-api"},"children":[{"type":"text","value":"Reconciliation API"}]},{"type":"text","value":"."}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"The Analytics page ("},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"GET /v1/analytics"}]},{"type":"text","value":") puts usage, per-model share, and success rate together in one endpoint; these three come from the same batch of numbers."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Its time series accepts a "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"granularity"}]},{"type":"text","value":" (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 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"Other"}]},{"type":"text","value":"; an account that ran thirty models sees the ones that truly dominate, not thirty thin lines squeezed together indistinguishably."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"/usage"}]},{"type":"text","value":" (with "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"query"}]},{"type":"text","value":", "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"message"}]},{"type":"text","value":", "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"daily-chart"}]},{"type":"text","value":", "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"live"}]},{"type":"text","value":", "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"cost-series"}]},{"type":"text","value":" endpoints) provides the data used by the console charts and the \"in-flight calls\" live view; "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"POST /usage/realtime/ticket"}]},{"type":"text","value":" is the WebSocket handshake ticket for that live view, "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"expiring after a single use"}]},{"type":"text","value":"."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"Next steps"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"Want to figure out which costs land on you: read "},{"type":"element","tagName":"a","properties":{"href":"billing"},"children":[{"type":"text","value":"Billing rules"}]},{"type":"text","value":"."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"Want to reconcile by period: read "},{"type":"element","tagName":"a","properties":{"href":"statements"},"children":[{"type":"text","value":"Statements and invoices"}]},{"type":"text","value":"."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"Want to pull data programmatically: read "},{"type":"element","tagName":"a","properties":{"href":"integration-api"},"children":[{"type":"text","value":"Reconciliation API"}]},{"type":"text","value":"."}]},{"type":"text","value":"\n"}]}]}