fix: harden the observability fields against the verifier findings
This commit is contained in:
@@ -99,7 +99,8 @@ class PricingTable:
|
||||
logger.warning("pricing 表无 model {!r} 的单价,cost 记 None", model)
|
||||
return None
|
||||
billed_input = prompt_tokens / 1_000_000 * price.input_per_1m
|
||||
if price.cached_input_per_1m is not None and cached_prompt_tokens:
|
||||
# 负数按"无命中"处理: cost() 是公共方法,不能假定调用方已过 transport 的校验
|
||||
if price.cached_input_per_1m is not None and (cached_prompt_tokens or 0) > 0:
|
||||
cached = self._clamp_cached(model, prompt_tokens, cached_prompt_tokens)
|
||||
billed_input = (prompt_tokens - cached) / 1_000_000 * price.input_per_1m + (
|
||||
cached / 1_000_000 * price.cached_input_per_1m
|
||||
|
||||
Reference in New Issue
Block a user