{"article":{"title":"Overview","breadcrumb":["Getting started","Overview"],"body":"**What this solves**: What Tare is, when you need it, and in what order to integrate.\n\n### What Tare is\n\nTare is a model gateway that sits between your app and the various large models.\n\nFor your app, everything reduces to two values:\n\n| Config | Value |\n|---|---|\n| `base_url` | `https://tare.jamerly.ai/v1` |\n| `api_key` | A key you create in the Tare console |\n\nOn the Tare server path, Tare decides and records which vendor and which model answer the request, which upstream it takes, and how much it costs. On a customer Local Node, the business connects to the node directly, and Tare records usage and the ledger.\n\n![Tare architecture: app, gateway, and two kinds of upstream](diagram:en-overview-architecture)\n\n> [!NOTE]\n> The Local Node in the diagram above is one direct egress for your own channel. It is not a third vendor. How the request travels, and how the governance fee is charged, are in\n> [Local Nodes](local-nodes) and [Billing rules](billing).\n> Limits and sensitive-content checks are in [Rate limits and quotas](limits) and [Data protection (DLP)](security).\n\n### When you need Tare\n\nIf your app uses only one model, opens only one account, and doesn't care who spent how much, calling the provider's API directly is enough.\n\nThese situations are where Tare is worth it:\n\n- You don't want to be locked into a single vendor, and switching models only means changing config, not code.\n- You already have your own provider keys and want their usage, cost, and failures gathered in one place.\n- You want to issue separate keys to downstream users, teams, or customers — each with its own limit, individually disableable, and reconcilable.\n- Your upstreams are all over the place, and you want to call them all through OpenAI's API format.\n\nAt runtime Tare handles who can call, which vendor it goes to, how much was spent, how to fail over when something breaks, and how to investigate when something goes wrong.\n\n### Two modes of use, which can be mixed on the same account\n\n| | Platform model | Your own channel (BYOK) |\n|---|---|---|\n| Who buys the tokens | Tare procures them | You buy them yourself, paying the provider directly |\n| How Tare charges | By the platform price list | No token fee. A governance fee is charged, floor `0.0001`. A higher rate follows the trial or contract |\n| Who decides the upstream | Tare decides | You configure it on the Routing page. After you mark a customer node, the business connects directly to your own node |\n| What Tare gives you | A unified address, failover, usage records | All of the above, plus cross-vendor cost attribution |\n\n> **BYOK** = Bring Your Own Key: you connect your own provider credential to Tare. You still pay the provider for tokens. Tare also charges a governance fee, floor `0.0001`.\n\n> [!NOTE]\n> Connecting your own provider doesn't make tokens cheaper. You were already paying the provider directly.\n> Spend is recorded in one place, and you can break it down by model, by key, and by your own custom labels.\n\n### For your first integration, follow this order\n\n1. In the console's API Keys, create an Inference key, see [Before you start](before-key).\n2. Change the base URL and key, send your first request, see [Quickstart](quickstart).\n3. To connect your own provider, add a channel, see [Channels](channels).\n4. Enter cost prices for this channel; BYOK cost is calculated from them, see [Cost prices](cost-prices).\n5. Point the externally exposed model name at this channel, see [Routing](routing).\n6. Fill in governance config: alerts, limits, data protection, see [Alerts](alerts),\n   [Rate limits and quotas](limits), [Data protection (DLP)](security).\n\n### What a request goes through on the Tare server\n\nThe diagram below shows only a successful non-streaming chat on the Tare server path. Node mode is not on this diagram: the business connects to the upstream directly, and Tare only records usage and the ledger. See [Local Nodes](local-nodes).\n\nThe usage record is written after the response returns. Querying immediately after you get the `gen-...` ID may return 404. For how to query and retry, see [Endpoints](endpoints).\n\n![One request on the Tare server path](diagram:en-overview-request-sequence)\n\nThe request body needs no changes. Fields Tare doesn't recognize are forwarded to the upstream as-is, so `cache_control`,\n`reasoning`, `plugins`, and any parameters a vendor adds later all work right away, without waiting for a Tare release.\n\n### Next steps\n\n- No account or key yet: read [Before you start](before-key).\n- Want to get the first request running right away: read [Quickstart](quickstart).\n- Want to know what each console page does: read [Console guide](console-guide).\n- When you hit a term you don't recognize: check the [Glossary](glossary).\n"},"diagrams":{"en-overview-architecture":"<svg viewBox=\"0 0 694 394\" width=\"694\" xmlns=\"http://www.w3.org/2000/svg\">\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    <marker id=\"arrow-orange\" 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=\"#f59e0b\"/>\n    </marker>\n  </defs>\n\n  <!-- 浅色画布：图被贴到深色页面上时，仍然读作一张白卡片 -->\n  <rect x=\"0\" y=\"0\" width=\"694\" height=\"394\" fill=\"#ffffff\"/>\n\n  <!-- 竖向三段的算术，在任何坐标落笔之前就定死了。\n       宽度取自字符表：12px 中文 12px/字、10px 中文 10px/字、10px 拉丁 5.5px/字。\n       最宽的框内文字是 \"POST /v1/chat/completions\" = 25 x 5.5 = 137.5px，\n       所以第 1、2 段的框给 192px，两侧各留 27px。\n       第 3 段是两框并排：2 x 299 + 28 = 626，套上 15px 内边距的虚线容器得 656px。\n       容器 22..672，左右边距各 22px，内容中心 = (22 + 672) / 2 = 347，\n       所以标题落在 347，第 1、2 段的框落在 347 - 192/2 = 251，而不是 viewBox 中心。\n       三段自上而下：60..132（应用）、160..232（网关）、260..372（上游容器），\n       段间距一律 28px。viewBox 高度 = 内容底 372 + 22px 边距 = 394。 -->\n\n  <!-- 第 1 层：背景。虚线容器必须画在连线之前 —— 它的 fill 是不透明的 #f8fafc，\n       排在连线之后就等于一块板子盖住扇出的弧线，箭头会被整段吃掉。\n       这一条规范在 SKILL.md 的「SVG 绘制顺序」里写着，但 linter 不查绘制顺序，\n       只查几何，所以它绿灯也说明不了这里没画错 —— 只能靠渲染出来看一眼。 -->\n  <rect x=\"22\" y=\"260\" width=\"650\" height=\"112\" rx=\"10\" fill=\"#f8fafc\" stroke=\"#94a3b8\" stroke-dasharray=\"6,4\"/>\n\n  <!-- 标题落在内容中心 347，不是 viewBox 中心。y = 22 + 16 x 0.75 -->\n  <text x=\"347\" y=\"34\" font-size=\"16\" fill=\"#1e293b\" text-anchor=\"middle\">Tare sits between your app and upstreams</text>\n\n  <!-- 第 2 层：连线。竖向运行：起点 = 源框底边 + 5，终点 = 目标框顶边 - 11，\n       留下 12px 可见线 —— 是箭头不退化成一个点所需的 6px 的两倍。\n       每条连线带着它离开的那个框的描边色：应用是蓝的，网关是橙的。\n       扇出的左右两条不能从网关底边掉下来 —— 网关框只有 251..443 宽，\n       而两侧目标在 186.5 和 513.5，从底边出发的竖线会悬在框外。\n       改成从网关的左右侧边出发（起点的 y 取框心 196），再弯向目标。\n       每个末段控制点都与终点同 x（186.5 / 513.5），这样末端切线自然竖直向下，\n       箭头正对框顶而不是斜着扎进去。终点 y = 285 - 11，箭尖停在框顶上方 5px。\n       镜像对称于 x = 347，左右两条跨度都是 160.5px，扇出读起来是平的。 -->\n  <path d=\"M347,137 L 347,149\" fill=\"none\" stroke=\"#3b82f6\" stroke-width=\"1.5\" marker-end=\"url(#arrow-blue)\"/>\n  <path d=\"M246,196 C 205,196 186.5,232 186.5,274\" fill=\"none\" stroke=\"#f59e0b\" stroke-width=\"1.5\" marker-end=\"url(#arrow-orange)\"/>\n  <path d=\"M448,196 C 489,196 513.5,232 513.5,274\" fill=\"none\" stroke=\"#f59e0b\" stroke-width=\"1.5\" marker-end=\"url(#arrow-orange)\"/>\n\n  <!-- 第 3 层：方框和文字，盖住线头。\n       三行框：高 = 12 x 3 + 18 + 15 = 69，取整 72。\n       基线 83 / 101 / 116：12px 标题到 10px 副标题隔 18px，\n       两条 10px 行之间隔 15px（= 字号 x 1.5），整块中点 99.5 落在框心 96 + 12 x 0.35 = 100.2 上。\n       蓝色是「输入/主路径」那一组：请求从这里进入 Tare。\n       端点写进框里而不是挂在箭头上 —— 25 个字符的标签会把两段之间撑出 160px 的宽通道，\n       而块间距的标准是 25–30px；挂上去就等于为了一个标签把整张图撑松。 -->\n  <rect x=\"251\" y=\"60\" width=\"192\" height=\"72\" rx=\"6\" fill=\"#dbeafe\" stroke=\"#3b82f6\"/>\n  <text x=\"347\" y=\"83\" font-size=\"12\" fill=\"#1e40af\" text-anchor=\"middle\">Your app</text>\n  <text x=\"347\" y=\"101\" font-size=\"10\" fill=\"#1e40af\" text-anchor=\"middle\">base_url + api_key</text>\n  <text x=\"347\" y=\"116\" font-size=\"10\" fill=\"#1e40af\" text-anchor=\"middle\">POST /v1/chat/completions</text>\n\n  <!-- 网关框只写它是什么、挂在哪里 —— **刻意不列它做了哪几件事**。\n       那五件事（校验 key、选择路由、限额检查、扫描敏感内容、记录成本）是「职责」，\n       文档把它们挂在 03-overview 第 24 行的架构图上；而文档真正记录的「请求链路」\n       是另一份 4 项清单（校验 key / 选择路由 / 转发 / 记录 token、成本与归因，\n       见该篇第 74–77 行，与原文 articles.zh.ts 第 35–38 行一致）。\n       把职责排成一排画在这里，会被读成顺序，与那条 4 项链路对不上 ——\n       所以职责与链路分给两张图：链路交给 03-overview-request-sequence.svg。\n       橙色是「处理中」那一组，也正是这张图的焦点。 -->\n  <rect x=\"251\" y=\"160\" width=\"192\" height=\"72\" rx=\"6\" fill=\"#fef3c7\" stroke=\"#f59e0b\"/>\n  <text x=\"347\" y=\"183\" font-size=\"12\" fill=\"#b45309\" text-anchor=\"middle\">Tare model gateway</text>\n  <text x=\"347\" y=\"201\" font-size=\"10\" fill=\"#b45309\" text-anchor=\"middle\">tare.jamerly.ai/v1</text>\n  <text x=\"347\" y=\"216\" font-size=\"10\" fill=\"#b45309\" text-anchor=\"middle\">OpenAI-compatible</text>\n\n  <!-- 上游只有两类，不是一个组里的三个平行项 —— 本地节点不是第三种供应商，\n       它是 BYOK 渠道的一种网络出口方式（见 11-local-nodes 第 24、25 行：\n       只有 BYOK 渠道能用，平台共享渠道永远不能）。所以它降级成 BYOK 框里的一行，\n       不再与两类供应来源并列。容器顶部 25px 被组名占掉，内框从 y = 260 + 25 = 285 起排，\n       同为 72px 高（三行：两类来源 + BYOK 的出口），容器底 = 357 + 15 = 372。\n       两个内框同色：它们语义上是同一件事 —— token 的来源；给两种颜色反而会暗示两种不同的角色。\n       绿色是「数据/产出」那一组。 -->\n  <text x=\"32\" y=\"274\" font-size=\"11\" fill=\"#64748b\">Upstreams</text>\n\n  <rect x=\"37\" y=\"285\" width=\"299\" height=\"72\" rx=\"6\" fill=\"#d1fae5\" stroke=\"#22c55e\"/>\n  <text x=\"186.5\" y=\"308\" font-size=\"12\" fill=\"#166534\" text-anchor=\"middle\">Platform models</text>\n  <text x=\"186.5\" y=\"326\" font-size=\"10\" fill=\"#166534\" text-anchor=\"middle\">Tokens procured by Tare</text>\n  <text x=\"186.5\" y=\"341\" font-size=\"10\" fill=\"#166534\" text-anchor=\"middle\">Billed on the platform price list</text>\n\n  <rect x=\"364\" y=\"285\" width=\"299\" height=\"72\" rx=\"6\" fill=\"#d1fae5\" stroke=\"#22c55e\"/>\n  <text x=\"513.5\" y=\"308\" font-size=\"12\" fill=\"#166534\" text-anchor=\"middle\">Your own channel (BYOK)</text>\n  <text x=\"513.5\" y=\"326\" font-size=\"10\" fill=\"#166534\" text-anchor=\"middle\">You pay tokens; fee floor 0.0001</text>\n  <text x=\"513.5\" y=\"341\" font-size=\"10\" fill=\"#166534\" text-anchor=\"middle\">Egress: server direct, or your node</text>\n</svg>\n","en-overview-request-sequence":"<svg role=\"img\" viewBox=\"0 0 676 592\" width=\"676\" xmlns=\"http://www.w3.org/2000/svg\">\n  <title>One successful non-streaming chat on the Tare server path</title>\n  <desc>This diagram shows only calls through the Tare server: check the key, choose a route, forward upstream, return the response, then write usage and cost. Node mode is not on this diagram; the app calls upstream directly. The response is translated to the upstream's format and is not guaranteed byte-for-byte.</desc>\n  <!-- 用量写入时机依据 07-endpoints 的 GET /v1/generation 小节。 -->\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    <marker id=\"arrow-orange\" 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=\"#f59e0b\"/>\n    </marker>\n    <marker id=\"arrow-green\" 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=\"#22c55e\"/>\n    </marker>\n  </defs>\n\n  <!-- 浅色画布：图被贴到深色页面上时，仍然读作一张白卡片 -->\n  <rect x=\"0\" y=\"0\" width=\"676\" height=\"592\" fill=\"#ffffff\"/>\n\n  <!-- 时序图的算术，在任何坐标落笔之前就定死了。\n       角色框 192px 宽、两行、高 = 12 x 3 + 18 = 54。框间距取 28px（块间距标准 25–30 的中段），\n       于是角色中心间距 = 192 + 28 = 220，三个中心落在 118 / 338 / 558，\n       框 22..214 / 242..434 / 462..654，内容 22..654，中心 = (22 + 654) / 2 = 338。\n       通道宽 220px，够放下最长的消息标签 \"POST /v1/chat/completions\" = 25 x 5.5 = 137.5px，\n       两侧各余 41px。viewBox 宽 = 654 + 22px 边距 = 676。\n       生命线从角色框底 112 + 5 = 117 起，到最后一条消息 508 + 25 = 533 止，\n       viewBox 高 = 533 + 22px 边距 = 555。\n       配色沿用架构图：蓝 = 你的应用 / 请求，橙 = Tare 自己的处理，绿 = 上游 / 响应。\n       两张图同一套色，读者读第二张时不用重新学。 -->\n\n  <!-- 标题落在内容中心 338，不是 viewBox 中心。y = 22 + 16 x 0.75 -->\n  <text x=\"338\" y=\"34\" font-size=\"16\" fill=\"#1e293b\" text-anchor=\"middle\">One request on the Tare server path</text>\n\n  <!-- 第 1 层：生命线。竖直虚线，从角色框底 + 5 起画 -->\n  <path d=\"M118,117 L 118,533\" fill=\"none\" stroke=\"#94a3b8\" stroke-width=\"1\" stroke-dasharray=\"4,4\"/>\n  <path d=\"M338,117 L 338,533\" fill=\"none\" stroke=\"#94a3b8\" stroke-width=\"1\" stroke-dasharray=\"4,4\"/>\n  <path d=\"M558,117 L 558,533\" fill=\"none\" stroke=\"#94a3b8\" stroke-width=\"1\" stroke-dasharray=\"4,4\"/>\n\n  <!-- 第 2 层：消息。横向同轴的直线：右行起点 = 源生命线 + 5、终点 = 目标生命线 - 11；\n       左行反过来（起点 = 源 - 5、终点 = 目标 + 11）。11 = 5px 净空 + 6px 箭尖伸出。 -->\n  <!-- 1. 应用 -> Tare：请求进来 -->\n  <path d=\"M123,150 L 327,150\" fill=\"none\" stroke=\"#3b82f6\" stroke-width=\"1.5\" marker-end=\"url(#arrow-blue)\"/>\n\n  <!-- 2、3、7. Tare 自调用。从生命线 + 5 处鼓出 40px 再回到生命线 + 11 处，\n       末段控制点 (378,226) 与终点 (349,226) 同 y，所以闭合切线是水平的 ——\n       箭头正对着生命线指回去，而不是斜着扎进来。 -->\n  <path d=\"M343,186 C 378,188 378,226 349,226\" fill=\"none\" stroke=\"#f59e0b\" stroke-width=\"1.5\" marker-end=\"url(#arrow-orange)\"/>\n\n  <path d=\"M343,262 C 378,264 378,302 349,302\" fill=\"none\" stroke=\"#f59e0b\" stroke-width=\"1.5\" marker-end=\"url(#arrow-orange)\"/>\n\n  <!-- 4. Tare -> 上游：转发 -->\n  <path d=\"M343,342 L 547,342\" fill=\"none\" stroke=\"#f59e0b\" stroke-width=\"1.5\" marker-end=\"url(#arrow-orange)\"/>\n\n  <!-- 5. 上游 -> Tare：返回。左行，起点 = 558 - 5、终点 = 338 + 11 -->\n  <path d=\"M553,392 L 349,392\" fill=\"none\" stroke=\"#22c55e\" stroke-width=\"1.5\" marker-end=\"url(#arrow-green)\"/>\n\n  <path d=\"M343,478 C 378,480 378,518 349,518\" fill=\"none\" stroke=\"#f59e0b\" stroke-width=\"1.5\" marker-end=\"url(#arrow-orange)\"/>\n\n  <!-- 6. Tare -> 应用：先返回响应，再写入用量记录。 -->\n  <path d=\"M333,428 L 129,428\" fill=\"none\" stroke=\"#22c55e\" stroke-width=\"1.5\" marker-end=\"url(#arrow-green)\"/>\n\n  <!-- 第 3 层：角色框和标签，盖住线头。\n       两行框高 54；基线 = 框心 85 - 9 + 12 x 0.35 ≈ 80 和 98。\n       三个角色框各用一组语义色，和架构图里同名的那三个框完全一致。 -->\n  <rect x=\"22\" y=\"58\" width=\"192\" height=\"54\" rx=\"6\" fill=\"#dbeafe\" stroke=\"#3b82f6\"/>\n  <text x=\"118\" y=\"80\" font-size=\"12\" fill=\"#1e40af\" text-anchor=\"middle\">Your app</text>\n  <text x=\"118\" y=\"98\" font-size=\"10\" fill=\"#1e40af\" text-anchor=\"middle\">base_url + api_key</text>\n\n  <rect x=\"242\" y=\"58\" width=\"192\" height=\"54\" rx=\"6\" fill=\"#fef3c7\" stroke=\"#f59e0b\"/>\n  <text x=\"338\" y=\"80\" font-size=\"12\" fill=\"#b45309\" text-anchor=\"middle\">Tare gateway</text>\n  <text x=\"338\" y=\"98\" font-size=\"10\" fill=\"#b45309\" text-anchor=\"middle\">tare.jamerly.ai/v1</text>\n\n  <rect x=\"462\" y=\"58\" width=\"192\" height=\"54\" rx=\"6\" fill=\"#d1fae5\" stroke=\"#22c55e\"/>\n  <text x=\"558\" y=\"80\" font-size=\"12\" fill=\"#166534\" text-anchor=\"middle\">Upstream provider</text>\n  <text x=\"558\" y=\"98\" font-size=\"10\" fill=\"#166534\" text-anchor=\"middle\">upstream API</text>\n\n  <!-- 消息标签。基线 = 箭头 y - 13 —— 这是 10px 文字对一条直线保持 10px 净空所需的偏移。\n       每条都落在自己跨越的两条生命线之间的中点，两侧各余 41px。 -->\n  <text x=\"228\" y=\"137\" font-size=\"10\" fill=\"#64748b\" text-anchor=\"middle\">POST /v1/chat/completions</text>\n  <text x=\"448\" y=\"329\" font-size=\"10\" fill=\"#64748b\" text-anchor=\"middle\">Forward upstream</text>\n  <text x=\"448\" y=\"379\" font-size=\"10\" fill=\"#64748b\" text-anchor=\"middle\">Response comes back</text>\n  <text x=\"228\" y=\"415\" font-size=\"10\" fill=\"#64748b\" text-anchor=\"middle\">200 response</text>\n\n  <!-- 自调用的标签放在鼓包右侧 12px、比下沿高 12px 的空档里 ——\n       放在曲线的正上方会被线穿过。 -->\n  <text x=\"390\" y=\"214\" font-size=\"10\" fill=\"#64748b\">Check the key</text>\n  <text x=\"390\" y=\"290\" font-size=\"10\" fill=\"#64748b\">Choose a route</text>\n  <text x=\"390\" y=\"506\" font-size=\"10\" fill=\"#64748b\">Write usage and cost</text>\n\n  <!-- 转发这条的补充说明，放在箭头下方、用更暗的斜体 ——\n       免得读成又一条消息标签。 -->\n  <text x=\"448\" y=\"360\" font-size=\"9\" fill=\"#94a3b8\" font-style=\"italic\" text-anchor=\"middle\">Translated if the upstream is not OpenAI</text>\n\n  <text x=\"338\" y=\"556\" font-size=\"10\" fill=\"#64748b\" text-anchor=\"middle\">Server path only. Node mode is not here: the app calls upstream directly, and Tare records usage and the bill.</text>\n</svg>\n"}}