<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>Cost Calculation on KnightLi Blog</title>
        <link>https://knightli.com/en/tags/cost-calculation/</link>
        <description>Recent content in Cost Calculation on KnightLi Blog</description>
        <generator>Hugo -- gohugo.io</generator>
        <language>en</language>
        <lastBuildDate>Sat, 11 Jul 2026 10:30:00 +0800</lastBuildDate><atom:link href="https://knightli.com/en/tags/cost-calculation/index.xml" rel="self" type="application/rss+xml" /><item>
        <title>How to calculate the cost of running Agent on a consumer-grade graphics card: electricity bill, depreciation and cost per task</title>
        <link>https://knightli.com/en/2026/07/11/consumer-gpu-agent-cost-electricity-depreciation-guide/</link>
        <pubDate>Sat, 11 Jul 2026 10:30:00 +0800</pubDate>
        
        <guid>https://knightli.com/en/2026/07/11/consumer-gpu-agent-cost-electricity-depreciation-guide/</guid>
        <description>&lt;p&gt;If you want to know whether a consumer-grade graphics card is worth running a local agent, you can&amp;rsquo;t just look at &amp;ldquo;how much the graphics card cost&amp;rdquo;, nor can you just compare the unit price per million tokens of the API. Agents will repeatedly call models, tools, and browsers; long contexts, failed retries, and idle standby will all change the actual cost.&lt;/p&gt;
&lt;p&gt;The most practical way is to split the cost into four items: electricity, hardware depreciation, supporting equipment and manual maintenance, and then calculate it according to &amp;ldquo;each successful task&amp;rdquo; and &amp;ldquo;per million output tokens&amp;rdquo; at the same time.&lt;/p&gt;
&lt;h2 id=&#34;first-determine-which-costs-you-want-to-calculate&#34;&gt;First determine which costs you want to calculate
&lt;/h2&gt;&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;caliber&lt;/th&gt;
          &lt;th&gt;Questions suitable to be answered&lt;/th&gt;
          &lt;th&gt;Items that are easily missed&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;incremental cost&lt;/td&gt;
          &lt;td&gt;I already have a game console. How much does it cost to run Agent in my spare time?&lt;/td&gt;
          &lt;td&gt;The graphics card is already there, is it included in the depreciation?&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;full cost&lt;/td&gt;
          &lt;td&gt;Is it cost-effective to purchase a machine specifically for local agents?&lt;/td&gt;
          &lt;td&gt;Host, memory, SSD, cooling and depreciation&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Cost per task&lt;/td&gt;
          &lt;td&gt;How much does it cost to automate a document and a code task?&lt;/td&gt;
          &lt;td&gt;Failure, retry, and manual review&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;throughput cost&lt;/td&gt;
          &lt;td&gt;What is the cost per million tokens to build a self-built inference service?&lt;/td&gt;
          &lt;td&gt;Enter token, KV cache and idle time&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;If the graphics card was originally used for gaming or other work, it would be more honest to calculate the incremental cost first; only when the entire machine is purchased for Agent, the depreciation of the entire machine is fully included.&lt;/p&gt;
&lt;h2 id=&#34;total-monthly-cost-formula&#34;&gt;Total monthly cost formula
&lt;/h2&gt;&lt;p&gt;Let’s use monthly caliber first, the data is easiest to obtain:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;6
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;月度总成本 = 电费 + 硬件月折旧 + 配套服务费 + 人工维护成本
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;电费 = 实测整机平均功耗(kW) × 实际运行小时数 × 电价(元/kWh)
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;硬件月折旧 = (购入总价 - 预估残值) ÷ 使用月数
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;单次成功任务成本 = 月度总成本 ÷ 月成功任务数
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;每百万输出 token 成本 = 月度总成本 ÷ 月输出 token 数 × 1,000,000
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;The &amp;ldquo;average power consumption of the entire machine&amp;rdquo; should come from a socket power meter or UPS as much as possible, rather than just looking at the graphics card&amp;rsquo;s nominal TBP. The Agent also runs with CPU, memory, SSD, fans, and monitors; using only GPU power consumption will underestimate the electricity bill. Conversely, periods when the machine is on standby but not processing tasks should not be mixed into pure inference costs and is best recorded separately.&lt;/p&gt;
&lt;h2 id=&#34;an-example-of-replaceable-parameters&#34;&gt;An example of replaceable parameters
&lt;/h2&gt;&lt;p&gt;Assume that a machine has a measured average power consumption of 280W under the actual Agent workload, runs 6 hours a day, and 30 days a month; the local electricity price is calculated as 0.8 yuan/kWh. The hardware purchased specifically for this purpose is amortized over 7,000 yuan, 36 months, and the residual value is ignored.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;3
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;电费 = 0.28 × 6 × 30 × 0.8 = 40.32 元/月
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;硬件折旧 = 7,000 ÷ 36 = 194.44 元/月
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;月度基础成本 = 234.76 元/月
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;If 600 accepted tasks are completed this month, the basic cost will be approximately 0.39 yuan/task. The &amp;ldquo;completion&amp;rdquo; here cannot only be counted as model return; it should be based on business results such as successful script execution, work order closing, and manual inspection passing.&lt;/p&gt;
&lt;p&gt;This is just an example calculation, not a universal price. It only makes sense to replace power consumption, usage time, electricity price, purchase amount and task volume with your own data.&lt;/p&gt;
&lt;h2 id=&#34;why-is-agent-more-difficult-to-estimate-than-regular-chat&#34;&gt;Why is Agent more difficult to estimate than regular chat?
&lt;/h2&gt;&lt;p&gt;Chat models are often billed by token, and the cost of Agent is also affected by the execution path:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A task may include planning, retrieval, calling tools, reading results, and multiple rounds of corrections.&lt;/li&gt;
&lt;li&gt;The longer the context, the more KV cache is occupied; when there is insufficient video memory, it will slow down, unload the CPU/RAM, and even trigger retries.&lt;/li&gt;
&lt;li&gt;Browser automation, code testing, and file processing can stretch task times even if the GPU is not constantly fully loaded.&lt;/li&gt;
&lt;li&gt;Multi-Agent parallelization will increase throughput, but may also increase memory contention, queuing, and failure rates.&lt;/li&gt;
&lt;li&gt;In order to reduce the first token delay, resident model will increase idle power consumption.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Therefore, do not use the tokens/s of a short question and answer to represent the Agent cost. Select at least a set of real tasks, run them continuously for a week, and record input/output tokens, success rate, number of retries, wall clock time, and overall machine power consumption.&lt;/p&gt;
&lt;h2 id=&#34;two-units-that-must-be-seen-at-the-same-time&#34;&gt;Two units that must be seen at the same time
&lt;/h2&gt;&lt;h3 id=&#34;every-successful-task&#34;&gt;every successful task
&lt;/h3&gt;&lt;p&gt;This is closest to business decisions. It is suitable for comparing fixed processes such as &amp;ldquo;local agent automatically processes PR&amp;rdquo;, &amp;ldquo;batch data collection&amp;rdquo;, &amp;ldquo;customer service draft generation&amp;rdquo;, etc.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;每个成功任务成本 = (本周期全部成本) ÷ 成功且验收通过的任务数
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;Failed tasks cannot be deleted from the numerator. The power, inference time, and manual troubleshooting they consume are the true operating costs of local systems.&lt;/p&gt;
&lt;h3 id=&#34;per-million-tokens&#34;&gt;per million tokens
&lt;/h3&gt;&lt;p&gt;This is suitable for comparing on-premises inference services and cloud APIs, but distinguishing between inputs and outputs. The input of many agents includes long tool logs and historical context, and the input tokens are much more than the output tokens; if divided by the output tokens only, the number will be high. A more reliable approach is to record input, output and total tokens at the same time, and maintain the same statistical caliber.&lt;/p&gt;
&lt;h2 id=&#34;how-to-collect-your-own-data&#34;&gt;How to collect your own data
&lt;/h2&gt;&lt;p&gt;There is no need to build a complex monitoring system from the beginning. First create a table and record the following fields for each run:&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Field&lt;/th&gt;
          &lt;th&gt;Recording method&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;start and end time&lt;/td&gt;
          &lt;td&gt;Agent log or task queue&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Whole machine power consumption&lt;/td&gt;
          &lt;td&gt;Smart outlet, power meter or UPS&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;input/output token&lt;/td&gt;
          &lt;td&gt;Inference service logs or client statistics&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Success, failure, retry&lt;/td&gt;
          &lt;td&gt;Task status and error log&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Manual review time&lt;/td&gt;
          &lt;td&gt;Work order, PR or random inspection record&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Model and quantified version&lt;/td&gt;
          &lt;td&gt;Avoid mixing different models in the same set of data&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Start with 20 to 50 representative tasks as a baseline. Then, tasks with short contexts, long contexts, many tool calls, and many retries are tested separately to see the impact of memory and model selection on costs. Video memory planning can be judged in conjunction with &lt;a class=&#34;link&#34; href=&#34;https://knightli.com/en/2026/07/11/rtx-3060-qwen3-best-quantization-guide/&#34; &gt;Local Model Quantification and Video Memory Selection&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;how-to-calculate-depreciation-so-as-not-to-mislead-yourself&#34;&gt;How to calculate depreciation so as not to mislead yourself
&lt;/h2&gt;&lt;p&gt;There is no one answer to depreciation, but the assumptions must be written down first.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Existing graphics card: You can only calculate the electricity bill and additional maintenance as incremental costs; you can also set an opportunity cost for the graphics card as a more conservative full cost.&lt;/li&gt;
&lt;li&gt;New equipment purchased: Graphics card, host, memory, SSD, and radiator should be included together; don’t just spread the price of the graphics card.&lt;/li&gt;
&lt;li&gt;Lifespan: 24, 36 or 48 months will work, the key is comparing on-premises vs. cloud using the same assumptions.&lt;/li&gt;
&lt;li&gt;Residual value: When the equipment is expected to be resold, the estimated residual value can be deducted from the purchase price; if it is uncertain, set it to 0, and the conclusion is more conservative.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;NAS or small hosts usually consume less power, but memory, cooling, and expansion capabilities also limit models and concurrency. If you consider this route, you can first read &lt;a class=&#34;link&#34; href=&#34;https://knightli.com/en/2026/07/11/nas-ollama-performance-cpu-memory-gpu-guide/&#34; &gt;Performance Judgment of NAS Deployment Ollama&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;when-comparing-to-cloud-apis-dont-just-compare-unit-price&#34;&gt;When comparing to cloud APIs, don’t just compare unit price
&lt;/h2&gt;&lt;p&gt;The cloud side can also be converted into cost per task:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;云端每任务成本 = 模型 API 费用 + 工具/API 费用 + 必要的存储与网络费用 + 人工复核成本
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;Local is usually better suited for these situations:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;There is a stable and predictable workload every day, and machine utilization is high.&lt;/li&gt;
&lt;li&gt;Data cannot or is not expected to be sent to external services.&lt;/li&gt;
&lt;li&gt;Already have a working GPU, the incremental cost is mainly electricity.&lt;/li&gt;
&lt;li&gt;Self-maintainable models, drivers, service and crash recovery are acceptable.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The cloud is often better suited for these situations:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The load is sporadic and the machine will be idle most of the time.&lt;/li&gt;
&lt;li&gt;Tasks require large models, very long contexts, or peak concurrency that far exceed local video memory.&lt;/li&gt;
&lt;li&gt;The team is unwilling to take on the driver, model upgrades, monitoring and troubleshooting.&lt;/li&gt;
&lt;li&gt;The task results are of high value, and the strongest model or multi-modal capabilities are required first.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Local deployment is not just a choice between two options. Stable, privacy-sensitive steps are placed locally; complex, low-frequency steps or steps that require stronger models are called to the cloud, which is often easier to control the total cost.&lt;/p&gt;
&lt;h2 id=&#34;a-practical-decision-line&#34;&gt;A practical decision line
&lt;/h2&gt;&lt;p&gt;Record the local monthly fixed cost as &lt;code&gt;F&lt;/code&gt;, the variable power and maintenance costs per task as &lt;code&gt;v&lt;/code&gt;, and the cloud per-task cost as &lt;code&gt;c&lt;/code&gt;. When &lt;code&gt;c &amp;gt; v&lt;/code&gt;, the approximate amount of tasks required to achieve local breakeven is:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;每月盈亏平衡任务数 = F ÷ (c - v)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;If &lt;code&gt;c&lt;/code&gt; is less than or close to &lt;code&gt;v&lt;/code&gt;, local will not be significantly cheaper due to scale; privacy, latency, controllability, and offline capabilities should be considered more at this time. This formula is only a financial filter and still requires failure rates and manual review time.&lt;/p&gt;
&lt;h2 id=&#34;common-misunderstandings&#34;&gt;Common misunderstandings
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Only look at the power consumption of the graphics card&lt;/strong&gt;: The power, standby and cooling of the entire machine also need to be paid.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Think of nominal tokens/s as throughput&lt;/strong&gt;: Real agents will be slowed down by context, tools, network, and test steps.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Ignore failed tasks&lt;/strong&gt;: The process that is retried most frequently is often a cost black hole.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Only model charges are calculated&lt;/strong&gt;: Browser, search, vector library, storage and human review charges may also apply.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Mixing data from different models&lt;/strong&gt;: The quantization version, context length, and concurrency are different, and the results cannot be compared horizontally.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;summarize&#34;&gt;Summarize
&lt;/h2&gt;&lt;p&gt;The cost of running Agent on a consumer-grade graphics card should not just be answered by &amp;ldquo;a few kilowatt-hours of electricity per hour.&amp;rdquo; First use the measured power consumption of the entire machine to calculate the electricity cost, then add the hardware cost according to your own depreciation assumptions, and finally use the number of successful tasks and the amount of tokens to amortize it. After continuously recording a period of real workload, you can clearly judge whether to continue running locally, expand the video memory, or hand over some steps to the cloud API.&lt;/p&gt;
</description>
        </item>
        
    </channel>
</rss>
