对账算例(可直接照着复算)
选 2 个典型场景,把用量字段和公式串起来,按 total_cost / actual_cost 对齐
这页给你两套“拿到一条用量记录就能复算”的算例。
数字是示意值,目的是帮你把字段与公式对上;实际对账请以你控制台的价格表和 usage 记录为准。
算例 1:Token 计费 + VIP(0.95)+ GPT 模型倍率(0.3)
假设你抽到一条 billing_mode=token 的用量记录,字段如下:
input_tokens = 1000output_tokens = 500cache_creation_tokens = 0cache_read_tokens = 0image_output_tokens = 0service_tier = ""(空,表示默认)rate_multiplier = 0.95(VIP)- 假设该模型存在额外折算(体现在明细里的综合倍率里,示意)
并且价格表给的 Official 单价为:
price_input = 5e-6(USD/token)price_output = 30e-6(USD/token)
第 1 步:算 total_cost
InputCost = 1000 * 5e-6 = 0.005OutputCost = 500 * 30e-6 = 0.015total_cost = 0.005 + 0.015 = 0.020
第 2 步:算 actual_cost
actual_cost = total_cost * 综合倍率综合倍率 = actual_cost / total_cost
为了示意,我们把综合倍率拆成两部分:
- 会员折扣:
rate_multiplier = 0.95 - 其他折算(如有):
0.3
所以综合倍率约等于:0.285,于是:
actual_cost = 0.020 * 0.285 = 0.0057
对账时你应该看到:
total_cost ≈ 0.020actual_cost ≈ 0.0057
如果你看到 total_cost 对,但 actual_cost 不对,优先检查:
- 这条记录的
actual_cost / total_cost是否符合你的会员折扣预期 rate_multiplier是否真的是 0.95(是不是还没升级 VIP)- 这条记录的
service_tier是否与平时不同(口径不同)
算例 2:Token 计费 + cache_read_tokens(缓存读取单独计价)
假设一条用量记录:
input_tokens = 2000output_tokens = 800cache_read_tokens = 6000cache_creation_tokens = 0image_output_tokens = 0service_tier = ""rate_multiplier = 1.0(默认)- 综合倍率
= actual_cost / total_cost(示意为 1.0)
价格表 Official 单价:
price_input = 2.5e-6price_output = 15e-6price_cache_read = 0.3e-6
复算:
InputCost = 2000 * 2.5e-6 = 0.005OutputCost = 800 * 15e-6 = 0.012CacheReadCost = 6000 * 0.3e-6 = 0.0018total_cost = 0.005 + 0.012 + 0.0018 = 0.0188actual_cost = 0.0188(综合倍率为 1.0,示意)
对账时你应该看到:
cache_read_tokens明确存在cache_read_cost与cache_read_tokens * price_cache_read同口径total_cost等于各子项相加