Cost Optimization Guide 成本优化指南

Cheap LLM API
The Cheapest Token Can Be an Expensive Result
便宜的 LLM API:最低 Token 单价不等于最低总成本

Model prices change frequently and rarely tell the full story. Compare exact endpoints on your workloads and calculate total cost per accepted output, including retries, failures, latency, engineering, platform fees and quality review.

模型价格经常变化,也很少能说明全部成本。应在自身负载上比较具体端点,并计算每个可接受输出的总成本,包括重试、失败、延迟、工程、平台费用与质量审核。

True cost laboratory calculating LLM API cost per accepted output across three workloads

TL;DR

Do not copy stale price tables

Use current official pricing and billing units on the day of evaluation; record model, endpoint, region, cache, reasoning and batch terms.

Benchmark quality first

A low-cost model that fails schema, tool or accuracy thresholds creates retries, review and customer cost.

Calculate accepted-result cost

Add input, output, reasoning, cache, retries, failed outputs, platform fees, latency impact and engineering effort, then divide by accepted results.

Route by workload

Extraction, support and agent tools have different quality and reliability thresholds; one cheapest model rarely wins all three.

不要复制过期价格表

评估当天使用官方最新价格与计费单位,并记录模型、端点、区域、缓存、推理与批处理条款。

先做质量基准

无法满足结构定义、工具或准确率阈值的低价模型会产生重试、审核与客户成本。

计算可接受结果成本

把输入、输出、推理、缓存、重试、失败输出、平台费、延迟影响与工程投入相加,再除以可接受结果数。

按工作负载路由

抽取、客服与智能体工具的质量和可靠性阈值不同;一个最低价模型很少能赢下全部。

Cheap access comes through four supply paths 低价访问有四种供给路径

Direct model APIs offer native features and pricing. Aggregators consolidate models and billing, sometimes with markup or credits. Hosted inference platforms expose open models through serverless or dedicated endpoints. Self-hosted inference trades provider margin for infrastructure and operations.

模型直连 API 提供原生功能与定价;聚合器整合模型与账单,有时存在加价或 Credits;托管推理平台通过无服务器或专属端点暴露开放模型;自托管推理用基础设施与运维换取供应商利润空间。

The cheapest path depends on utilization, endpoint quality, provider competition, committed spend, cache hit rate, batching, latency and engineering capacity. Verify official pricing rather than relying on fixed claims in an evergreen article.

最便宜路径取决于利用率、端点质量、供应商竞争、承诺支出、缓存命中、批处理、延迟与工程能力。应核对官方价格,不依赖常青文章中的固定数字。

Compare supply models, not a frozen price list 比较供给模式,而非冻结价格表

Supply path 供给路径 Best fit 最适合 Verify before choosing 选择前验证
Direct provider API 供应商直连 API Native features, direct support, clear provenance and existing commercial commitments. 原生功能、直接支持、清晰来源与既有商业承诺。 Compare regional availability, quotas, failover options, billing units and multi-provider engineering. 比较区域可用性、配额、回退选项、计费单位与多供应商工程。
Model aggregator 模型聚合器 One key, broad catalog, consolidated billing and provider competition for the same model. 一把密钥、广泛目录、统一账单与同模型供应商竞争。 Verify markup, credits, provider identity, privacy filters, parameter support and fallback charges. 验证加价、Credits、供应商身份、隐私过滤、参数支持与回退费用。
Hosted inference platform 托管推理平台 Serverless access or dedicated capacity for open and specialized models. 面向开放与专用模型的无服务器访问或专属容量。 Pin version and endpoint; model cold starts, capacity, quantization, support and idle cost. 固定版本与端点;验证冷启动、容量、量化、支持与闲置成本。
Self-hosted inference 自托管推理 High utilization, privacy, custom hardware or model control can justify owned serving. 高利用率、隐私、自定义硬件或模型控制可证明自有 Serving 合理。 Include GPUs, idle capacity, scaling, drivers, upgrades, observability, staffing and outage risk. 包含 GPU、闲置容量、扩缩、驱动、升级、可观测、人力与中断风险。
Gateway optimization 网关优化 Routing, cache, fallback, batching and model tiering reduce cost across existing supply. 路由、缓存、回退、批处理与模型分层可降低既有供给成本。 Avoid duplicate retries and opaque substitutions; reconcile gateway and provider bills. 避免重复重试与不透明替换,并核对网关与供应商账单。

The total-cost equation 总成本公式

Model usage

Input, output, reasoning, cache reads/writes, embeddings, images, audio, tools and batch units.

Failure and quality

Retries, timeouts, fallback calls, invalid schemas, rejected answers, human review, escalation and customer impact.

Platform and operations

Markup, subscriptions, credits, infrastructure, telemetry, storage, egress, support, engineering and incidents.

Accepted result

Define task-level acceptance before the benchmark: accuracy, schema, tool success, safety, latency and policy compliance.

模型用量

输入、输出、Reasoning、缓存读写、Embedding、图像、音频、工具与批处理单位。

失败与质量

重试、超时、回退调用、无效结构定义、拒绝答案、人工审核、升级与客户影响。

平台与运维

加价、订阅、Credits、基础设施、遥测、存储、出口、支持、工程与事故。

可接受结果

在基准前定义任务级接受标准:准确率、结构定义、工具成功、安全、延迟与策略合规。

Build a live cost benchmark 构建实时成本基准

  • Pull current official prices and terms; timestamp the data and pin exact model and endpoint identifiers.
  • Run representative distributions for extraction, support and agent tools with task-specific acceptance thresholds.
  • Measure usage, cache, latency, retries, fallback, invalid outputs, review and accepted-result rate.
  • Reconcile provider receipts and platform ledgers, then run sensitivity analysis for traffic and price changes.
  • 提取官方最新价格与条款,记录时间戳并固定具体模型和端点标识。
  • 用任务特定接受阈值运行抽取、客服与智能体工具的代表性分布。
  • 测量用量、缓存、延迟、重试、回退、无效输出、审核与可接受结果率。
  • 核对供应商回执与平台账本,再对流量和价格变化做敏感性分析。

Use an auditable cost ledger per workload 为每个负载使用可审计成本账本

Tag every request with workload, tenant, experiment, route policy and acceptance result. Store native usage beside normalized units, provider endpoint, cache state, retry chain, fallback, latency, platform fee and final quality verdict. Recompute costs from versioned price tables so price changes do not rewrite historical evidence.

为每个请求标注工作负载、租户、Experiment、路由策略与接受结果。并排存储原生用量与标准化单位、供应商端点、缓存状态、重试链、回退、延迟、平台费与最终质量结论。基于版本化价格表重算成本,避免价格变化改写历史证据。

Production rule: optimize cost per accepted business outcome; token price is one input, never the objective by itself.

生产规则:优化每个可接受业务结果的成本;Token 单价只是输入,不能单独作为目标。

Include capability-call cost in agent economics 在智能体经济性中包含能力调用成本

For agents, inference is only part of the bill. QVeris can expose estimated and billed cost for external API and tool execution. Join model usage with QVeris search and execution evidence to calculate total workflow cost per successful outcome.

对智能体而言,推理只是账单的一部分。QVeris 可以呈现外部 API 与工具执行的预估和实付成本。把模型用量与 QVeris 搜索和执行证据连接,计算每个成功结果的完整工作流成本。

What the same token workload costs at list price 同一 Token 工作负载的目录价成本

For a simple comparison, assume 2 million uncached input tokens and 500,000 output tokens. The arithmetic below uses official list prices verified July 21, 2026 and excludes tools, storage, regional premiums, gateway fees, discounts, taxes, and retries. It is a cost example, not a quality ranking.

假设工作负载包含 200 万未缓存输入 Token 与 50 万输出 Token。以下计算使用 2026 年 7 月 21 日核验的官方目录价,不含工具、存储、区域溢价、网关费、折扣、税费与重试;它是成本示例,不是质量排名。

Model or route 模型或路由 Input / cost 输入/成本 Output 输出 Scope 适用范围
OpenAI GPT-5.6 Luna $5.00 2 × $1 + 0.5 × $6 2M input + 0.5M output 两百万输入加五十万输出
Claude Haiku 4.5 $4.50 2 × $1 + 0.5 × $5 2M input + 0.5M output 两百万输入加五十万输出
Gemini 3.1 Flash-Lite $1.25 2 × $0.25 + 0.5 × $1.50 Standard service tier 标准服务层价格
DeepSeek V4 Flash $0.42 2 × $0.14 + 0.5 × $0.28 Cache-miss input 未命中缓存输入

When evaluating Cheap LLM API, verify the linked official pricing source immediately before a buying decision. Model quality, output length, cacheability, retries, tools, service tier, region, taxes, and discounts can reverse a token-price comparison.

评估“便宜的 LLM API”时,采购决策前务必立即核验页面所链接的官方定价来源。模型质量、输出长度、可缓存性、重试、工具、服务层、区域、税费与折扣都可能逆转 Token 单价比较。

Build an Effective Cost Model for a cheap LLM API为低成本 LLM API建立有效成本模型

When evaluating Cheap LLM API, list price is an input, not the decision. Compare the cost of an accepted production outcome after quality, retries, latency, operational work, and non-token charges are included.

评估“便宜的 LLM API”时,目录价只是输入,而不是最终决策。应在计入质量、重试、延迟、运营工作和非 Token 费用后,比较获得一个合格生产结果的成本。

WORKLOAD
Normalize a real request distribution
规范化真实请求分布

Sample production-shaped tasks and record mixed model families, prompt caching, batch discounts, aggregator markup, regional access, and minimum account commitments. Use percentiles and task classes rather than one average prompt so long-context and output-heavy requests remain visible.

抽取接近生产形态的任务,并记录混合模型族、提示词缓存、批处理折扣、聚合商加价、区域访问和最低账户承诺。使用分位数和任务类别,而不是单个平均提示词,确保长上下文与高输出请求不会被隐藏。

QUALITY
Calculate cost per accepted result
计算每个合格结果的成本

When evaluating Cheap LLM API, measure completion, rubric score, structured-output validity, tool accuracy, retry rate, and human-review time. Divide total run cost by accepted outcomes, not by raw requests.

评估“便宜的 LLM API”时,对每个模型与路由衡量完成率、评分标准得分、结构化输出有效率、工具准确率、重试率和人工复核时间,并用总运行成本除以合格结果,而不是原始请求数。

FULL COST
Include the costs outside tokens
纳入 Token 之外的成本

When evaluating Cheap LLM API, add gateway or aggregator fees, storage, egress, cache writes, evaluations, observability, support, engineering, incident handling, reserved capacity, unused credits, taxes, and the business cost of latency or failed work.

评估“便宜的 LLM API”时,加入网关或聚合费用、存储、流量、缓存写入、评估、可观察性、支持、工程、事故处理、预留容量、未用额度、税费,以及延迟或任务失败的业务成本。

REFRESH
Version every pricing assumption
版本化每一项价格假设

When evaluating Cheap LLM API, store source URL, retrieval date, currency, region, service tier, thresholds, discounts, and model version. Recompute scenarios when a catalog changes and alert when observed invoice cost diverges from the estimate.

评估“便宜的 LLM API”时,保存来源链接、获取日期、币种、区域、服务层级、阈值、折扣和模型版本。目录变化时重新计算情景,并在实际发票成本偏离估算时发出告警。

FAQ

Which LLM API is cheapest?

It changes by model, endpoint, workload and date. Use current official prices plus a workload benchmark and accepted-result calculation.

Are aggregators cheaper?

Sometimes provider competition or consolidated operations helps; markup, credits, routing and endpoint quality can also increase cost.

Does caching always save money?

Only for eligible repeated content with acceptable staleness and a cache price lower than avoided recomputation and risk.

哪个 LLM API 最便宜?

答案随模型、端点、负载与日期变化;应结合官方最新价格、负载基准与可接受结果计算。

聚合器更便宜吗?

供应商竞争或统一运营有时有利;加价、Credits、路由与端点质量也可能增加成本。

缓存总能省钱吗?

只有内容可重复、陈旧度可接受,且缓存价格低于避免的重算与风险时才成立。

Official sources and further reading 官方资料与延伸阅读