Single Bill, Multiple LLM APIs: Consolidate the Invoice, Preserve Evidence多个 LLM API 统一账单:合并发票,同时保留证据
A consolidated invoice is useful only when every charge remains traceable to provider-native usage, commercial terms, allocation rules and adjustment events.
只有每笔费用仍可追踪到供应商原生用量、商业条款、分摊规则与调整事件时,统一账单才真正有用。

TL;DR
Store provider request IDs, model, usage dimensions, status, time and source.
Create common reporting fields without erasing provider-native units.
Require tenant, team, project, product, environment and cost-center ownership.
Match provider exports and invoices, then append documented adjustments.
存储供应商请求 ID、模型、Usage Dimension、Status、Time 与 Source。
建立通用报告字段,同时不抹除供应商原生单位。
要求租户、Team、Project、Product、Environment 与 Cost Center 归属。
匹配供应商导出与账单,再追加有记录的调整。
A single bill for multiple LLM APIs is an accounting product多个 LLM API 的统一账单本质上是一项核算产品
Different providers expose different usage fields and invoice on different cutoffs, currencies, regions and commercial terms. Input, cached input, output, reasoning, media, storage and priority processing may be priced separately. A consolidated bill therefore needs a canonical category model without discarding the provider-native unit and evidence behind every line.
不同供应商公开的用量字段不同,也可能采用不同的账期截止、币种、区域与商业条款。Input、Cached Input、Output、Reasoning、媒体、存储和 Priority Processing 可能分别计价。因此,统一账单既需要规范类别模型,也不能丢失每一行背后的供应商原生单位与证据。
Separate three layers: raw usage, priced cost and customer charge. Raw usage records what the provider measured; priced cost applies the rate effective at event time; customer charge adds contracts, credits, taxes or internal allocation rules. Keeping the layers distinct prevents a pricing correction from mutating the underlying operational evidence.
应分开三层:原始用量、计价成本与客户费用。原始用量记录供应商测量结果;计价成本应用事件发生时生效的费率;客户费用再叠加合同、Credit、税费或内部分摊规则。分层后,价格修正不会篡改底层运营证据。
Do not rewrite history when late usage, credits, refunds or disputes arrive. Append adjustment events linked to the original records, with reason, source and approver, so finance and engineering can reproduce both the first invoice and its corrected version.
迟到用量、Credit、退款或争议到来时不要重写历史。应追加关联原记录的 Adjustment Event,并记录原因、来源与审批人,让财务和工程既能复现初始账单,也能复现修正版本。
Billing data layers账单数据层
| Layer层 | Best fit最适合 | Verify before choosing选择前验证 |
|---|---|---|
| Request evidence请求证据 | Explain individual usage and operational outcomes.解释单次用量与运营结果。 | Stable IDs, attempts, retries, cache, tools, privacy and duplication.核对稳定 ID、尝试、重试、缓存、工具、隐私与重复。 |
| Usage ledger用量账本 | Aggregate and allocate across providers and tenants.跨供应商与租户聚合并分摊。 | Immutability, schema versions, unit provenance and late events.核对不可变性、结构定义版本、单位来源与迟到事件。 |
| Provider reconciliation供应商对账 | Align internal records with provider exports.对齐内部记录与供应商导出。 | Time zones, aliases, invoice periods, missing IDs and rounding.核对时区、别名、账期、缺失 ID 与舍入。 |
| Consolidated invoice统一账单 | Charge back one understandable bill.进行一次清晰的 Chargeback。 | Currency, tax, credits, commitments, adjustments and dispute rights.核对币种、税费、Credit、承诺、调整与争议权利。 |
Invoice governance controls账单治理控制
Version cost-center mappings and define treatment for missing tags.
Model price, route fee, commitment, credit, tax and currency basis.
Record reason, source, approver, affected period and original lines.
Give finance, engineering and audit role-appropriate drill-down.
版本化 Cost Center 映射,并定义缺失 Tag 的处理。
模型价格、路由费、承诺、Credit、税费与币种基准。
记录原因、来源、Approver、影响账期与原始行。
为财务、工程与审计提供符合角色的下钻访问。
Close the billing period reproducibly可复现地关闭账期
Period close should be a controlled workflow, not an ad hoc spreadsheet merge. Define when usage is considered complete, which price and exchange-rate snapshots apply, who can approve adjustments and what variance requires investigation.
账期关闭应是受控工作流,而不是临时合并表格。需要明确用量何时视为完整、采用哪个价格与汇率快照、谁可以批准调整,以及多大差异必须调查。
- Freeze the billing cutoff, rule versions and exchange-rate source, then ingest final provider exports.
- Deduplicate events and reconcile by provider, account, project, model, region and usage dimension.
- Review missing usage, unexplained variance, currency basis, tax, credits and contract adjustments.
- Sample invoice lines and drill them down to native request IDs, usage and applied terms.
- Regenerate the same invoice from immutable inputs and compare a deterministic invoice hash before release.
- 冻结账期截止、规则版本和汇率来源,再摄取最终供应商导出。
- 去重事件,并按供应商、账户、Project、模型、区域与 Usage Dimension 对账。
- 检查缺失用量、未解释差异、币种基准、税费、Credit 与合同调整。
- 抽样账单行,下钻到原生 Request ID、用量与已应用条款。
- 发布前从不可变输入重新生成同一账单,并比较确定性 Invoice Hash。
Preserve two views of the same bill保留同一账单的两种视图
The consolidated view groups normalized categories by tenant, product, environment and cost center so a customer or budget owner can understand the total. The evidence view preserves provider exports, native request IDs, original units, price source, exchange-rate snapshot, reconciliation result and every adjustment. Each consolidated line should reference the evidence set from which it was calculated.
统一视图按租户、产品、环境与 Cost Center 汇总标准化类别,让客户或预算负责人能够理解总额。证据视图则保留供应商导出、原生 Request ID、原始单位、价格来源、汇率快照、对账结果及每次调整。每一条统一账单行都应引用其计算所依据的证据集合。
Generate both views from the same append-only ledger and versioned commercial rules. Store the ledger cutoff, rule version and invoice hash with the released document. If a correction is required, issue a new version or credit note linked to the original rather than editing the old artifact in place.
两种视图都应由同一只追加账本和版本化商业规则生成,并在发布文件中保存账本截止点、规则版本与 Invoice Hash。需要修正时,发布关联原账单的新版本或 Credit Note,而不是直接改写旧文件。
Production rule: never issue a consolidated charge that cannot be drilled down to provider-native evidence and the exact terms applied.
生产规则:无法下钻到供应商原生证据与准确适用条款的统一费用,绝不能出账。
Include tool charges without turning them into tokens纳入工具费用但不把它们变成 Token
QVeris calls external APIs, tools, services and live data that may bill by request, record, compute minute, data package or subscription. Keep each native unit, capability ID, provider evidence and price version in a separate capability ledger. Converting all of these to an invented token equivalent makes the invoice simpler to display but impossible to audit.
QVeris 调用外部 API、工具、服务与实时数据,可能按请求、记录、计算分钟、数据包或订阅计费。每项费用都应在独立能力账本中保留原生单位、Capability ID、供应商证据与价格版本。把所有单位折算成虚构的 Token 等价量,虽然展示更简单,却无法审计。
Add a distinct capability section to the consolidated bill and connect it to the same tenant, workload and parent trace as inference. This shows the complete workflow cost without confusing model spend with external data or action fees, and it reveals whether a retry reused a previous result or created another billable call.
在统一账单中加入独立的能力费用区段,并通过租户、工作负载与父 Trace 将其关联到推理费用。这样既能显示完整工作流成本,又不会混淆模型费用与外部数据或动作费用,还能看出重试是复用了已有结果,还是产生了新的计费调用。
Reconcile the unified invoice to native usage把统一账单对账到原生用量
One invoice reduces procurement work but does not remove the need for a usage ledger. Store provider, model, billable token classes, gateway fee, currency, and pricing version for each request; otherwise a monthly total cannot be explained or allocated.
统一账单降低采购工作,但不会消除 Usage 账本的必要性。每个请求都应记录供应商、模型、可计费 Token 类型、网关 Fee、Currency 与 Pricing Version,否则月度总额无法解释或分摊。
{
"event_version": 1,
"request_id": "req_01...",
"tenant": "team-support",
"workload": "support-answer",
"provider": "provider-name",
"model": "exact-model-id",
"usage": {"input": 1820, "cached_input": 900, "output": 244},
"price_version": "2026-07-21-usd",
"provider_cost_usd": 0.000000,
"gateway_fee_usd": 0.000000,
"invoice_id": null,
"trace_id": "trace_01..."
}- Reconcile request ledger totals to provider exports and the aggregator invoice.
- Keep taxes, credits, negotiated discounts, and currency conversion as separate lines.
- Alert on unmapped model IDs, missing usage, duplicated request IDs, and price-version gaps.
- 将请求账本汇总与供应商导出及聚合商账单对账。
- 把税费、Credits、协议折扣与汇率换算作为独立行。
- 对未映射模型 ID、缺失用量、重复请求 ID 与 Price Version 断层告警。
Verified implementation reference: OpenTelemetry GenAI conventions.
实施参考已根据官方资料核验:OpenTelemetry GenAI conventions。
FAQ
No. It is a consolidated financial view over independently evidenced providers.
No. Normalize categories for reporting but preserve native billable units.
As documented adjustment events linked to the affected provider lines and period.
不是。它是多个独立证据供应商之上的统一财务视图。
不应。报告可标准化类别,但必须保留原生计费单位。
作为有记录的调整事件,关联受影响的供应商行与账期。
