API 中转站(一个地址用遍所有模型)

中转站把你配好的那些 AI 账号(Claude / GPT / 国产模型……)合成一个地址、一把钥匙。你的编程助手只需要认这一个入口,剩下找谁发、发不通换谁、用了多少,都由 BestNav 在你自己服务器上处理。

18 个小节 · 约 17 分钟读完

一句话说明白:它能帮你做什么

你在 BestNav 里填好各家 API 账号(或者订阅型账号的可用额度)。开启中转站后,面板会多出一个自己的“假 OpenAI 官方地址”。你把 Cursor、Cline、Claude Code 这些工具的接口地址改成它,密钥换成面板给你的那一串。从此这些工具不再分别记五个地址、五把钥匙。

  • 一个地址用到底:所有工具只写 https://你的域名/api/llm/relay,以后换供应商不用改任何工具
  • 自动换下一家:当前这家额度用完了、报 429 限流了、或者干脆挂了,请求自动落到下一家,不会把正在写的代码拦腰断掉
  • 谁用了多少看得见:每一次请求都记一行账——哪家、哪个模型、多少 token、大概多少钱、快不快、成不成功
  • 省 token:工具回一大推重复内容时,面板会先压一遍再送出去,能实打实少花钱
  • 全在你自己机器上:中转只是“递话”,不往任何第三方发你的数据;账本也能一键清空
你的工具BestNav 中转站Cursor / Cline / Claude Code一个地址 + 一把钥匙第一层·订阅额度第二层·低价 API第三层·免费渠道第四层·本地兜底OpenAI 兼容 / Anthropic不通就自动换下一层
图:工具只面对一个入口;中转站按「订阅→低价→免费→本地」四层排队,上一层不通就落到下一层。

不是什么黑科技:中转站就是一个在你自己 NAS 上的“前台接待”。它不改你的提示词、不自己替你提问,只负责“交给谁、不通换人、记账”。

九个板块各回答一个问题

进入中转站后,左侧就是全部九个板块。它们的排布顺序就是使用顺序:先把路接通(高级能力 → 供应商),再看现在怎么样(数据看板 → 账号健康 → 用量明细),最后算账与调参(账目 → 设置)。

板块它回答什么
数据看板现在还通不通、一共还剩多少钱——先给总数,再逐家列出余额
高级能力端点与令牌在哪、四层降级怎么排、每个配额窗口还有多久重置
供应商你手上有哪几家的账号,逐家添加 / 修改 / 停用
账号健康每一家此刻什么状态,出问题的还有多久能回来
用量明细刚才到底发生了什么(按月 / 按天 / 按模型 / 逐条日志)
使用文档面板内这份上手说明,不用开浏览器找
远程访问人在外面时怎么安全连回来(Tailscale / Cloudflare Tunnel)
账目按周 / 月 / 季 / 年,这一期花了多少
设置所有开关都在这:检测、令牌、预算、价格、缓存、账本、清理

三步开始用(每步都不到一分钟)

前提:面板「供应商」里至少有一个能用的账号——自己填 API Key,或从官方目录里挑一家。一条都没有,中转站无米下锅。

  • 第一步:打开「高级能力」,看到四层路由(订阅 / 低价 / 免费 / 本地兜底)已按你的账号自动排好
  • 第二步:在同一页点「生成令牌」,拿到一把中转钥匙与一行端点地址(形如 https://你的域名/api/llm/relay)
  • 第三步:把端点与密钥填进你的工具(下一节有现成写法),保存后重动工具即可
  • 配好后回到首页(数据看板):「实时路由日志」会跟着请求滚动,「已接入 CLI 工具」告诉你哪几个工具已经指过来了

令牌只显示一次。弄丢了不用找:回同一页再点一次“轮换”,旧钥匙当场作废、新钥匙重发一份。

API 中转站数据看板截图
图:配好令牌后回到「API 中转站 · 数据看板」——中转用量、余额趋势与供应商占比都在这里,右侧可切近 7 / 30 / 90 天窗口。

常见工具怎么填

不同工具名字不一样,但只认三个值:接口地址(Base URL)、密钥(API Key)、模型名。地址始织填 https://你的域名/api/llm/relay,密钥填面板给的那串。

Bash# Cursor / Cline / Continue 等任何 OpenAI 兼容工具 OPENAI_BASE_URL=https://你的域名/api/llm/relay OPENAI_API_KEY=面板生成的中转令牌 # 命令行直接试一发(能回话就说明通了) curl https://你的域名/api/llm/relay/v1/chat/completions \ -H "Authorization: Bearer 你的中转令牌" \ -H "Content-Type: application/json" \ -d '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"你好"}]}'
  • 地址末尾不要多写一个斜杠,也不要手动补 /v1(工具会自己接)
  • 嫌地址长?面板首页「已接入 CLI 工具」那张卡下方就有一行端点地址,点一下即复制
  • 模型名写什么?中继支持标准模型发现(GET /v1/models),多数客户端指向端点后会自己拉出模型列表供你选;也可在面板「高级能力 → 可用模型」里按供应商看到实测清单,点一下即复制
  • 模型名写错了中转站会报“该模型不可用”,不会默默换一个
  • 在面板「高级能力 → 已接入 CLI 工具」里把工具开关拨开,只是为了让列表与统计能对上号,不影响能不能通
  • Claude Code 这类走 Anthropic 协议的工具同样能直连:端点填好后对方自己会接 /v1/messages。上游是 Anthropic 系就原样透传(含流式);只剩 OpenAI 系供应商时由面板做双向协议转换,转换不了的部分明确报错,不会悄悄丢字段

供应商:把一家账号加进来

这里是你所有账号的家,按凭据来源分成三组:API 密钥 / 免费额度 / 本地推理。每组都能单独一键「全部测试」。

  • 自建通道:点「添加 OpenAI 兼容」或「添加 Anthropic 兼容」,自己填名称、Base URL、Key 与模型
  • 从目录挑:打开官方目录搜索一家,选中后地址与默认模型自动预填,你只补 Key
  • 卡片上直接读:健康徽标、最近一次自动测速的错误码(AUTH / 429 / 5XX)、延迟、失败时间
  • 卡片上三个按钮:暂停 / 恢复、编辑、删除;默认排序下可拖动卡片改优先级
  • 点进卡片是这一家的详情:模型清单、逐个模型测通断、设为默认模型、关掉用不上的模型
  • 找不着就用搜索框,旁边还有状态筛选(全部 / 正常 / 异常 / 未配置)

「全部测试」打的是各家的模型列表接口,不产生 token 消耗,不会给你造账单。

账号健康:谁活着、谁在冷却

同一批账号的体检表:一行一家,配额窗口直接摊在行尾,不用点进去看。

  • 顶部五个计数:可用 / 冷却中 / 额度到顶 / 手动停用 / 未检测
  • 健康态优先级是死的:手动停用 > 额度到顶 > 冷却中 > 可用 > 未检测——你自己停的就一定显示「手动停用」
  • 每行给出:健康态、余额、可用率与延迟、配额窗口;右侧可直接暂停或编辑
  • 配额窗口一屏最多铺 3 行,点「还有 N 个窗口」展开全部
  • 窗口显示「—」= 上游没报剩余量:那是未知,不是 0,也不代表用光了

状态来自后台每 5 分钟一次的探针加上真实请求的失败记录;探针只读模型列表,不花钱。

数据看板:先给总数,再逐家列余额

进站第一屏。上面四张卡是体检结果(可用数、总余额、P95 延迟、可用率),下面是经过中转端点的用量与实时日志。它默认是关的——只有你打开「设置 → 检测与统计 → 用量统计」,面板才开始按周期积累快照。

指标它在说什么看的时候注意什么
平均可用率 / P95 延迟一段时间里上游有多少比例是通的,最慢的 5% 请求慢到什么程度可选 7 / 30 / 90 / 180 / 365 天窗口,样本越多越稳
日均消耗按最近实际用量算出的每天平均花费用量忽高忽低时它摆动很大
预计可用天数拿当前余额除以日均消耗,粗算还能用几天是提醒不是账单预测,用量模式一变就不准
总余额 / 分币种余额先把所有拿到余额的供应商按币种加总,下面再逐家列出各自的余额按币种原值呈现,不做汇率换算;没出现的那几家是这次没取到余额——未知,不是 0
余额偏低提醒低于阈值时在看板与通知里提示需要你自己设过预算或余额阈值才有

看板的数据从开启那一刻开始积累,不回补历史;余额数字来自各家回报,仅用于观察趋势,不等同于账单。要看「某一家还剩多少」,直接读总余额卡下面那一列,比自己拿总数去猜准得多。

“不通就换下一家”到底怎么判

  • 额度用完(配额窗口耗尽)→ 换下一层,并在面板上标“冷却中”
  • 被限流(上游回 429)→ 换下一层,不把你正在写的代码断掉
  • 上游挂了 / 超时 → 换下一层;四层都不行才把错回给你的工具
  • 会话不断线:同一次对话会尽量留在同一家,不会中间换个模型让你前面的上下文作废

你能在「高级能力」里直接看到当前哪一层在工作、各家的冷却倒计时,不需要猜。

省 token(RTK 压缩)与账本

编程工具最怕的不是问问题,而是“回一大推重复内容”(比如一次贴回整个目录树)。开启 RTK 后,面板会先把这类工具输出压一道再送给模型,面板上会直接显示“已省多少 token / 压缩比例”。

  • 开关位置:高级能力 → RTK 计量→ 切“激进压缩”(默认温和,只压明显重复)
  • 实时路由日志:面板首页(数据看板)直接列最近几条请求——刚落到哪一层、哪家、哪个模型、成功与否,每 5 秒刷新
  • 请求账本:逐条记录时间、哪家、哪个模型、token 数、估算成本、延迟与状态码
  • 保留与导出:账本默认留最近 300 条(设置 → 账本 可改 50–20000),同一行可导出「明细 CSV」与「日汇总 CSV」
  • 自定义单价:内置价格表(数据截至 2026-10)没有的模型,在「设置 → 价格覆盖」按输入/输出/缓存命中/缓存写入四档填价,填了就以你填的为准
  • 多账号轮询:同一层里有多个账号时,「设置 → 层内轮询策略」可选依次轮转 / 按权重 / 用最少优先(冷却中的账号一律靠后)
  • 配额窗口:每家的额度什么时候重置,倒计时看得到
  • 隐私出口:面板提供“清空账本与配额”一键操作,清完不保留历史请求明细

成本是“估算”:面板按公开单价乘实际 token 算,不等于供应商账单。拿它看趋势与对比可以,拿它报账不行。

两个缓存开关(都在「设置」,默认关)

缓存是这个功能里最省钱的一档,但面板上两个开关管的不是一回事,别弄混。

  • Anthropic 缓存断点:只作用在 Anthropic 原生上游(/v1/messages)。开启后在 system 末尾与最后一条用户消息上打一个 cache_control 断点,命中缓存的读取按 0.1× 计价;长 system prompt、多轮长对话省得最多
  • 它是会改写请求体的动作,但只在 Anthropic 原生出站那一条路上;其余通道一律原样透传,而且幂等——你自己已经带了断点就不会再加一层
  • 精确缓存:完全相同的请求(同一 BestNav 账号、同路径、同请求体)在有效期内直接回放上次响应,不再打上游;默认 300 秒,可设 30–86400 秒
  • 只缓存非流式的成功响应;流式请求与失败响应一律不缓存
  • 回放也会记一条账(条目类型=缓存),导出 CSV 时看得见,不做暗箱

两个开关都默认关。精确缓存会把请求与响应存在服务器进程内存里(重启即清),共用机器或在意内容落地的场景就别开。

账目:按周 / 月 / 季 / 年对账

「近 7 天」这类窗口是从今天往回数,答得了"最近忙不忙",答不了"3 月花了多少"。所以中转站把对账单独做成一个「账目」视图:先选粒度(周 / 月 / 季 / 年),再选哪一期,看到的就只有那一期的数。

粒度怎么算适合回答什么
按周周一起始的 ISO 周(跨年那一周归到含周四的年份)这周比上周多烧了多少
按月自然月,1 号到月末月度对账、给老板看的那个数
按季自然季(1–3 / 4–6 / 7–9 / 10–12 月)季度预算执行到哪了
按年自然年一年总账与复盘

数从哪来:账目读的是按天汇总——每次调用记账时当天就累加一份,所以整期的请求数、token 与成本都是全期合计,不是"最近若干条"的抽样。成本按币种分列显示(如 $1.25 · ¥8.00),不做汇率换算,也不会把两种钱加成一个数;「按供应商」那一栏可以直接拿去和各家余额实耗对账。

留多久:按天汇总保留 400 天(约一年多),逐条明细按条数保留(默认 300 条,可在「设置 → 账本」调到 50–20000 条)。所选期间只要起点早于留存起点,页面就会标出「本期数字不完整」——别把它当整期用;需要长历史请先用「导出日汇总 CSV」自己留档。

嫌数据太大想主动清:「设置 → 账本 → 清理 N 天之前」,填天数点按钮,确认后会同时删掉那些天的逐条明细与按天汇总,并回收磁盘空间(SQLite 删行不还空间,所以清理跟着做一次回收)。

  • 清理不可恢复,动手前先把「导出明细 CSV」和「导出日汇总 CSV」各存一份
  • 被清掉的期间在「账目」里会显示成不完整甚至消失,这不是统计丢了,是数据确实不在了
  • 只是嫌库大、又不想删历史的话,调小「保留条数」更稳妥——它只影响逐条明细,不动按天汇总

上游健康巡检:不用发请求也知道哪家不通

面板每 5 分钟对各家上游打一次极小的探针(只请求模型列表接口),把结果记成状态档,供你在账号池与「高级能力」页直接看,不必等真实请求失败才发现。

  • 探针不借用业务通道、不产生 token 消耗,也就不会给你造账单
  • 状态档分五类:可用 / 冷却中(限流或上游故障)/ 额度到顶 / 手动停用 / 空闲未测
  • 同一层里哪家在冷却、冷却到什么时候,页面上有倒计时,不用猜
  • 「高级能力 → 可用模型」列出实测可达的模型名,点一下即复制,省得手抄出错
  • 手动停用是给维护用的:停用中的账号不参与路由,也不被探针自动恢复

巡检只是提前告诉你「大概率不通」,真正转发时的判定仍是那四条:额度、限流、故障、超时。

设置页一览:每个开关在管什么

  • 令牌:生成 / 命名 / 限额(Token 额度、请求数额度、每分钟上限)/ 模型白名单 / 过期时间,可随时吊销
  • 预算熔断:按币种设每日/每月上限,超了就不再往上游发(不同币种各算各的,不跨币种汇总)
  • 全局别名:给工具一个短名字,转发到真实模型;换上游只改一处
  • 价格覆盖:内置价格是各家官网公开报价的预设快照(截至 2026-10-20,标准档 / 短上下文口径),没有的模型或厂商调价后手动补上四档单价并选币种(CNY / USD,不换算汇率);除输入 / 输出两档外还能单独填缓存读、缓存写(含 1 小时档)、按次收费、闲时半价与长上下文分档价,第三方中转可再加一层加价倍率
  • Anthropic 缓存断点 / 精确缓存:见上一节,都默认关
  • 账本:保留条数与两个 CSV 导出
  • 层内轮询策略:同一层多账号时怎么分摊流量

设置页只放“能改的东西”;上游健康、可用模型这类“只看不动”的观察项在「高级能力」页。

远程访问:人在外面也想用

这一页解决的是「怎么连进来」,不改变你访问上游时的出口 IP——上游看到的仍然是你服务器所在的网络。

  • Tailscale:组网成功后,直接用内网地址访问面板与中转端点,改动最小
  • Cloudflare Tunnel:有域名的话,把隧道指到面板端口即可,不用在路由器上开洞
  • 页面顶部只显示「已配置 / 未配置」两种状态,真实连通性请自己试一次
  • 一旦能从公网进来,务必配 HTTPS 与访问控制;令牌疑似泄露先「轮换」

中转端点默认限流 120 次/分:它是你自己的网关,不是公用出口。

安全须知(这几条建议看完)

  • 中转令牌等同你面板的钥匙。没配 HTTPS 就开到公网,等于把钥匙挂在大门上
  • 只在内网用的话,不要做端口映射;需要外网访问请上域名 + 证书 + 访问控制
  • 令牌可以随时“轮换”,旧钥立即作废;怀疑泄露就先轮换再看账本
  • 面板不会把你的 API Key 明文存在可被随便读的地方;导出备份时也一样受控
  • 内置备份与 WebDAV 备份会一并带走中转配置、已分发令牌与账本的一致性快照,重装恢复后已下发的令牌不会集体失效
  • 中转端点有频率限制(默认 120 次/分),不是拿来给全公司当网关的

常见问题

  • 报 401?——令牌错了或已轮换,回面板重新复制一份(注意别多复制一个空格)
  • 报“模型不可用”?——该模型不在任何一层的可用列表里,换一个模型名或先去面板检一次供应商
  • 工具说连不上?——先看面板与工具是不是同一个网络(内网地址在公网上当然连不到)
  • 流式回答断了?——中转对长回答已放宽超时(10 分铟),如果仍断,检查你自己的反向代理(Nginx 需关 proxy_buffering)
  • 能不能不记账?——能,面板提供清空账本与配额的入口

包月窗口怎么读数:上游报值 vs 本地估算

「配额」卡里每个窗口都有自己的倒计时;用尽后请求会自动落到下一条通道,不需要手动操作。

  • 上游报值:供应商在响应头里回报的剩余量,最可信;它没回报就没有数字
  • 本地估算:你填的上限 + 本服务端按实际发出的请求累计,没有上游确认,卡上会标「本地估算」
  • 显示「—」表示上游没报剩余量:那是未知,不是 0,也不代表用光了
  • 到顶后最多 6 小时会重试一次,不会把一个通道长期锁死
  • 若提示「上限可能偏小」:本地计数到顶但通道仍在正常响应,按实际套餐改一下上限即可

额度熔断与预算熔断的分工

两者看着像,判的是不同东西:

  • 预算熔断(每日/每月上限)看「花了多少钱」,按币种分开算,不换汇
  • 额度熔断看「某个窗口还剩多少」——一分钱没花,窗口用光也会被跳过
  • 任一触发都会让请求落到下一条通道;都触发就是「所有候选都不可用」

我们只改自己的账:重开本地窗口只清本机估算计数,重置积分只做记账——都不会替你向官方兑换额度。

一次请求额度窗口用尽了?预算上限到顶了?还有下一条通道?换下一条通道继续明确报错,不硬扛已花的钱仍然记账让你知道是全停了
图:两道闸各自独立判断,任一触发都先把请求交给下一条通道;只有全部候选都不可用时才把错误回给你的工具。

What it does, in plain words

You fill your API accounts into BestNav. Once the relay is on, the panel exposes its own OpenAI-compatible URL. Point Cursor, Cline or Claude Code at that URL with the key the panel gives you, and no tool needs to remember five endpoints and five keys any more.

  • One URL for everything — switching upstream never means editing your tools
  • Automatic failover — quota exhausted, 429 or upstream failure drops to the next tier instead of breaking your session
  • Per-request ledger — which account, which model, how many tokens, estimated cost, latency, status code
  • Token savings — bulky tool output gets compressed before it leaves, and the saving is measured
  • Stays on your box — the relay only forwards; it never ships your prompts to a third party, and the ledger can be wiped anytime
Your toolsBestNav relayCursor / Cline / Claude Codeone URL + one keyTier 1 · subscriptionTier 2 · low-cost APITier 3 · free channelTier 4 · local fallbackOpenAI / Anthropicfall through on failure
Diagram: tools see one entry point; the relay queues four tiers — subscription, low-cost, free, local — and falls to the next when a call fails.

It is not magic: the relay is a receptionist running on your own NAS. It does not rewrite your prompt and never asks a model on your behalf — it only decides who to hand the request to, when to hand it to the next one, and how to write it down.

The nine screens, one question each

Once inside the relay, the left rail lists all nine screens. Their order is the order you use them in: get connected first (Advanced → Providers), then watch what is happening (Dashboard → Account health → Usage details), then reconcile and tune (Statements → Settings).

ScreenWhat it answers
DashboardIs anything reachable right now, and how much money is left — total first, then per vendor
AdvancedWhere the endpoint and token are, how the four tiers are ordered, when each quota window resets
ProvidersWhich vendors you hold accounts with — add, edit, pause them one by one
Account healthWhat state each one is in, and when the failing ones come back
Usage detailsWhat just happened (by month / by day / by model / request log)
Relay guideThe in-panel quick start — no browser needed
Remote accessHow to reach it safely from outside (Tailscale / Cloudflare Tunnel)
StatementsWhat did this week / month / quarter / year cost
SettingsEvery switch: detection, tokens, budget, prices, cache, ledger, purge

Three steps to your first call

Prerequisite: at least one working account under Providers — paste an API key yourself, or pick a vendor from the official catalog. With nothing configured the relay has nothing to route to.

  • 1. Open Advanced and check the four-tier route stack, already ordered from your accounts
  • 2. Click Generate token on the same page to get a relay key plus an endpoint like https://your-domain/api/llm/relay
  • 3. Paste both into your tool (ready-made snippets below) and restart it
  • 4. Back on the dashboard: the live route log scrolls with your requests, and the Connected CLI tools card shows which tools already point here

The token is shown once. Lost it? Click Rotate — the old key dies immediately and you get a fresh one.

API admin dashboard screenshot
Diagram: once the token is issued, the API admin dashboard shows relay usage, balance trends and provider share, with 7 / 30 / 90 day windows on the right.

How to fill it into common tools

Every tool asks for the same three values: base URL, API key, model name. Always use https://your-domain/api/llm/relay and the key from the panel.

Bash# Cursor / Cline / Continue — any OpenAI-compatible tool OPENAI_BASE_URL=https://your-domain/api/llm/relay OPENAI_API_KEY=<relay token from the panel> # Smoke test from the shell curl https://your-domain/api/llm/relay/v1/chat/completions \ -H "Authorization: Bearer <relay token>" \ -H "Content-Type: application/json" \ -d '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"hi"}]}'
  • Do not add a trailing slash, and do not append /v1 yourself — tools add it
  • URL too long to type? The Connected CLI tools card on the dashboard has a one-click copy row
  • Which model name? The relay supports standard model discovery (GET /v1/models) — most clients pull the model list themselves once pointed at the endpoint; you can also copy names from the per-provider list under Advanced → Available models
  • A wrong name comes back as “model unavailable” instead of silently switching
  • Toggling a tool on under Advanced → Connected CLI tools only feeds the list and the stats; it is not required for requests to work
  • Anthropic-protocol tools such as Claude Code connect directly too — they append /v1/messages to the same endpoint. Anthropic-family upstreams are passed through untouched (stream included); when only OpenAI-family upstreams remain the panel converts both directions and fails loudly instead of silently dropping fields

Providers: adding an account

Home for every account you hold, split three ways by credential source: API keys / free tiers / local inference. Each group has its own test-all button.

  • Manual: “Add OpenAI-compatible” or “Add Anthropic-compatible”, then fill name, base URL, key and model
  • From the catalog: search the official catalog, pick a vendor — endpoint and default model are prefilled, you only paste the key
  • Each card shows: health badge, last auto-probe error code (AUTH / 429 / 5XX), latency, and when it last failed
  • Three buttons per card: pause / resume, edit, delete; in the default order you can drag a card to change priority
  • Clicking a card opens its detail: model list, per-model connectivity test, set as default, disable models you do not use
  • Cannot find it? Use the search box, or the status filter beside it (all / healthy / failing / not configured)

Test-all only hits each vendor’s model-list endpoint — no tokens are consumed, so it cannot cost you anything.

Account health: who is alive, who is cooling

The check-up table: one row per account, with quota windows unfolded at the end of the row so you never have to click in.

  • Five counters up top: available / cooling / quota exhausted / manually paused / idle
  • The priority is fixed: manually paused > quota exhausted > cooling > available > idle — something you paused yourself always reads “paused”
  • Each row shows health, balance, availability with latency, and the quota window; pause or edit straight from the row
  • At most three quota windows are shown at once; “N more windows” expands the rest
  • A dash “—” means the upstream reported nothing remaining: unknown, not zero, and not used up

States come from a probe every five minutes plus real request failures. The probe only reads the model list — it costs nothing.

Dashboard: total first, then per vendor

The landing screen. Four cards on top are the health check (reachable count, total balance, P95 latency, availability); below them is what flows through the relay endpoint plus the live log. It ships switched off — enable Settings → Detection & stats → Usage stats and snapshots start accruing.

MetricWhat it tells youCaveat
Average availability / P95 latencyWhat share of upstream calls succeeded over the window, and how slow the slowest 5% wereChoose a 7 / 30 / 90 / 180 / 365 day window; more samples read steadier
Average daily spendMean cost per day from recent real usageSwings widely when usage is bursty
Estimated days leftCurrent balance divided by daily averageA nudge, not a billing forecast — it drifts as habits change
Total and per-currency balanceEvery vendor that reported a balance, summed per currency, followed by each vendor’s own balance listed one by oneShown in original currency with no FX conversion; a vendor missing from the list simply did not report — unknown, not zero
Low-balance alertFlags the dashboard and sends a notification below your thresholdOnly fires if you set a budget or balance threshold

Dashboard history starts the moment you enable it — nothing is backfilled. Balance figures come from the providers and are for trend watching, not invoicing. To see what one vendor has left, read the per-vendor list under the total rather than guessing from the total.

How “fall over to the next account” decides

  • Quota window exhausted → next tier, and the panel marks it cooling
  • Upstream 429 → next tier, your session keeps running
  • Upstream down or timed out → next tier; only after all four fail does your tool see the error
  • Session stickiness: one conversation stays on the same account where possible, so earlier context is not invalidated mid-thread

You can see which tier is serving right now and every cooling countdown under Advanced — no guesswork required.

Token savings (RTK) and the ledger

Coding tools burn money on bulky repeated output (a whole directory tree, for example). With RTK on, the panel compresses that output before sending it upstream and reports the tokens saved.

  • Switch: Advanced → RTK metering → aggressive compression (gentle by default)
  • Live route log: the dashboard lists the most recent requests — which tier took it, which account, which model, success or failure — refreshed every 5 seconds
  • Ledger: time, account, model, tokens, estimated cost, latency, status code — per request
  • Retention and export: the ledger keeps the last 300 rows by default (50–20,000 under Settings → Ledger), and the same row exports a detail CSV or a daily CSV
  • Custom prices: the built-in preset is a snapshot of each vendor list prices (as of 2026-10-20, standard tier / short context) — for models it lacks, or after a price change, fill input/output/cache-read/cache-write and pick CNY or USD under Settings → Price overrides; yours win, and no FX conversion is applied
  • Many accounts per tier: Settings → Intra-tier strategy picks round-robin / by weight / least-used (cooling accounts always go last)
  • Quota: when each account’s window resets, as a live countdown
  • Privacy exit: one button wipes the ledger and quota history

Cost is an estimate from public unit prices times real tokens — good for trends, not for invoicing.

Two cache switches (both in Settings, both off by default)

Caching is where the money is saved here, but the two switches do different jobs — do not mix them up.

  • Anthropic cache breakpoints: only touches Anthropic-native upstreams (/v1/messages). Once on, a cache_control breakpoint is added at the end of system and on the last user message, and cache reads bill at 0.1× — biggest win for long system prompts and long threads
  • That does rewrite the request body, but only on the Anthropic-native path; every other channel passes through untouched, and it is idempotent — a breakpoint you already set is never doubled
  • Exact cache: an identical request (same BestNav account, same path, same body) replays the previous response within the TTL instead of going upstream; 300s by default, 30–86,400s configurable
  • Only non-streaming successful responses are cached; streaming and failures never are
  • A replay still writes a ledger row (type = cache), visible in the CSV export — nothing happens off the books

Both default to off. Exact cache keeps requests and responses in the server process memory (cleared on restart) — skip it on shared machines or when content must not persist.

Statements: reconcile by week, month, quarter or year

A "last 7 days" window counts backwards from today — it answers "has it been busy", not "what did March cost". So reconciliation lives in its own Statements view: pick a granularity (week / month / quarter / year), then pick the period, and only that period is counted.

GranularityHow it is cutWhat it answers
WeeklyISO weeks starting Monday (a year-straddling week belongs to the year holding its Thursday)Did this week burn more than last week
MonthlyCalendar month, 1st to month endMonth-end reconciliation, the number you show your boss
QuarterlyCalendar quarters (Jan–Mar / Apr–Jun / Jul–Sep / Oct–Dec)Where the quarterly budget stands
YearlyCalendar yearFull-year totals and review

Where the numbers come from: Statements read the daily rollup — every metered call also accumulates into its day, so requests, tokens and cost are full-period totals, not a sample of "the latest N rows". Amounts are listed per currency (e.g. $1.25 · ¥8.00): no exchange-rate conversion, and two currencies are never summed into one figure. The by-provider column is meant to be reconciled against what each vendor says it actually spent.

Retention: daily rollups keep 400 days (a little over a year); per-request detail keeps rows (default 300, configurable to 50–20000 under Settings → Ledger). If a period starts before the retention floor the view flags it as incomplete — do not treat it as a full period. Need long history? Export the daily CSV first.

To reclaim space deliberately: Settings → Ledger → "Purge older than N days". Enter a number, confirm, and it removes the per-request entries and the daily rows for those days together, then reclaims disk space (SQLite does not shrink on DELETE, so a purge runs one reclamation pass).

  • Purging cannot be undone — export both the ledger CSV and the daily CSV before you do it
  • A purged period shows up as incomplete or disappears from Statements; that is missing data, not missing statistics
  • If the database merely feels big and you do not want to lose history, lowering the retention row cap is safer — it only affects per-request detail, never the daily rollup

Upstream health probe: know a vendor is down before a request does

Every 5 minutes the panel sends a tiny probe to each upstream (the model-list endpoint only) and records the result as a status band, so you can see it in the account pool and under Advanced without waiting for a real request to fail.

  • Probes do not use your business channel and consume no tokens, so they cannot generate charges
  • Five status bands: available, cooling (rate limited or upstream fault), quota exhausted, manually disabled, idle (not yet probed)
  • Cooling accounts show a countdown in the tier list, so you never have to guess
  • Advanced → Available models lists names verified reachable, each one click to copy
  • Manual disable is for maintenance: disabled accounts stop routing and are not auto-restored by the probe

The probe only tells you something is probably unreachable. Actual failover still keys on the four real signals: quota, rate limit, fault and timeout.

The Settings page: what each control actually does

  • Tokens: create / name / cap (token quota, request quota, per-minute limit) / model allow-list / expiry, revocable anytime
  • Budget breaker: daily and monthly ceilings per currency; once exceeded nothing goes upstream (currencies are never summed together)
  • Global aliases: give a tool a short name that routes to a real model — change the upstream in one place only
  • Price overrides: add unit prices (and the billing currency, CNY or USD — no FX conversion) for models the built-in preset lacks; beyond input and output you can set cache read, cache write (including the 1 h tier), per-call price, off-peak half pricing and long-context bands, plus a markup multiplier for resellers
  • Anthropic cache breakpoints / exact cache: see the previous section; both off by default
  • Ledger: retention count and the two CSV exports
  • Intra-tier strategy: how traffic is split across accounts in the same tier

Settings only holds things you can change; read-only observations such as upstream health and available models live under Advanced.

Remote access: using it from outside

This page answers “how do I get in”. It does not change the egress IP your upstream sees — upstreams still see the network your server sits on.

  • Tailscale: once the mesh is up, reach the panel and the relay endpoint on their LAN addresses — smallest change of all
  • Cloudflare Tunnel: if you own a domain, point a tunnel at the panel port; no router holes required
  • The page only shows “configured / not configured”; verify real reachability yourself once
  • The moment it is reachable from the internet, add HTTPS and access control; if a token may have leaked, rotate first

The relay endpoint is rate limited to 120 req/min by default: your own gateway, not a shared egress.

Safety notes

  • The relay key is a credential for your panel. Exposing it over the public internet without HTTPS is the same as hanging your keys on the gate
  • LAN only? Do not port-forward. Need remote access? Add a domain, a certificate and access control
  • Rotate anytime: the old key dies immediately, then read the ledger for anything odd
  • Your upstream API keys are never stored in plaintext where they can be casually read, including in exports
  • Built-in and WebDAV backups carry the relay configuration, issued tokens and a consistent snapshot of the ledger, so tokens survive a reinstall
  • The relay endpoint is rate limited (120 req/min by default) — it is a personal gateway, not a company-wide one

FAQ

  • 401? Wrong or rotated token — copy a fresh one (watch for a trailing space)
  • “Model unavailable”? That model is not in any tier’s list; pick another name or re-check the providers in the panel
  • Tool cannot connect? Make sure the tool and the panel are on the same network (a LAN address is unreachable from the internet)
  • Streaming cut off? The relay already relaxes write deadlines for long answers (10 minutes); if it still breaks, check your own reverse proxy — Nginx needs proxy_buffering off
  • Can I keep no records? Yes — the panel exposes a wipe-ledger-and-quota action

Reading a subscription window: upstream vs local estimate

Every window in the Quota card has its own countdown; when it runs out the request moves to the next channel — nothing to do by hand.

  • Upstream value: the remaining amount the provider reports in response headers. Most trustworthy; no header means no number
  • Local estimate: the limit you entered plus what this server counted from requests actually sent — not confirmed upstream, so it is tagged “local estimate”
  • A dash “—” means the upstream did not report a remaining amount: unknown, not zero, and not “used up”
  • Once exhausted we retry at most 6 hours later, so a channel is never locked out for long
  • If it says the limit may be too small: the local count hit the cap while the channel kept answering — adjust the limit to your real plan

Quota breaker vs budget breaker

They look similar but judge different things:

  • Budget breaker (daily/monthly limits) looks at money spent, per currency, no FX conversion
  • Quota breaker looks at how much a single window has left — a window can be used up without spending anything
  • Either one sends the request to the next channel; both at once means “no candidate is available”

We only change our own books: resetting a local window clears this server’s estimate, and recording a reset credit is bookkeeping only — neither redeems quota from the provider.

One requestQuota window used up?Budget ceiling hit?Another channel left?Fall through to the nextFail with a clear errorspend stays recordedso you know all ran out
Diagram: the two breakers decide independently; either one hands the request to the next channel, and only when nothing is left does your tool see an error.