{"type":"root","children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"这篇解决什么问题"}]},{"type":"text","value":"：分清客户自建节点和走 Tare 服务端这两条执行路。请求不会汇到同一个节点。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"一次调用有两条执行路。记账进同一个账本。请求本身不汇聚。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"客户自建节点"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"本地节点是跑在你自己网络里的进程。它只服务你自己的 BYOK 渠道，渠道要标成 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"LOCAL_NODE"}]},{"type":"text","value":"。在 Channels 页勾选通过本地节点转发时，"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"allowLocalEgress: true"}]},{"type":"text","value":" 一并写入，不需要另外申请批准。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"业务代码直连节点，默认 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"http://127.0.0.1:8090/v1"}]},{"type":"text","value":"。请求和响应在你的网络和上游之间走，不经过 Tare。Tare 只留一条 gRPC 长连接：下发候选渠道、价目、数据保护规则和账户状态，收回用量，再把算好的费用推回来。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"节点不在，这次直连就是失败，不会改由 Tare 服务器代发。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"还有一种情况要说清。打 Tare 的地址、渠道标了 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"LOCAL_NODE"}]},{"type":"text","value":" 的调用，Tare 会经隧道交给你的节点；那一刻你的节点都不在线，Tare 就自己去找上游。调用不会失败，但出口换成了我们的地址而不是你的——上游只认你自己的出口地址时，这点很要紧。盯住控制台里的心跳，让节点处在守护之下。钥匙只放在节点上的渠道（包括"},{"type":"element","tagName":"a","properties":{"href":"subscription-supply"},"children":[{"type":"text","value":"订阅渠道"}]},{"type":"text","value":"）没有这条退路：节点不在时这条渠道跳过，按路由换下一条。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Tare 把调用交给你的节点，要求节点是 0.4.11 或更新的版本；更早的版本在这件事上等同于不在线。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"可以注册多台。业务打哪一台，由你写在客户端里的地址决定。Tare 不会把打到服务端的请求分到这些节点上。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"节点按推下来的候选做故障转移，同一档里按会话和权重挑渠道，和走服务端一样。按渠道上配的 Dialect 调上游（OpenAI、Responses、Anthropic、Gemini、Azure OpenAI、Bedrock 都行）。出图和视频也能直接打节点（0.4.11 起），回包里的图只有 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"b64_json"}]},{"type":"text","value":"，没有托管的 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"url"}]},{"type":"text","value":"。节点上报的失败没有保底费。Calls 不留请求正文和模型回答。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"上游如果只接受你自己的出口地址，就走这条路。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"走 Tare 服务端"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"平台渠道，以及出口仍是直连的 BYOK 渠道，请求进入 Tare，由服务端直连上游。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"不想自建时，用 Tare 运营的官方节点："},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"https://tare-node.jamerly.ai"}]},{"type":"text","value":"（OpenAI SDK 的 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"base_url"}]},{"type":"text","value":" 填 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"https://tare-node.jamerly.ai/v1"}]},{"type":"text","value":"），带上你自己的 Tare API key，不用装、不用注册令牌。它不在你的网络里，不能满足「流量必须从我自己的网络出去」。标了 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"LOCAL_NODE"}]},{"type":"text","value":" 的渠道仍要从你自己的节点出去。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"img","properties":{"src":"diagram:local-nodes-deployment","alt":"两条执行路，请求不汇聚","data-block":"true"},"children":[]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"用之前该知道的几件事"}]},{"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":"只有你自己的 BYOK 渠道能进客户节点。"}]},{"type":"text","value":" 平台渠道不会推给它。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"勾选通过本地节点转发时，"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"allowLocalEgress: true"}]},{"type":"text","value":" 一并写入，不需要另外申请。"}]},{"type":"text","value":" 渠道视图里如果仍是 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"allowLocalEgress: false"}]},{"type":"text","value":"，这条渠道不会交给节点，调用仍走服务端直连。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"多台节点不会自动分摊打到 Tare 的流量。"}]},{"type":"text","value":" 每台节点听它自己的地址。业务要打哪台，你自己指定。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"你在控制台里的改动几秒内就到连接着的节点：新增或修改渠道、路由，渠道被停用或恢复，余额用尽，数据保护规则变化。断开过的节点重连时会整个刷新一遍。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"注册令牌和节点自己的凭据，首次显示之后就再也拿不回来；丢了只能重新生成令牌、重新注册。"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"搭建步骤"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"这里没有能拉的 Docker 镜像：镜像不在公开仓库里。真正走得通的只有二进制这条路。Linux（amd64 / arm64）和 macOS（Apple Silicon / Intel）都发。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{},"children":[{"type":"text","value":"1. 装上它"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"在要跑它的机器上："}]},{"type":"text","value":"\n"},{"type":"element","tagName":"pre","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["language-bash"]},"children":[{"type":"text","value":"# Linux（需要 root）\nsudo bash <(curl -fsSL https://www.jamerly.ai/tare-local-node/install.sh)\n\n# macOS（不要加 sudo）\nbash <(curl -fsSL https://www.jamerly.ai/tare-local-node/install.sh)\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":"text","value":"这条命令有三点要注意："}]},{"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":"Linux 需要 root。"}]},{"type":"text","value":" 脚本先查权限再下载，不加 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"sudo"}]},{"type":"text","value":" 会直接停下。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"要写成 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"bash <(curl ...)"}]},{"type":"text","value":"。"}]},{"type":"text","value":" "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"curl ... | bash"}]},{"type":"text","value":" 会让脚本自己占住标准输入，交互提问就读到了脚本的下一行。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"无人值守就传 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"--token \"<注册令牌>\" --key \"<API Key>\""}]},{"type":"text","value":"。"}]},{"type":"text","value":" 脚本也认 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"-t"}]},{"type":"text","value":" 和 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"-k"}]},{"type":"text","value":"。"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Mac 上不要加 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"sudo"}]},{"type":"text","value":"：加了之后 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"$HOME"}]},{"type":"text","value":" 会变成 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"/var/root"}]},{"type":"text","value":"，二进制和 LaunchAgents 会装进 root 的家目录，你自己的账号登录后不会加载这个服务。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"想先看清楚它做什么再跑，就把脚本先存下来："},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"curl -fsSL https://www.jamerly.ai/tare-local-node/install.sh -o tare-node-install.sh"}]},{"type":"text","value":"。脚本运行时仍然要从 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"s.jamerly.ai"}]},{"type":"text","value":" 下载二进制，存下脚本不等于可以离线安装。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"脚本会自己认机器挑包、装二进制。在终端里运行时，它会显示一个码和一个链接：在任意一台已登录 jamerly.ai 的设备上打开链接、核对码、点允许，脚本就替你生成注册令牌和一把 Inference key（以主机名命名），不用先去控制台。传了 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"--token"}]},{"type":"text","value":" 和 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"--key"}]},{"type":"text","value":" 时照旧用传进来的。装完会问要不要接着共享这台机器上的模型，见 "},{"type":"element","tagName":"a","properties":{"href":"local-models"},"children":[{"type":"text","value":"共享本机模型"}]},{"type":"text","value":"。最后把节点留成受守护的服务：Linux 走 systemd，macOS 走 launchd。systemd 开机启动它，launchd 在你登录时启动它。两者都崩了自动拉起。Mac 重启之后只要没人登录，节点就一直离线，而它离线这段时间 Tare 会自己去找上游。二进制装在 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"/usr/local/bin/tare-local-node"}]},{"type":"text","value":"（Linux）或 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"~/.local/bin/tare-local-node"}]},{"type":"text","value":"（macOS）。脚本最后会探一次 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"http://127.0.0.1:8090/v1/models"}]},{"type":"text","value":"：端点有应答就说明节点起来了。注册也要确认成功：凭据一直没落盘时，脚本会打印 ❌ 并以非 0 退出，节点也不会出现在控制台里。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"要手动装，就解对应的那个包："}]},{"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":"机器"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"包"}]},{"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":"Linux，amd64"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"tare-local-node-linux-amd64.tar.gz"}]}]},{"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":"Linux，arm64"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"tare-local-node-linux-arm64.tar.gz"}]}]},{"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":"Mac，Apple Silicon"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"tare-local-node-darwin-arm64.tar.gz"}]}]},{"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":"Mac，Intel"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"tare-local-node-darwin-amd64.tar.gz"}]}]},{"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":"下面给两个例子，其余机器照上面的表换包名。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"pre","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["language-bash"]},"children":[{"type":"text","value":"# Linux，amd64\ncurl -fLO https://s.jamerly.ai/tare-local-node/stable/tare-local-node-linux-amd64.tar.gz\ntar xzf tare-local-node-linux-amd64.tar.gz\n\n# Mac，Apple Silicon\ncurl -fLO https://s.jamerly.ai/tare-local-node/stable/tare-local-node-darwin-arm64.tar.gz\ntar xzf tare-local-node-darwin-arm64.tar.gz\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":"text","value":"Mac 上，从浏览器、聊天软件或邮件里拿到的二进制带隔离标记，macOS 不会让它跑，要先清掉："},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"xattr -d com.apple.quarantine ./tare-local-node"}]},{"type":"text","value":"。只 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"chmod +x"}]},{"type":"text","value":" 清不掉。用 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"curl"}]},{"type":"text","value":" 下来的不带这个标记。"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{},"children":[{"type":"text","value":"2. 生成注册令牌"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"控制台 → "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Channels"}]},{"type":"text","value":" → "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Local nodes"}]},{"type":"text","value":" 页签 → "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Generate registration token"}]},{"type":"text","value":"。和 key 一样只显示一次，立刻复制。它一次性使用，24 小时内有效。用掉之后还能看到它注册成了哪个节点。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{},"children":[{"type":"text","value":"3. 启动节点"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"用这个令牌和账号下任意一把推理 key（控制台 → "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"API Keys"}]},{"type":"text","value":"）启动它："}]},{"type":"text","value":"\n"},{"type":"element","tagName":"pre","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["language-bash"]},"children":[{"type":"text","value":"TARE_CONTROL_BASE_URL=https://tare.jamerly.ai \\\nTARE_TUNNEL_ADDR=tare-grpc.jamerly.ai:443 \\\nTARE_REGISTRATION_TOKEN=<第 2 步拿到的令牌> \\\nTARE_API_KEY=<你自己的推理 key> \\\n./tare-local-node\n"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"这几个是你要自己设的变量。"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"TARE_TUNNEL_TLS"}]},{"type":"text","value":" 和 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"TARE_NODE_AUTH_MODE"}]},{"type":"text","value":" 在下面另有说明，所以这张表不是全部。"}]},{"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":"变量"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"默认值"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"作用"}]},{"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":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"TARE_CONTROL_BASE_URL"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"https://tare.jamerly.ai"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"控制面地址，不要带 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"/api"}]}]},{"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":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"TARE_TUNNEL_ADDR"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"tare-grpc.jamerly.ai:443"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"隧道地址，节点自动用 TLS"}]},{"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":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"TARE_REGISTRATION_TOKEN"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"—"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"第 2 步那个一次性令牌"}]},{"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":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"TARE_API_KEY"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"—"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"账号下的一把推理 key"}]},{"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":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"TARE_NODE_LISTEN"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"127.0.0.1:8090"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"节点的监听地址"}]},{"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":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"TARE_NODE_CREDENTIALS_PATH"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"/etc/tare-local-node/credentials.json"}]},{"type":"text","value":"（Linux）、"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"~/.config/tare-local-node/credentials.json"}]},{"type":"text","value":"（macOS）"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"长期凭据写到哪里"}]},{"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":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"TARE_NODE_HELD_KEYS"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"凭据文件同目录的 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"keys.json"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"只放在节点上的 Key（订阅渠道、勾了 Keep the API key only on my node 的渠道）"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"TARE_CONTROL_BASE_URL"}]},{"type":"text","value":" 不要带 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"/api"}]},{"type":"text","value":"。隧道连的是公网域名，节点会自动用 TLS（"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"TARE_TUNNEL_TLS=auto"}]},{"type":"text","value":"）。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"成功后会把长期凭据写到 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"/etc/tare-local-node/credentials.json"}]},{"type":"text","value":"（Linux）或 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"~/.config/tare-local-node/credentials.json"}]},{"type":"text","value":"（macOS）并完成注册。控制台里能看到它就是这一步生效的标志：状态是 "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Online"}]},{"type":"text","value":"，隧道指示是 "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Tunnel connected"}]},{"type":"text","value":"。断线后几秒内这两个会对不上。之后重启不再需要令牌：它读的是这个文件，而且令牌反正已经被消耗掉了。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"blockquote","properties":{"data-alert":"warning"},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"key 会明文落到磁盘上，一共三处："},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"node.env"}]},{"type":"text","value":"、macOS 的 launchd plist、以及凭据文件。\n这三处都会被安装脚本设成 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"600"}]},{"type":"text","value":"："},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"node.env"}]},{"type":"text","value":"（Linux 在 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"/etc/tare-local-node/node.env"}]},{"type":"text","value":"，macOS 在 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"~/.config/tare-local-node/node.env"}]},{"type":"text","value":"）、那个 plist（"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"~/Library/LaunchAgents/com.jamerly.tare-local-node.plist"}]},{"type":"text","value":"）、以及凭据文件（Linux 在 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"/etc/tare-local-node/credentials.json"}]},{"type":"text","value":"，macOS 在 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"~/.config/tare-local-node/credentials.json"}]},{"type":"text","value":"）。注册完成前，前两处还会额外放一份一次性注册令牌。这三处都不要放进网盘同步目录，也不要提交进代码仓库。"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{},"children":[{"type":"text","value":"4. 把渠道交给客户节点"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"控制台 → "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Channels"}]},{"type":"text","value":" → 编辑你自己的某条 BYOK 渠道 → 勾选 "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Route through a local node"}]},{"type":"text","value":"。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"勾上之后，这条渠道从你的节点出去：打节点地址的调用就在本地发出，打到 Tare 地址的调用经隧道转到这台节点上。没交给节点的渠道一直留在服务端那条路上，不会进这台节点。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"再勾上 "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Keep the API key only on my node"}]},{"type":"text","value":"，这条渠道的 Key 就只放在你的节点上，Tare 不保存。Key 写法和位置同"},{"type":"element","tagName":"a","properties":{"href":"token-market"},"children":[{"type":"text","value":"订阅渠道"}]},{"type":"text","value":"：按渠道 id 写进节点上的 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"keys.json"}]},{"type":"text","value":"（Linux "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"/etc/tare-local-node/keys.json"}]},{"type":"text","value":"，macOS "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"~/.config/tare-local-node/keys.json"}]},{"type":"text","value":"）。账号下有几台节点，每台都要写这一项。这样的渠道只能由你的节点执行：节点都不在线时，打到 Tare 地址的调用跳过这条渠道，不会改由 Tare 直连。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{},"children":[{"type":"text","value":"5. 把业务指到节点"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"把客户端的 base URL 指到那台机器的 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"http://127.0.0.1:8090/v1"}]},{"type":"text","value":"。模型名和打 Tare 时一样。节点认 OpenAI、Anthropic、Google GenAI、Azure OpenAI 和 Bedrock 这几种 SDK 的请求形状，这些客户端不用改就能直接打它："},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"/v1/chat/completions"}]},{"type":"text","value":"、"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"/v1/responses"}]},{"type":"text","value":"、"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"/v1/messages"}]},{"type":"text","value":"、"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"/v1/completions"}]},{"type":"text","value":"、"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"/v1/embeddings"}]},{"type":"text","value":"、"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"/v1/images"}]},{"type":"text","value":"、"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"/v1/videos/generations"}]},{"type":"text","value":" 和 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"/v1/models"}]},{"type":"text","value":" 都在（出图和视频要 0.4.11 或更新的版本）。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"调用要带你自己的一把 Tare API key（"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"Authorization: Bearer"}]},{"type":"text","value":"）。节点默认向 Tare 核验这把 key 并缓存 60 秒（"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"TARE_NODE_AUTH_MODE=resolve"}]},{"type":"text","value":"）。"}]},{"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":"code","properties":{},"children":[{"type":"text","value":"TARE_NODE_LISTEN"}]},{"type":"text","value":" 可以改监听地址，但凡能连上这个端口的东西都能花你账户的钱，把它当 key 本身来看待。"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"先把你自己的一把推理 key 导出到 shell，下面的例子读的是 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"$TARE_API_KEY"}]},{"type":"text","value":"："},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"export TARE_API_KEY=<你自己的推理 key>"}]},{"type":"text","value":"。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"pre","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["language-bash"]},"children":[{"type":"text","value":"curl http://127.0.0.1:8090/v1/chat/completions \\\n  -H \"Authorization: Bearer $TARE_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"model\": \"GLM 5.1\",\n    \"messages\": [{\"role\": \"user\", \"content\": \"hello\"}]\n  }'\n"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"节点每 20 秒会打一次心跳证明自己还活着，并且每 8 分钟用你给它的那把推理 key 刷新一遍交给它直连的渠道清单。那把 key 只用来做这件事，从不会拿去替你打模型调用。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"节点之间直连（P2P）"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"节点之间也会直接相连。"},{"type":"element","tagName":"a","properties":{"href":"token-market"},"children":[{"type":"text","value":"订阅渠道"}]},{"type":"text","value":"用的就是这个：渠道在持有它的那台节点上执行，另一台节点（你自己的，或者买方的）把调用交给它。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"节点启动时打开 UDP 8091 端口，把自己的地址报给 Tare：本机网卡地址，加上 STUN 服务器看到的公网地址。之后它连上所有可能用到的节点，并一直保持，调用来了不用再等握手。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"Tare 只负责介绍两台节点。双方只认 Tare 告知的那张证书，请求和回复在两台节点之间直接传。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"两台节点在同一网络里时走内网地址。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"两台节点连不上时（比如都在严格的 NAT 后面），调用照旧经 Tare。"}]},{"type":"text","value":"\n"}]},{"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":"变量"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"默认"}]},{"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":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"TARE_PEER"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"on"}]},{"type":"text","value":"；"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"off"}]},{"type":"text","value":" 关闭 P2P"}]},{"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":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"TARE_PEER_LISTEN"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"0.0.0.0:8091"}]},{"type":"text","value":"（UDP）"}]},{"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":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"TARE_PEER_STUN"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"stun.cloudflare.com:3478,stun.l.google.com:19302"}]},{"type":"text","value":"；"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"off"}]},{"type":"text","value":" 不探测"}]},{"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":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"TARE_PEER_PUBLIC_ADDR"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"空；给节点做了公网 UDP 端口映射时填 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"ip:端口"}]}]},{"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":"在 "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Channels"}]},{"type":"text","value":" 的 "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Local nodes"}]},{"type":"text","value":" 页签，能这样直连的节点会显示 "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"P2P"}]},{"type":"text","value":"，鼠标停上去能看到地址。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"让节点一直跑着"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"安装脚本最后留下的是一个受守护的服务。两套系统的命令分别是："}]},{"type":"text","value":"\n"},{"type":"element","tagName":"pre","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["language-bash"]},"children":[{"type":"text","value":"# systemd（Linux）\nsystemctl status tare-local-node\njournalctl -u tare-local-node -f\nsystemctl restart tare-local-node\n"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"pre","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["language-bash"]},"children":[{"type":"text","value":"# launchd（macOS）\nlaunchctl list com.jamerly.tare-local-node\nlaunchctl unload ~/Library/LaunchAgents/com.jamerly.tare-local-node.plist\nlaunchctl load ~/Library/LaunchAgents/com.jamerly.tare-local-node.plist\ntail -f ~/Library/Logs/tare-local-node/stderr.log\n"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"直接问节点有没有应答（还是用上面 export 过的那个 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"$TARE_API_KEY"}]},{"type":"text","value":"）："}]},{"type":"text","value":"\n"},{"type":"element","tagName":"pre","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["language-bash"]},"children":[{"type":"text","value":"curl -s http://127.0.0.1:8090/v1/models -H \"Authorization: Bearer $TARE_API_KEY\"\n"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"自动更新"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"节点会自己升级到新的正式版，不用重跑安装命令。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"每 30 分钟检查一次。新版本先下载并校验好，等到节点上没有正在处理的请求、并且安静了 15 秒才重启换上。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"重启只要一两秒，这期间发来的请求会排队等候，不会被拒绝。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"只装 Jamerly 签名发布的版本，版本号只会往上走。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"新版本反复启动失败时，节点自动换回原来的版本，以后也不再尝试那个版本。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Channels"}]},{"type":"text","value":" 的 "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Local nodes"}]},{"type":"text","value":" 页签上，鼠标停在节点的 Agent 版本号上能看到最近一次检查的结果。"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"想只在某个时段重启，或者完全关掉自动更新，在 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"node.env"}]},{"type":"text","value":"（Linux）里加一行，然后重启服务："}]},{"type":"text","value":"\n"},{"type":"element","tagName":"pre","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["language-bash"]},"children":[{"type":"text","value":"TARE_UPDATE_WINDOW=02:00-05:00   # 只在本地时间 2 点到 5 点之间重启，可以跨零点，如 22:00-04:00\nTARE_AUTO_UPDATE=off             # 不自动更新\n"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"macOS 上把同样的变量加进 plist 的 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"EnvironmentVariables"}]},{"type":"text","value":"，再 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"launchctl unload"}]},{"type":"text","value":" / "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"load"}]},{"type":"text","value":" 一次。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"自己用容器跑节点、二进制打在镜像里的，容器重建后会回到镜像里的版本，然后再自己升一次；想固定版本就设 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"TARE_AUTO_UPDATE=off"}]},{"type":"text","value":"，通过换镜像升级。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"和走服务端比，差在哪"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"模型名、请求和响应的形状、流式（节点会向上游要末帧的 usage）、响应头 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"X-Generation-Id"}]},{"type":"text","value":"，两边一样。Calls 里两边都有 token 数和费用。正文不一样，见下表。"}]},{"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":"\n"},{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"走 Tare 服务端"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"客户自建节点"}]},{"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":"请求是否经过 Tare"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"经过"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"不经过。Tare 只有控制连接"}]},{"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":"参与的渠道"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"平台渠道，以及 BYOK 直连"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"只有标了 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"LOCAL_NODE"}]},{"type":"text","value":" 的 BYOK，按推下来的顺序"}]},{"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":"权重"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"同一档里按会话、按权重分流"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"相同"}]},{"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":"上游接口格式"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"服务端负责翻译"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"节点负责翻译，按渠道上配的 Dialect"}]},{"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":"出图 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"/v1/images"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"支持，图另有 24 小时的托管 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"url"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"支持（0.4.11 起），只有 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"b64_json"}]}]},{"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":"故障转移"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"有，首字节返回前"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"有，失败分类相同；结果会报回去，计入渠道健康"}]},{"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":"失败的保底费"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"走服务端的真实尝试计入治理费的最低收费"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"节点上报的失败没有保底费"}]},{"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":"数据保护"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"在 Tare 上扫"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"在节点旁的扫描服务上扫（见下文）"}]},{"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":"Calls 里的请求/响应正文"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"按留存开关"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"不留。内容没有到过 Tare"}]},{"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":"余额与额度"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"每次调用都查"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"按最近一次推到节点的状态判断；权威计费结果随后推回，纠正节点的本地估算"}]},{"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":"模型下没有 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"LOCAL_NODE"}]},{"type":"text","value":" 渠道时节点回 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"404"}]},{"type":"text","value":"。账户被封时回 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"403"}]},{"type":"text","value":"。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"节点还在，但连不上 Tare"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"节点进程还在、控制连接断了的时候，直连照常工作，用的是最后一次推送：候选、价格、规则和账户状态。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"用量先存在节点上，连接恢复就发出去（保留最近 10,000 条），之后才会出现在 Calls 和账单里。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"这和「节点进程不在」不是一回事。进程不在，打这个地址的调用失败。走 Tare 服务端的调用不受这台客户节点影响。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"节点上的数据保护"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"你的账户开着 DLP 时，直接调用由节点旁边的随行扫描服务来扫（"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"TARE_DLP_SIDECAR_URL"}]},{"type":"text","value":"，默认 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"http://127.0.0.1:8098"}]},{"type":"text","value":"），用的是 "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Security"}]},{"type":"text","value":" → "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Protection"}]},{"type":"text","value":" 上账户级的那一套（账户开关、你按类型的选择、推荐规则）。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"按 key 的设置在这里永远不生效，因为直连请求里没有 key。到达上游的是脱敏后的文本，拦截则回 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"403"}]},{"type":"text","value":" 并带上实体类型，和 Tare 上一样。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"blockquote","properties":{"data-alert":"warning"},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"规则生效而扫描服务连不上时，节点拒绝这次调用（"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"503"}]},{"type":"text","value":"），不会不扫就转发。账户没开 DLP 就不需要扫描服务。"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"扫描服务是一个独立的包，只有 Linux/amd64，自带运行时："}]},{"type":"text","value":"\n"},{"type":"element","tagName":"pre","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["language-bash"]},"children":[{"type":"text","value":"curl -fLO https://s.jamerly.ai/tare-local-node/stable/tare-dlp-sidecar-linux-amd64.tar.gz\ntar xzf tare-dlp-sidecar-linux-amd64.tar.gz\n./tare-dlp-sidecar/bin/tare-dlp-sidecar\n"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"macOS 没有扫描服务的构建。所以账户开着数据保护时，Mac 节点接不了直连调用：它回 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"503"}]},{"type":"text","value":"，而不是把没扫过的文本转发出去。两样都要，就把节点跑在 Linux 上。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"它监听 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"127.0.0.1:8098"}]},{"type":"text","value":"，节点默认就找这个地址；要改的话扫描服务上的 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"TARE_DLP_SIDECAR_PORT"}]},{"type":"text","value":" 和节点上的 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"TARE_DLP_SIDECAR_URL"}]},{"type":"text","value":" 一起改。和节点放在同一台机器上。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{},"children":[{"type":"text","value":"姓名/地点/机构名识别（NER）"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"人名、地名、机构名三类用的是一个本地语言模型，第一次用到时从 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"s.jamerly.ai"}]},{"type":"text","value":" 下载（约 180 MB；"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"TARE_DLP_NER_BASE_URL"}]},{"type":"text","value":" 可以指到你自己的镜像），加载要几分钟。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"加载期间请求照常按其它类型扫、照常转发，这三类要等模型就绪后才开始被检测。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"这三类开着时给它 2 GB 堆（"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"TARE_DLP_SIDECAR_HEAP=2g"}]},{"type":"text","value":"）；关着就什么都不下载。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"控制台上能看到什么"}]},{"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":"注册令牌"}]},{"type":"text","value":"：历史上发过的每一个，带状态（待用 / 已用 / 已过期），用掉之后还能看到变成了哪个节点。发出后只显示一小段指纹，不会再显示令牌本身。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"节点"}]},{"type":"text","value":"：每个已注册节点的状态（在线 / 离线 / 注册中 / 已吊销）、节点程序版本、上次心跳时间。另有一个独立的「隧道已连接」指示，反映的是"},{"type":"element","tagName":"em","properties":{},"children":[{"type":"text","value":"此刻"}]},{"type":"text","value":"这条连接是不是真的活着。隧道断开满 3 分钟，状态才转为离线，并显示从什么时候断开，所以断线后的几分钟里这两个会对不上。离线和恢复都会按 "},{"type":"element","tagName":"a","properties":{"href":"alerts"},"children":[{"type":"text","value":"告警"}]},{"type":"text","value":" 里的 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"NODE_OFFLINE"}]},{"type":"text","value":" 规则通知你，默认开着，同一台节点 15 分钟内只通知一次。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"最近事件"}]},{"type":"text","value":"：节点在入口拒掉、又归不到任何一把 key 的请求（没带 key、key 不对、请求体不是合法 JSON），节点程序自己的告警和错误日志，以及离线和恢复。前两类随心跳报给 Tare，隧道断着也报得上来。同一件事合并成一条，带次数、来源地址和请求里那把 key 的情况（停用、过期、不是 Tare 的 key）。节点卡片上是最近 24 小时的次数，展开 "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Recent events"}]},{"type":"text","value":" 看最近 7 天。能归到某把 key 的调用，包括被拒的，照常记在调用记录里，不在这里重复。key 明文不会离开节点，报上来的是它的指纹。"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"这些接口只认控制台会话，跟渠道、路由那两页一样："}]},{"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":"操作"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"接口"}]},{"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":"生成注册令牌"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"POST /v1/node/registration-tokens"}]}]},{"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":"列出注册令牌"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"GET /v1/node/registration-tokens"}]}]},{"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":"列出节点"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"GET /v1/node/nodes"}]}]},{"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":"吊销节点"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"POST /v1/node/revoke"}]}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"吊销一个节点"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"控制台 → "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Channels"}]},{"type":"text","value":" → "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Local nodes"}]},{"type":"text","value":" 页签 → "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Revoke this node"}]},{"type":"text","value":"。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"对新请求立刻生效：被吊销的节点不会再被选中，不管它的进程是不是还在跑。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"不会强行断掉已经在进行中的连接；如果代理进程碰巧还活着，它只是不会再收到新任务。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"要再用这个网络，重新生成一个令牌注册；被吊销的身份没法复活。"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"下一步"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"了解渠道与出口模式：读 "},{"type":"element","tagName":"a","properties":{"href":"channels"},"children":[{"type":"text","value":"渠道"}]},{"type":"text","value":"。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"把模型指到这条渠道：读 "},{"type":"element","tagName":"a","properties":{"href":"routing"},"children":[{"type":"text","value":"路由"}]},{"type":"text","value":"。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"看清楚一次调用留下了什么记录：读 "},{"type":"element","tagName":"a","properties":{"href":"content-retention"},"children":[{"type":"text","value":"Call Traces"}]},{"type":"text","value":"。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"配置敏感内容扫描：读 "},{"type":"element","tagName":"a","properties":{"href":"security"},"children":[{"type":"text","value":"数据保护（DLP）"}]},{"type":"text","value":"。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"遇到不认识的词：翻 "},{"type":"element","tagName":"a","properties":{"href":"glossary"},"children":[{"type":"text","value":"术语表"}]},{"type":"text","value":"。"}]},{"type":"text","value":"\n"}]}]}