Skip to content

feat(billing): add fallback pricing for MiniMax M2.5, GLM-4.7/5, Kimi…#970

Open
wucm667 wants to merge 1 commit intoWei-Shaw:mainfrom
wucm667:feat/add-new-model-fallback-pricing
Open

feat(billing): add fallback pricing for MiniMax M2.5, GLM-4.7/5, Kimi…#970
wucm667 wants to merge 1 commit intoWei-Shaw:mainfrom
wucm667:feat/add-new-model-fallback-pricing

Conversation

@wucm667
Copy link
Contributor

@wucm667 wucm667 commented Mar 13, 2026

变更概述

为计费服务新增多个国内主流 AI 模型的兜底(fallback)定价,确保这些模型在 model_pricing.json 数据文件中没有精确匹配时,仍能正确计算费用。

新增模型及定价

模型 输入价格($/MTok) 输出价格($/MTok)
MiniMax M2.5 $0.27 $0.95
智谱 GLM-4.7 $0.38 $1.98
智谱 GLM-5 $0.72 $2.30
Kimi K2.5 $0.45 $2.20
Qwen3.5-Plus $0.26 $1.56

变更详情

billing_service.go

  • initFallbackPricing() 中为上述 5 个模型注册兜底定价
  • getFallbackPricing() 中新增对应的模型系列匹配规则,支持大小写不敏感匹配及常见变体(如 m2.5 / m2-54.7 / 4-7 等分隔符差异)

billing_service_test.go

  • 新增 10 个测试用例,覆盖 5 个新模型及其常见命名变体
  • 将原 qwen-maxexpectNilPricing: true 测试用例调整为 llama-3-70b,更准确地代表"不支持的模型系列"

测试

go test -tags=unit ./backend/internal/service/...

所有单元测试通过。

Checklist

  • 单元测试通过 (go test -tags=unit github.)
  • 无新增 lint 问题
  • 新增定价均参考各厂商官方公开价格

… K2.5, Qwen3.5-Plus

- Add MiniMax M2.5 pricing: $0.27/MTok input, $0.95/MTok output
- Add 智谱 GLM-4.7 pricing: $0.38/MTok input, $1.98/MTok output
- Add 智谱 GLM-5 pricing: $0.72/MTok input, $2.30/MTok output
- Add Kimi K2.5 pricing: $0.45/MTok input, $2.20/MTok output
- Add Qwen3.5-Plus pricing: $0.26/MTok input, $1.56/MTok output
- Add family matching rules for the above model series
- Add unit tests covering all new models and variants
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant