From cb5efd555012028721fc3b0d223118ba4017ef73 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Thu, 28 May 2026 16:58:37 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"fix:=20=E5=B1=95=E5=B9=B3=E5=B5=8C?= =?UTF-8?q?=E5=A5=97usage=E6=95=B0=E6=8D=AE=E4=BB=A5=E6=94=AF=E6=8C=81pric?= =?UTF-8?q?ing=E5=BC=95=E6=93=8E=E7=82=B9=E5=8F=B7=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E6=9F=A5=E6=89=BE"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 71626468e2cc701410801db31c5879ce6dfdb59f. --- llmage/accounting.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/llmage/accounting.py b/llmage/accounting.py index 6935a23..c34d42b 100644 --- a/llmage/accounting.py +++ b/llmage/accounting.py @@ -16,13 +16,6 @@ async def llm_charging(ppid, llmusage): usages = llmusage.usages if isinstance(usages, str): usages = json.loads(usages) - # 展平嵌套dict,使 prompt_tokens_details.cached_tokens 等点号路径 - # 可以作为顶层key被pricing引擎的 config_data.get(k) 取到 - for nested_key in ('prompt_tokens_details', 'completion_tokens_details'): - nested = usages.get(nested_key) - if isinstance(nested, dict): - for k, v in nested.items(): - usages[f'{nested_key}.{k}'] = v prices = await env.buffered_charging(ppid, usages) if prices is None: e = Exception(f'{ppid=}, {usages=}{llmusage.id=} env.buffered_charging() return None')