安全公告 — 恶意 litellm 版本 1.82.7 与 1.82.8 已从 PyPI 移除(存在 API 密钥外泄风险)。请卸载、轮换已暴露凭据,并升级至安全版本(如 1.82.9+)。运行 pip show litellm 以确认。 PyPI · README

Cache & Pricing Architecture

sha256(JSON({ tenant_id, user_id, model, messages, tools, temperature, ... })),排除 stream 与副作用工具调用(tools + tool_choice != none)。

Cache & Pricing Architecture

Canonical Key

sha256(JSON({ tenant_id, user_id, model, messages, tools, temperature, ... })),排除 stream 与副作用工具调用(tools + tool_choice != none)。

Usage 归一

上游字段
OpenAIprompt_tokens_details.cached_tokens
Claudecache_creation_input_tokens / cache_read_input_tokens
DeepSeekprompt_cache_hit_tokens
GeminicachedContentTokenCount

计费

internal/metering/pricing.yaml 定义 cached_input / cache_creation / cache_read 单价;网关 L1/L2 命中写入 usage.source=gateway_cache 并按折扣比计费。