快速结论:在 LiteLLM 通过 DB/UI 配置自定义分档定价(Router 自定义定价注册路径)时,`*_above_32k_tokens` 类字段会出现在 Dashboard 的 `litellm_params` 中,却不进入成本计算的 model_map,导致 32k–128k 区间的请求按基础价计费。优先排查这些字段是否被 Router 注册到了 cost map。
适用环境:Issue 中明确涉及 LiteLLM(代码引用为 v1.92.0)及 DB/UI 部署下的 Router 自定义定价;其他 Python、CUDA、PyTorch、显卡、依赖版本在 Issue 中未给出证据,不做推断。
最快修复方案:升级到包含 #55592 修复的 LiteLLM 版本(修复已进入 main,随下一个 release 发布)。
注意事项:#55592 的具体改动内容与影响范围 Issue 中未展开;升级后如仍复现,需回到原 Issue 反馈并重开。Issue 中关于自动化失败“契约问题”的评论属于通用排错建议,与本报错无直接因果关系。
问题场景
用户在 LiteLLM 中使用 DB/UI 配置自定义分档定价,设置 `input_cost_per_token_above_32k_tokens`、`output_cost_per_token_above_32k_tokens`、`cache_read_input_token_cost_above_32k_tokens` 等字段。字段在 Dashboard 的 `litellm_params` 中显示正常(因为 `LiteLLM_Params` 设置了 extra="allow"),但花费日志的 `model_map_information.model_map_value` 中缺失,且成本计算时未被应用——32k–128k 区间的请求仍按基础 `input_cost_per_token` 计费。相比之下 `*_above_128k_tokens` 能正常工作,因为它已在 `CustomPricingLiteLLMParams` 中声明。
报错原文
Custom *_above_32k_tokens saved in UI but ignored in cost calc / spend model_map
原因分析
Issue 给出的根因是 Router 注册自定义定价时,只从 CustomPricingLiteLLMParams.model_fields 中取值写入 cost map:
for field in CustomPricingLiteLLMParams.model_fields.keys():
field_value = deployment.litellm_params.get(field)
if field_value is not None:
_model_info_dict[field] = field_value
...
litellm.register_model(model_cost={_model_id: _model_info_dict})
因此未在 `CustomPricingLiteLLMParams` 中声明的 `*_above_32k_tokens` 字段虽然被保存到 `litellm_params`,却不会进入注册的模型成本信息,成本计算时自然被忽略。#30344 / #30880 修复的是 `get_model_info` 丢弃已有 cost-map 条目中任意 `_above_*` 键的问题,本 Issue 是 Router 自定义定价注册路径上的遗留缺口。
环境排查
- 确认 LiteLLM 版本是否低于包含 #55592 修复的发布版本。
- 确认是否使用 DB/UI 部署并通过 Router 配置自定义模型定价。
- 确认配置中使用了带 `above_32k_tokens` 的分档字段,而非仅 `above_128k_tokens`。
- Python、CUDA、PyTorch、显卡等信息 Issue 未提供,无需作为排查前提。
解决步骤
- 记录当前 LiteLLM 版本,并保留复现用的自定义定价配置。
- 升级到包含 #55592 修复的 LiteLLM 版本。
- 升级后重新触发一次 32k–128k 区间的请求,检查花费日志中 `model_map_information.model_map_value` 是否包含 `*_above_32k_tokens` 字段。
- 若升级后仍复现,在原 Issue 下留言说明版本与复现信息,请求重开。
验证方法
发起一次落在 32k–128k token 区间的请求,确认 spend log 的 `model_map_information.model_map_value` 中出现对应 `*_above_32k_tokens` 配置,且该请求的费用按分档单价计算,而非基础 `input_cost_per_token`。
参考来源
AI 工具推荐
想把多个 AI 模型放在一个入口?
GamsGo AI 集成 ChatGPT、DeepSeek、Gemini、Claude、Midjourney、Veo 等常用模型,适合写作、绘图、视频和日常 AI 工作流。
推广链接:通过此链接购买,我可能获得佣金,不影响你的价格。
这个方案解决了吗?
可以继续搜索完整报错,或查看同一工具的其他排查指南。
![[FEATURE]The latest version of DeepSeek is incompatible with reasoning_content.](https://www.chat-gpts.plus/wp-content/uploads/2026/12/5878-c20830d5-768x403.jpg)
![[Bug]: Bedrock Llama native streaming drops provider usage and undercounts prompt tokens](https://www.chat-gpts.plus/wp-content/uploads/2026/12/51456-ca65870e-768x403.jpg)
