From 860ff445f6704cfea0fde0e617506e778c76e5b0 Mon Sep 17 00:00:00 2001 From: Oluwadare Feranmi Date: Wed, 29 Apr 2026 12:12:56 +0100 Subject: [PATCH] fix(usage_pricing): add MiniMax-M2.7 pricing for minimax and minimax-cn providers Fixes #16825. Sessions using MiniMax-M2.7 via minimax-cn showed estimated_cost_usd=0.0 and cost_status='unknown' because neither provider had a billing route or pricing entry. Adds official_docs_snapshot entries ($0.30/M input, $1.20/M output) for both minimax and minimax-cn, and adds explicit routing in resolve_billing_route so both resolve to billing_mode='official_docs_snapshot' instead of falling through to 'unknown'. --- agent/usage_pricing.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/agent/usage_pricing.py b/agent/usage_pricing.py index 1dfe59ea32..746f962097 100644 --- a/agent/usage_pricing.py +++ b/agent/usage_pricing.py @@ -359,6 +359,25 @@ _OFFICIAL_DOCS_PRICING: Dict[tuple[str, str], PricingEntry] = { source_url="https://aws.amazon.com/bedrock/pricing/", pricing_version="bedrock-pricing-2026-04", ), + # MiniMax + ( + "minimax", + "minimax-m2.7", + ): PricingEntry( + input_cost_per_million=Decimal("0.30"), + output_cost_per_million=Decimal("1.20"), + source="official_docs_snapshot", + pricing_version="minimax-pricing-2026-04", + ), + ( + "minimax-cn", + "minimax-m2.7", + ): PricingEntry( + input_cost_per_million=Decimal("0.30"), + output_cost_per_million=Decimal("1.20"), + source="official_docs_snapshot", + pricing_version="minimax-pricing-2026-04", + ), } @@ -400,6 +419,8 @@ def resolve_billing_route( return BillingRoute(provider="anthropic", model=model.split("/")[-1], base_url=base_url or "", billing_mode="official_docs_snapshot") if provider_name == "openai": return BillingRoute(provider="openai", model=model.split("/")[-1], base_url=base_url or "", billing_mode="official_docs_snapshot") + if provider_name in {"minimax", "minimax-cn"}: + return BillingRoute(provider=provider_name, model=model.split("/")[-1], base_url=base_url or "", billing_mode="official_docs_snapshot") if provider_name in {"custom", "local"} or (base and "localhost" in base): return BillingRoute(provider=provider_name or "custom", model=model, base_url=base_url or "", billing_mode="unknown") return BillingRoute(provider=provider_name or "unknown", model=model.split("/")[-1] if model else "", base_url=base_url or "", billing_mode="unknown")