Start with the monthly saving先算每月能省多少钱

You already pay an API provider to run a model. Buying servers changes the bill: you pay for hardware now, then electricity, operations and any API traffic the servers cannot handle. The decision is whether those future savings can repay the purchase before the equipment stops being useful.你现在每月付钱调用模型 API。如果改成买机器自己跑,就要先付设备款,以后再付电费、运维费,以及机器处理不了时的 API 费。要判断的事情很具体:以后每月省下来的钱,能不能在设备失去使用价值之前,把买机器的钱挣回来。

Compare the same completed work at acceptable quality and latency. Then write down three amounts: the upfront investment I, the monthly all-API bill A, and the complete monthly cost of the local route L. The monthly saving is S:先保证两种方案能以合格的质量和速度,完成同样的工作。然后记下三个数:一次性投入 I、全部使用 API 的月账单 A、改成本地方案后的完整月运行费用 L。每月省下的钱就是 S:

L includes local operations and fallback API charges. Hardware bought at the start belongs in I; do not also charge its depreciation as a monthly cash payment. If S stays at or below zero, running locally will not recover the hardware outlay through operating savings. If S is positive, the next question is how long that saving lasts.L 要包含本地运行费和回退 API 费。开始时买设备的钱计入 I,不要再把折旧当成每月真实付款重复扣除。如果 S 一直不大于零,本地运行就无法靠省下的账单收回设备款;如果 S 为正,还要看这笔节省能持续多久。

First, calculate the API bill from tokens先用 token 算出 API 账单

A total token count is not enough to price a workload: ordinary input, cached input and output can have different rates. To see the difference, assume prices of CNY 2, 0.5 and 8 per million tokens, respectively. These are illustrative rates, not a provider quote. Hold monthly input plus output at 100 million tokens, then change their proportions.知道总共用了多少 token,还不能直接得到账单:普通输入、缓存输入和输出的单价可能不同。先假设三者每百万 token 分别收费 2 元、0.5 元和 8 元。这些是便于计算的假设单价,不是供应商报价。下面固定每月输入加输出共 1 亿 token,只改变两者比例。

Take 90 million input tokens and 10 million output tokens. With no cache hits, the bill is CNY 260. If 80% of the input hits the cache, 72 million input tokens use the cached rate and the remaining 18 million use the ordinary rate. Output is still 10 million tokens, so the bill falls to CNY 152:先算一组:9,000 万输入、1,000 万输出。没有缓存命中时,账单是 260 元。如果输入中有 80% 命中缓存,就是 7,200 万按缓存价计费,剩下 1,800 万按普通输入价计费;输出仍是 1,000 万,账单降为 152 元:

The same token total can produce different bills同样的 token 总量,账单也会不同

Teaching total教学总量100Mtokens

Illustrative prices, not a provider quote. M = one million tokens.以下是教学假设单价,不是供应商报价。M 表示百万 token。

Prices per million tokens每百万 token 单价CNY
Ordinary input普通输入
2
Cached input缓存输入
0.5
Output输出
8
Ordinary input cost普通输入费用Cached input cost缓存输入费用Output cost输出费用
0CNY 800
90% input · 10% output90% 输入 · 10% 输出90M input + 10M output90M 输入+10M 输出
0% input cached输入缓存 0%CNY 260
80% input cached · 72M输入缓存 80% · 72MCNY 152
50% input · 50% output50% 输入 · 50% 输出50M input + 50M output50M 输入+50M 输出
0% input cached输入缓存 0%CNY 500
80% input cached · 40M输入缓存 80% · 40MCNY 440
10% input · 90% output10% 输入 · 90% 输出10M input + 90M output10M 输入+90M 输出
0% input cached输入缓存 0%CNY 740
80% input cached · 8M输入缓存 80% · 8MCNY 728

Every bar starts at zero and uses the same money scale. Cache percentages refer only to input tokens.所有横条从零起算,共用金额标尺;缓存比例只针对输入 token。

API bills only. Equal token totals do not mean equal tasks or quality; these are not local-deployment costs.这里只比较 API 账单。相同 token 总量不代表相同任务或质量,也不代表本地部署成本。

At the same 100-million-token total, the uncached bills are CNY 260, 500 and 740. With 80% input-cache hits they become CNY 152, 440 and 728. In this example, output is four times the ordinary input price: output-heavy usage costs more, and input caching has little room to help it. An input-heavy document analysis and an output-heavy generation job may resemble these mixes, but equal token totals do not mean equal work or quality.同样是 1 亿 token,无缓存时三种账单分别为 260、500、740 元;输入缓存命中 80% 后,分别为 152、440、728 元。这组单价里,输出是普通输入的四倍,因此输出越多,账单越高,输入缓存能省下的部分也越少。长文档分析可能偏重输入,长内容生成可能偏重输出;但相同 token 总量并不代表完成了相同工作,也不代表相同质量。

Follow one purchase through the numbers用一笔账看懂回本、ROI 和 NPV

Keep those illustrative prices and consider a larger monthly workload: 3 billion input tokens and 750 million output tokens, with no cache hits. The API bill is 3,000 × 2 + 750 × 8 = CNY 12,000. This supplies A in the investment calculation.沿用这组假设单价,把月用量扩大到30 亿输入、7.5 亿输出,缓存命中为零。API 账单就是 3,000 × 2 + 750 × 8 = 12,000 元。这样,投资计算里的 A 就有了来处。

Now assume an upfront purchase and setup cost of CNY 100,000, and CNY 5,000 a month in local operating costs including fallback, while completing that same work at acceptable quality and latency. Use a 36-month horizon, constant monthly costs, month-end settlement and no resale proceeds. These are teaching assumptions, not a hardware quote or a measured capacity claim. Token billing alone does not establish how much local hardware the workload needs.再假设买设备并上线共花 10 万元,能够以合格的质量和速度完成同一批工作,电费、运维和回退 API 合计每月 5,000 元。计划使用 36 个月,期间费用不变,均在月末结算,期末不计卖设备的钱。这是一组教学假设,不是设备报价,也不证明某台机器能承接上述负载。仅靠 token 账单,还不能推出本地需要多少硬件。

A · API bill per monthA · 每月 API 账单
¥12,000
L · Local route per monthL · 本地方案月运行费
¥5,000
S · Saving per monthS · 每月节省
¥7,000
Over 36 months: API CNY 432,000; local operations plus purchase CNY 280,000. Net saving: CNY 152,000.36 个月全部用 API 花 43.2 万元;本地运行加初投共花 28 万元。最终少花 15.2 万元。

Payback: when does the CNY 100,000 come back?回本周期:多久挣回这 10 万元?

CNY 100,000 divided by CNY 7,000 is about 14.3 months. With savings received at month end, recovery occurs in month 15: after 14 months you are still CNY 2,000 short; after 15, you are CNY 5,000 ahead. If the hardware must be replaced in month 12, this purchase has not paid back by then.10 万元除以每月 7,000 元,约为 14.3 个月。按月末收到节省的现金,第 15 个月回本:第 14 个月还差 2,000 元,第 15 个月已经多出 5,000 元。如果设备第 12 个月就必须换掉,这笔采购在那之前还没有回本。

This shortcut requires a constant positive saving. When usage or prices change, add the actual monthly savings in order and find the first month that covers the outlay. A later return to a negative balance matters too.这个除法只适用于每月节省固定且为正的情况。用量或价格变化时,就逐月累加实际节省,找出第一次覆盖初投的月份;此后余额若再次转负,也要一并看见。

ROI: how much net saving does the investment produce?ROI:这笔投入最终多省下多少?

The CNY 100,000 investment produces CNY 152,000 of net saving over three years. That is a 36-month ROI of 152%, not a 152% annual return. ROI summarizes the total; it does not tell you when the money comes back.投入 10 万元,三年净省 15.2 万元,所以36 个月 ROI 为 152%,不是每年赚 152%。ROI 说明总回报有多少,但不会告诉你资金什么时候回来。

NPV: is the future saving worth the money paid today?NPV:未来省的钱,值得今天先付吗?

Money available today has other uses. Choose a discount rate that reflects the project’s funding and risk assumptions, then express each future saving in today’s money. With an assumed annual rate of 10%, the 36 monthly savings are worth about CNY 218,305 today. Subtract the CNY 100,000 purchase and the net present value is CNY 118,305.今天手里的钱还有别的用途。选定与项目资金成本、风险假设相匹配的折现率,把未来每笔节省折算成今天的钱。假设年折现率为 10%,这 36 笔月节省合计相当于今天的约 21.83 万元;扣掉今天付出的 10 万元,净现值 NPV 约为 11.83 万元。

Positive NPV means this purchase beats the all-API alternative under the chosen assumptions and discount rate. It does not establish that buying beats every rental offer. Use payback for the cash-recovery deadline, ROI for total return, and NPV for value after accounting for timing.NPV 为正,表示在这些假设和折现率下,这次购机比继续全部使用 API 更划算;它还不能证明购机胜过所有租赁报价。回本周期看资金要等多久,ROI 看总回报,NPV 看考虑时间之后是否仍值得投入。

Now use your own model and workload换成你的模型与账单

Choose a provider and model, then enter monthly input/output tokens, measured capacity, upfront cost and running cost. The calculator first compares the two monthly bills, then reports payback and investment returns. A model’s name supplies neither its hardware requirement nor its throughput.先选供应商和模型,再填月输入/输出 token、实测处理能力、设备投入和运行费。计算器先给出两种月账单,再算回本和投资回报。模型名称本身无法给出你的设备需要花多少钱、实际能跑多快。

  1. Get usage from a representative bill. Input and output are separate. The fields below use millions of tokens; 10 million tokens is entered as 10.从真实账单取用量。输入与输出分开填,下面统一用百万 token;1,000 万 token 填 10。
  2. Measure capacity for that workload. Both input and output rates must be achievable together at the required latency. Unserved work is charged to the fallback API.用这批工作测处理能力。输入和输出速率必须是在要求的延迟下能同时达到的值;处理不了的部分仍计 API 费用。
  3. Enter complete costs. All amounts are in the selected currency. Include installation in the upfront cost, and electricity, hosting, maintenance and additional labor in running costs.填完整成本。金额直接填写所选币种的数额。初投包含上线费用,运行费包含电费、托管、维护和新增人力。
Where the model prices come from模型与报价从哪里来

CC Switch’s pricing sync uses models.dev. This page uses the same public directory. Each choice retains both provider and model: the same model offered by different providers can have different prices. These are directory reference prices, not a fresh official quote.CC Switch 的价格同步使用 models.dev。这里接入同一个公开目录,选择项同时保留供应商与模型:同一个模型,在不同供应商那里可能有不同报价。这些是目录参考价,不代表刚向厂商确认的报价。

The imported list is limited to open-weight text models with billing that this worksheet can represent. Missing models or special contracts can be entered manually. Check context tiers, time discounts and separate tool or cache charges against the service you intend to buy.导入范围限于开放权重、文本输出且收费结构能被本计算器表达的条目;没收录的模型或特殊合同可以手填。决策前,按实际服务核对上下文档位、分时优惠,以及另计的工具或缓存费用。

The site refreshes the directory during publication; a failed refresh retains the last valid dated snapshot. Your inputs remain in this page. Changing currency clears money fields, and changing models clears old throughput measurements.站点发布时刷新目录,更新失败时保留上次有效快照及日期。你填写的参数留在页面本地。换币种会清空金额,换模型会清空旧吞吐数据。

Read the figures as a sequence of questions怎样从图里得到判断

Compare token mixes at your selected prices换成所选模型,比较不同用量组合

The bars reuse your monthly input-plus-output total and compare three mixes at 0% and 80% input-cache hits. With no usage entered, they show a clearly marked 100M reference. The table then compares 10M, 100M and 1,000M total tokens without cache hits. Model selection and price edits update both views; these controlled cases do not replace the workload you entered above.横条沿用你填写的每月输入与输出总量,比较三种配比在输入缓存命中 0% 和 80% 时的账单;没填用量时,明确显示 100M 参考量。表格再比较 10M、100M、1,000M 三档总量下的无缓存费用。切换模型或修改单价,两处都会更新;这些对照不会改动你上面填写的实际负载。

Choose a model to compare token costs.选择模型后,显示 token 成本对照。

Then check whether local deployment saves money再看本地部署能否省钱

The rate chart explains the API bill. The monthly-cost chart shows whether running locally saves money. The cumulative chart starts below zero by the purchase amount; its first crossing of zero is operating payback. The demand chart asks whether the decision survives lower usage, with the same hardware and costs.单价图解释 API 账单从哪里来;月成本图回答自己跑是否省钱;累计现金曲线从负的设备款开始,第一次越过零就是运营回本;需求图则看设备和成本不变时,用量下降会不会让投资变得不划算。

Select a model to see prices. Enter your workload and costs to see operating results.选择模型后显示单价;填入用量和成本后,显示运营结果。

What would change the decision?什么情况下应该改选方案

If monthly savings remain negative, keep the API route on cost grounds. Local deployment then costs more to operate before paying back any hardware. Privacy or offline requirements may still justify it, but that is a different reason to spend.如果每月节省持续为负,单从成本上应继续用 API。这意味着设备款还没开始回收,本地运行本身就更贵。隐私或离线要求仍可能使你必须自建,但那是另一项购买理由。

If monthly savings are positive but payback is too late, test rental or a smaller purchase. A 30-month payback is weak support for equipment you expect to replace after 18 months. Compare complete rental cost for the same service, not only the advertised GPU-hour price.如果每月省钱,但回本太晚,先比较租赁或缩小采购。预计 18 个月就要替换的设备,很难靠 30 个月的回本计划说服人。租赁也要比较同等服务的完整费用,不能只看宣传中的 GPU 小时单价。

If payback fits the useful life and NPV is positive, test the assumptions that could overturn it. Reduce demand, lower API prices and raise operating costs separately. If a small plausible change reverses the decision, a short paid trial is more useful than a large purchase.如果回本早于使用寿命,而且 NPV 为正,再检验它有多稳。分别降低需求、降低 API 单价、提高运行费。如果一个合理的小变化就会使结论翻转,先做小规模付费试验,比直接大额采购更有用。

For each candidate, save its own measured token volumes and throughput. Different tokenizers, reasoning lengths and retry rates can change the work billed. Change the model, remeasure the same tasks, then compare the resulting costs; a cheaper output-token price alone cannot pick the winner.每个候选模型都要保存自己的实测 token 用量和处理能力。tokenizer、思考长度、重试率不同,同样的工作也可能产生不同账单。换模型后重新跑同一批任务,再比较成本;仅凭输出 token 更便宜,选不出最优方案。

Calculation details需要复核时,再展开计算细节

How tokens become the API billtoken 怎样变成 API 账单

For each time period, let Nin and Nout be billed token counts; h is the cached-input fraction. The rates phit, pmiss and pout are per million tokens. Add the bills of all periods to get monthly A.每个时段的计费 token 数记为 Nin、Nout,输入缓存命中比例为 h;phit、pmiss、pout 是每百万 token 的价格。各时段费用相加,就是每月的 A。

Include repeated context and retries in billed usage, and count reasoning output once. With flat pricing, both period rates are identical. Missing cache prices do not mean free caching. Extra tool, audio or image charges need separate cash entries.计费用量包含重复上下文与重试,思考输出不能重复计算。不分时计费时,两组单价相同。缺少缓存单价不表示缓存免费;工具、音频或图像的额外费用需要另行计入现金流。

How capacity determines fallback API traffic怎样算机器处理不了、仍需付 API 费的部分

Let Δb be seconds in a time bucket, u its scheduling headroom factor, a availability, and qin/qout jointly measured token rates. For that bucket’s demand, the local fraction f is bounded by the first exhausted capacity:Δb 是一个时段的秒数,u 是扣除突发余量后可使用的比例,a 是可用率,qin/qout 是同时测得的 token 速率。本地承接比例 f 取决于哪项能力先用尽:

Route fraction f locally and 1−f to the API, keeping the input and output of the workload together. Ignore a ratio whose demand is zero. Multiply fallback tokens by their own cache-aware rates, then add that bill to local running costs to obtain L.其中 f 的负载由本地承担,1−f 回到 API,输入与输出按同一比例分流。需求为零的维度忽略对应比值。回退 token 按它们自己的缓存命中率计费,再加到本地运行费里,就得到 L。

This is a planning approximation with uniform arrivals inside each period and outages independent of demand. It does not simulate queues. Long-context routing or bursty traffic requires a workload replay; separate peak input and output benchmarks cannot be combined into one operating point. Do not deduct availability or headroom twice if measurements already include them.这是时段内均匀到达、停机与需求独立的规划近似,不模拟排队。长上下文分流或明显突发流量需要用真实负载重放验证;不能把分别测出的输入峰值、输出峰值拼在一起。实测已包含的可用率或余量,不再重复扣除。

Cash flows, growth and resale现金流变化、增长和期末卖设备的钱怎么处理

For T months, use St as each month’s saving and RT as net resale received at the end. Upfront investment is I. The calculator evaluates monthly cash at month end; r is the effective annual discount rate:评估 T 个月,第 t 个月实际节省为 St,期末净出售所得为 RT,初投为 I。计算器按月末现金流核算,r 为有效年折现率:

Operating payback is the first month with Bn ≥ 0, excluding resale. The cash chart adds resale as a separate end point. ROI is undefined when I is zero. Positive terminal resale may improve NPV without making operations profitable.运营回本是 Bn 首次不小于零的月份,不靠出售设备回本;现金图将出售所得单独画为期末点。I 为零时 ROI 不适用。出售设备可以改善 NPV,但不能把亏损运营变成盈利运营。

Annual growth is compounded by (t−1)/12 from month 1. Input and output usage can grow separately; API prices share one price-change rate, and local operating costs share one operating-cost rate. Capacity stays fixed. The calculator keeps workload on local hardware first; it does not optimize routing when the local marginal cost is higher.年变化率从首月起按 (t−1)/12 复合展开。输入、输出需求可以分别增长,API 单价共用一个价格变化率,本地运营费用共用一个成本变化率。处理能力固定,默认优先使用本地机器;本地边际成本更高时,计算器不会自动寻找更优调度。

This is an unfinanced project comparison. Irregular replacements, migration, differing tax payments or extra revenue need explicit dated cash flows. The cash-flow engine accepts a monthly series. Keep currency and pre-/post-tax assumptions consistent. Discounting follows standard lifecycle-cost reasoning; see NIST Handbook 135, chapters 5–6.这里比较不含融资的项目。不规则换机、迁移、差异税费或新增收入,需要按发生月份补入现金流;现金流引擎可以接收逐月序列。币种、税前或税后口径保持一致。折现思路可参见 NIST Handbook 135 第 5–6 章。

Which costs belong in the comparison?哪些成本容易漏算或重复算

The upfront amount includes accelerators, host memory, storage, networking, installation and migration that differ from the API route. Running costs include electricity, hosting, network service, maintenance and added labor. Electricity can start with average IT kW × hours × PUE × electricity price; do not add cooling again when the hosting bill already includes it.初投包含相对 API 方案新增的加速器、主机内存、存储、网络、安装和迁移。运行费包含电费、托管、网络、维护与新增人力。电费可以从“平均 IT 功率 × 小时数 × PUE × 电价”估算,托管已包含制冷时不要再算一遍。

Only costs identical across alternatives cancel. For rental, compare a complete service at the same quality, latency and availability. If data cannot leave your environment, all-API and public-API fallback are not feasible alternatives. For a later keep-or-sell decision, compare future cash and the sale proceeds forgone by holding; the old purchase is not a new payment.只有各方案完全相同的费用才能抵消。租赁要按相同质量、延迟和可用率比较完整服务。如果数据不能外发,全 API 和公网 API 回退就不是可行方案。设备买下后再决定留用还是出售,应比较未来现金与放弃的出售所得,历史购机款不能再当成一次新付款。

Keep the model/provider, price snapshot, measured workload, complete quote and exported calculation together. That makes the decision revisable when prices or usage change.把模型与供应商、价格快照、实测负载、完整报价和导出的计算结果放在一起。以后价格或用量变了,就能沿着同一笔账重新判断。