DOCS · METERING

计量与结算

所有金额都以 ITC 为单位结算。计量基于 token,单价在挂单和投标时确定,结算时按合约价格计算。

计量上报

执行器在每个时间窗口结束时调用:

POST /marketplace/contracts/{contract_id}/meters { "tokens_served": 12345, "window_start": "...", "window_end": "..." }

结算公式

  • 本窗口 ITC = tokens_served × itc_per_token
  • 平台抽成 = ITC × 5%
  • 卖家入账 = ITC × 95%
  • 买家在签约时按 max_itc_per_hour 预留余额,超限自动停止计量

账本守恒

Σ buyer_debits + Σ seller_credits + Σ platform_credits = 0

账本表 itc_ledger 是只追加的,每条记录都有 contract_id 与 kind(reserve / debit / credit / fee),便于审计。