{"article":{"title":"Billing rules","breadcrumb":["Billing","Billing rules"],"body":"**What this solves**: Explains when balance is deducted, when a cost is merely recorded, and why a failed call is sometimes a 402 and sometimes a 403.\n\n### The one-line principle\n\nWhether you're charged depends only on **who pays for this call's tokens**.\n\n| Route taken | Token fee | Governance fee |\n|---|---|---|\n| Platform model | Charged per the platform price list | — |\n| Your own channel (BYOK) | **Not charged**; the provider already bills you directly | Charged. Floor `0.0001`. A higher rate follows the trial or contract |\n\nThe diagram below separates the token fee on a normal call. BYOK also pays a governance fee, floor `0.0001`. Interrupted calls are covered below.\n\n![Who charges the token fee for a normal call](diagram:en-billing-who-pays)\n\n> [!NOTE]\n> So a zero balance **doesn't** block calls on your own channel: those tokens aren't owed to the platform, and the platform shouldn't block a call that could have gone through anyway.\n\n### First tell the three limits apart\n\nBefore diagnosing a failure, figure out which limit might have blocked the request:\n\n| Limit | Granularity | Resets monthly | Typical symptom |\n|---|---|---|---|\n| Account balance | Account | No | Platform model arrears is usually a 402 |\n| Monthly budget | Governance config on the account or key | Yes | Over budget is usually a 403 |\n| Key limit | A single key | No by default; can reset daily, weekly, or monthly | A Child key or Inference key that's used up is usually a 403 |\n\n> [!NOTE]\n> Tokens on a BYOK channel are paid by you directly to the provider. Tare records their cost and the governance fee, but this is **not the same as** the platform model deducting balance.\n\n#### Diagnosis order\n\n1. Look at the HTTP status code first.\n2. Then look at `error.type` (always present; this is the field the OpenAI SDK reads) and `metadata.refusal_reason`.\n   `error.code` is always equal to the HTTP status code; branching on it is never wrong, but it won't show the specific cause.\n3. If it's a 402, check the account balance first.\n4. If it's a 403, check in order: key type, key limit, monthly budget, source IP, DLP.\n5. If it's a 429, treat it as a rate limit; **don't mistake it for arrears**.\n\n> [!WARNING]\n> **402 and 403 are two different things; don't mix them up.** 402 only means the account owes the platform; 403 means a governance threshold (key limit, monthly budget) blocked it. See [Error codes](errors) for details.\n\n### Details\n\n#### Governance fee\n\nYour own channel is charged a governance fee per **million tokens** (input + output), floor `0.0001`, **not** a percentage cut of the provider's charge. A rate above the floor follows the trial or contract. The Routing page shows the current price list.\n\n#### Balance and key limit\n\n- Account balance **applies only to platform models**.\n- **The limit on a key** is independent of the balance and caps a single key's spend. A runaway task stops at the limit instead of draining the whole account.\n- When exhausted, it returns a **dedicated error code** (see [Error codes](errors)) rather than a generic failure.\n\n#### Interrupted calls: whether you're charged depends on who broke it and where\n\nWhen a stream is interrupted, the upstream tokens have usually already been consumed. But the usage numbers are in the final frame, and the final frame never arrives. So Tare queries upstream afterward and records the real cost, rather than discarding it.\n\n**Whether this charge ultimately lands on your bill** depends on two things: who caused the interruption, and whose money these tokens are.\n\n| Interruption cause | Your own channel (BYOK) | Platform model |\n|---|---|---|\n| Upstream failure (timeout, error, rate limit) | Not charged | Not charged |\n| **Your client** disconnects before the stream ends | Not charged (on this channel you're already paying the provider directly) | **Charged at the real upstream cost found by the query, with no markup** |\n\n> [!WARNING]\n> **The \"Platform model\" cell takes effect from 2026-09-26.** Before that, this class was borne by the platform.\n>\n> When the client disconnects after reading the first chunk, upstream still runs the whole generation to completion and bills it; with an expensive model and a large `max_tokens`, this kind of disconnect keeps generating cost. The charge collected is exactly the original price on the upstream bill, with no markup.\n\nWhether or not this charge ends up on you, the record **always keeps the real upstream cost**: reconciliation and gross-margin accounting won't lose track of where this money went just because one line didn't charge you.\n\n![Interrupted calls: whether you're charged depends on who broke it and where](diagram:en-billing-interrupted)\n\n#### Failover iterates over every configured route\n\nA model can have any number of routes configured, and **one call tries them all in order** until one succeeds. The platform sets no cap: configure four fallbacks and it tries at most four times. Whether to bear the extra wait for one more fallback is a trade-off for the account owner.\n\nTwo outcomes **don't count as an attempt** and are listed separately in [Call Traces](content-retention):\n\n- **parked**: that channel was taken out of rotation by the circuit breaker at the time, and not a byte was sent;\n- **never tried**: a candidate that wasn't reached. This only appears when the emergency attempt cap is enabled, which is a **global** switch, off by default and not configurable per account.\n\n> [!WARNING]\n> **On the Tare server path, every real attempt counts toward the governance fee's minimum charge.** A failover means the platform sent two upstream requests (opened two connections, waited out two timeouts), so the minimum charge is counted twice. Those blocked by the circuit breaker don't count: not a byte was sent, and it's a platform-side issue. Failures reported by a node have no floor fee.\n\n#### Failover and billing line count\n\nOne call **won't** produce two billing lines. Failover only happens **before the first byte is returned**, i.e. when the attempt hasn't produced any token consumption yet; once content starts returning there's no more failover. Therefore:\n\n- The prompt tokens of a failed attempt **don't go on your bill**;\n- One business call has **only one charged line** on the bill.\n\n> [!WARNING]\n> You **won't be charged** in this case: when a non-streaming request fails over due to timeout while upstream has actually completed, upstream may bill it twice. This cost is borne by the platform and not passed on to you. (A mid-stream disconnect is a different case, see the \"Interrupted calls\" section above; that class can land on your bill.)\n\n### Next steps\n\n- Want to know which business line each charge went to: read [Cost attribution](attribution).\n- Want to reconcile by period: read [Statements and invoices](statements).\n- Want to see what 402 / 403 / 429 each mean: read [Error codes](errors).\n"},"diagrams":{"en-billing-who-pays":"<svg viewBox=\"0 0 672 284\" width=\"672\" role=\"img\" xmlns=\"http://www.w3.org/2000/svg\">\n  <title>Who charges the token fee on a normal call</title>\n  <desc>Token fee on a normal call: platform models debit the balance at the platform price list. BYOK settles tokens with the provider, and Tare does not charge that token fee again. BYOK also pays a governance fee, floor 0.0001, with a higher rate set by trial or contract. Interrupted calls follow the rules in the text.</desc>\n  <style>\n    text { font-family: 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', system-ui, sans-serif; }\n  </style>\n  <defs>\n    <marker id=\"arrow-blue\" markerWidth=\"8\" markerHeight=\"8\" refX=\"2\" refY=\"4\" orient=\"auto\" markerUnits=\"userSpaceOnUse\">\n      <path d=\"M0,0 L8,4 L0,8 L2,4 z\" fill=\"#3b82f6\"/>\n    </marker>\n  </defs>\n\n  <!-- 浅色画布 -->\n  <rect x=\"0\" y=\"0\" width=\"672\" height=\"284\" fill=\"#ffffff\"/>\n\n  <!-- 版式算术：\n       根框横跨整行 22..650（宽 628），两个分支框并排在下一行，宽 300、间距 28，\n       于是 22..322 / 350..650。根框横跨是为了让两条分支线全竖直下行——\n       分叉线若走斜向，箭头会斜插进分支框的侧边，而不是落进顶边。\n       行顶边 60 / 142，底边 114 / 214；根框 54 高（两行），分支框 72 高（三行）。\n       内容左右边界 22..650，中心 336；viewBox 宽 = 628 + 两侧各 22 = 672。\n       高度 = 脚注末行基线 259 + 下伸 2.5 + 22px 边距 = 283.5，取整 284。 -->\n\n  <text x=\"336\" y=\"34\" font-size=\"16\" fill=\"#1e293b\" text-anchor=\"middle\">Who charges the token fee on a normal call</text>\n\n  <!-- 第 1 层：连线。全竖直，起点 = 根框底边 + 5 = 119，终点 = 分支框顶边 - 11 = 131，\n       留 12px 可见线，箭头正落在分支框顶边。 -->\n  <path d=\"M172,119 L 172,131\" fill=\"none\" stroke=\"#3b82f6\" stroke-width=\"1.5\" marker-end=\"url(#arrow-blue)\"/>\n  <path d=\"M500,119 L 500,131\" fill=\"none\" stroke=\"#3b82f6\" stroke-width=\"1.5\" marker-end=\"url(#arrow-blue)\"/>\n\n  <!-- 第 2 层：方框与文字。根框是判定，用蓝；要掏钱的那条用粉（强调），不用掏的用绿。 -->\n  <rect x=\"22\" y=\"60\" width=\"628\" height=\"54\" rx=\"6\" fill=\"#dbeafe\" stroke=\"#3b82f6\"/>\n  <text x=\"336\" y=\"82\" font-size=\"12\" fill=\"#1e40af\" text-anchor=\"middle\">Who pays for this call's tokens?</text>\n  <text x=\"336\" y=\"100\" font-size=\"10\" fill=\"#1e40af\" text-anchor=\"middle\">Platform models debit balance. BYOK settles with the provider.</text>\n\n  <rect x=\"22\" y=\"142\" width=\"300\" height=\"72\" rx=\"6\" fill=\"#fce7f3\" stroke=\"#ec4899\"/>\n  <text x=\"172\" y=\"165\" font-size=\"12\" fill=\"#9d174d\" text-anchor=\"middle\">Platform model</text>\n  <text x=\"172\" y=\"183\" font-size=\"10\" fill=\"#9d174d\" text-anchor=\"middle\">Token fee: your price list</text>\n  <text x=\"172\" y=\"198\" font-size=\"10\" fill=\"#9d174d\" text-anchor=\"middle\">Debited from the balance</text>\n\n  <rect x=\"350\" y=\"142\" width=\"300\" height=\"72\" rx=\"6\" fill=\"#d1fae5\" stroke=\"#22c55e\"/>\n  <text x=\"500\" y=\"165\" font-size=\"12\" fill=\"#166534\" text-anchor=\"middle\">Your channel (BYOK)</text>\n  <text x=\"500\" y=\"183\" font-size=\"10\" fill=\"#166534\" text-anchor=\"middle\">Token fee: not charged</text>\n  <text x=\"500\" y=\"198\" font-size=\"10\" fill=\"#166534\" text-anchor=\"middle\">The provider already billed you</text>\n\n  <!-- Footnote: the governance fee is a separate charge and is not part of this token-fee decision. The zero-balance line is this section's conclusion. -->\n  <text x=\"336\" y=\"244\" font-size=\"10\" fill=\"#64748b\" text-anchor=\"middle\">BYOK governance fee floor 0.0001. A higher rate follows the trial or contract.</text>\n  <text x=\"336\" y=\"259\" font-size=\"10\" fill=\"#64748b\" text-anchor=\"middle\">The token fee is not taken from balance, so a zero balance does not block BYOK.</text>\n</svg>\n","en-billing-interrupted":"<svg viewBox=\"0 0 700 336\" width=\"700\" role=\"img\" xmlns=\"http://www.w3.org/2000/svg\">\n  <title>Interrupted call: who broke it, who pays</title>\n  <desc>On an upstream failure, neither your channel nor a platform model is charged. If your client disconnects before the stream ends, your channel is not charged and a platform model is charged at the looked-up upstream cost with no markup.</desc>\n  <style>\n    text { font-family: 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', system-ui, sans-serif; }\n  </style>\n\n  <!-- 浅色画布 -->\n  <rect x=\"0\" y=\"0\" width=\"700\" height=\"336\" fill=\"#ffffff\"/>\n\n  <!-- 版式算术：\n       三列：行头 22..222，第一列 250..450，第二列 478..678。列宽一律 200，间距一律 28。\n       三行：列头 60..108（48 高），第一行 136..190（54），第二行 218..272（54）。\n       行间距 28，列间距 28——矩阵没有连线，间距就是它唯一的对齐关系，必须落在 25–30 里。\n       内容左右边界 22..678，中心 350；viewBox 宽 = 656 + 两侧各 22 = 700。\n       高度 = 脚注末行基线 311 + 下伸 2.5 + 22px 边距 = 335.5，取整 336。 -->\n\n  <text x=\"350\" y=\"34\" font-size=\"16\" fill=\"#1e293b\" text-anchor=\"middle\">Interrupted call: who broke it, who pays</text>\n\n  <!-- 列头行：两个轴名，蓝（它们是这张表的坐标，不是结论） -->\n  <rect x=\"22\" y=\"60\" width=\"200\" height=\"48\" rx=\"6\" fill=\"#dbeafe\" stroke=\"#3b82f6\"/>\n  <text x=\"122\" y=\"88\" font-size=\"10\" fill=\"#1e40af\" text-anchor=\"middle\">Cause  \\  channel</text>\n\n  <rect x=\"250\" y=\"60\" width=\"200\" height=\"48\" rx=\"6\" fill=\"#dbeafe\" stroke=\"#3b82f6\"/>\n  <text x=\"350\" y=\"88\" font-size=\"12\" fill=\"#1e40af\" text-anchor=\"middle\">Your channel (BYOK)</text>\n\n  <rect x=\"478\" y=\"60\" width=\"200\" height=\"48\" rx=\"6\" fill=\"#dbeafe\" stroke=\"#3b82f6\"/>\n  <text x=\"578\" y=\"88\" font-size=\"12\" fill=\"#1e40af\" text-anchor=\"middle\">Platform model</text>\n\n  <!-- 第一行：上游故障。两格都不收费 → 绿 -->\n  <rect x=\"22\" y=\"136\" width=\"200\" height=\"54\" rx=\"6\" fill=\"#dbeafe\" stroke=\"#3b82f6\"/>\n  <text x=\"122\" y=\"158\" font-size=\"12\" fill=\"#1e40af\" text-anchor=\"middle\">Upstream fault</text>\n  <text x=\"122\" y=\"176\" font-size=\"10\" fill=\"#1e40af\" text-anchor=\"middle\">Timeout, error, limit</text>\n\n  <rect x=\"250\" y=\"136\" width=\"200\" height=\"54\" rx=\"6\" fill=\"#d1fae5\" stroke=\"#22c55e\"/>\n  <text x=\"350\" y=\"167\" font-size=\"12\" fill=\"#166534\" text-anchor=\"middle\">Not charged</text>\n\n  <rect x=\"478\" y=\"136\" width=\"200\" height=\"54\" rx=\"6\" fill=\"#d1fae5\" stroke=\"#22c55e\"/>\n  <text x=\"578\" y=\"167\" font-size=\"12\" fill=\"#166534\" text-anchor=\"middle\">Not charged</text>\n\n  <!-- 第二行：你的客户端断开。BYOK 仍不收费，平台模型那一格是唯一要掏钱的 → 粉（全图唯一的强调色） -->\n  <rect x=\"22\" y=\"218\" width=\"200\" height=\"54\" rx=\"6\" fill=\"#dbeafe\" stroke=\"#3b82f6\"/>\n  <text x=\"122\" y=\"240\" font-size=\"12\" fill=\"#1e40af\" text-anchor=\"middle\">Your client drops</text>\n  <text x=\"122\" y=\"258\" font-size=\"10\" fill=\"#1e40af\" text-anchor=\"middle\">Before the stream ends</text>\n\n  <rect x=\"250\" y=\"218\" width=\"200\" height=\"54\" rx=\"6\" fill=\"#d1fae5\" stroke=\"#22c55e\"/>\n  <text x=\"350\" y=\"249\" font-size=\"12\" fill=\"#166534\" text-anchor=\"middle\">Not charged</text>\n\n  <rect x=\"478\" y=\"218\" width=\"200\" height=\"54\" rx=\"6\" fill=\"#fce7f3\" stroke=\"#ec4899\"/>\n  <text x=\"578\" y=\"241\" font-size=\"10\" fill=\"#9d174d\" text-anchor=\"middle\">Billed at real upstream cost</text>\n  <text x=\"578\" y=\"256\" font-size=\"10\" fill=\"#9d174d\" text-anchor=\"middle\">No markup</text>\n\n  <!-- 脚注：这一格是有生效日期的，以及「记录里始终留着成本」这条兜底。 -->\n  <text x=\"350\" y=\"296\" font-size=\"10\" fill=\"#64748b\" text-anchor=\"middle\">The platform-model / client-drop cell starts 2026-09-26. Before that, the platform paid it too.</text>\n  <text x=\"350\" y=\"311\" font-size=\"10\" fill=\"#64748b\" text-anchor=\"middle\">Whether it lands on you or not, the record keeps the real upstream cost for reconciliation and margin.</text>\n</svg>\n"}}