Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
MUL-5491: feat(metrics): add MiniMax-M3 standard-tier pricing (#6128)
Octopusb77b06943181
diff --git a/server/internal/metrics/pricing.go b/server/internal/metrics/pricing.goindex aefc34eb2b..be1e24419f 100644--- a/server/internal/metrics/pricing.go+++ b/server/internal/metrics/pricing.go@@ -70,7 +70,13 @@ var modelPrices = map[string]ModelPrice{// USD rates because rollups lack each request's pricing window. Off-peak// costs half as much; reseller prices can also differ. Cache writes bill// as ordinary input. Mirror packages/views/runtimes/utils.ts.- "deepseek:v4.1-flash": {Provider: "deepseek", Model: "v4.1-flash", InputPerM: 0.30, CacheReadPerM: 0.006, CacheWritePerM: 0.30, OutputPerM: 1.20},+ "deepseek:v4.1-flash": {Provider: "deepseek", Model: "v4.1-flash", InputPerM: 0.30, CacheReadPerM: 0.006, CacheWritePerM: 0.30, OutputPerM: 1.20},+ // MiniMax-M3 standard-tier estimate (https://platform.minimax.io/docs/pricing/overview).+ // Usage aggregates multiple requests, so it cannot identify individual >512K+ // inputs. As with xAI below, use the standard tier; long requests may be+ // underestimated. Cache writes mirror input for newly cached input tokens,+ // not an additional write fee (https://platform.minimax.io/docs/api-reference/text-prompt-caching).+ "minimax:m3": {Provider: "minimax", Model: "m3", InputPerM: 0.30, CacheReadPerM: 0.06, CacheWritePerM: 0.30, OutputPerM: 1.20},"minimax:m2.7": {Provider: "minimax", Model: "m2.7", InputPerM: 0.30, CacheReadPerM: 0.06, CacheWritePerM: 0.375, OutputPerM: 1.20},"minimax:m2.7-highspeed": {Provider: "minimax", Model: "m2.7-highspeed", InputPerM: 0.60, CacheReadPerM: 0.06, CacheWritePerM: 0.375, OutputPerM: 2.40},// Google standard token prices: ai.google.dev/gemini-api/docs/pricing@@ -234,6 +240,7 @@ var modelAliasRules = []struct {// and the 1017 snapshot resolve, matching the frontend's exact keys.{regexp.MustCompile(`(^|/|:)deepseek-(?:flash|v4-flash(?:-vision-exp)?|v4\.1-flash(?:-1017)?|chat|reasoner)$`), "deepseek:v4.1-flash"},{regexp.MustCompile(`deepseek-v4-pro`), "deepseek:v4-pro"},+ {regexp.MustCompile(`(^|/|:)minimax-m3$`), "minimax:m3"},{regexp.MustCompile(`minimax-m2[.]7.*highspeed|highspeed.*minimax-m2[.]7`), "minimax:m2.7-highspeed"},{regexp.MustCompile(`minimax-m2[.]7`), "minimax:m2.7"},// Each Gemini SKU is exact: an image/audio/preview variant must neverdiff --git a/server/internal/metrics/pricing_test.go b/server/internal/metrics/pricing_test.goindex 11e27d72f6..fca48ead6e 100644--- a/server/internal/metrics/pricing_test.go+++ b/server/internal/metrics/pricing_test.go@@ -229,6 +229,50 @@ func TestPriceForModelAliasGrok(t *testing.T) {}}+// TestPriceForModelAliasMinimaxM3 pins the standard-tier fallback estimate.+// Aggregate usage cannot identify per-request long-context tiers. Cache writes+// mirror input for newly cached tokens; existing M2.7 rates remain unchanged.+func TestPriceForModelAliasMinimaxM3(t *testing.T) {+ cases := []struct {+ model string+ want ModelPrice+ }{+ {+ model: "minimax-m3",+ want: ModelPrice{Provider: "minimax", Model: "m3", InputPerM: 0.3, CacheReadPerM: 0.06, CacheWritePerM: 0.3, OutputPerM: 1.2},+ },+ {+ model: "codebuddy/minimax-m3",+ want: ModelPrice{Provider: "minimax", Model: "m3", InputPerM: 0.3, CacheReadPerM: 0.06, CacheWritePerM: 0.3, OutputPerM: 1.2},+ },+ {+ model: "MiniMax-M3",+ want: ModelPrice{Provider: "minimax", Model: "m3", InputPerM: 0.3, CacheReadPerM: 0.06, CacheWritePerM: 0.3, OutputPerM: 1.2},+ },+ // The older M2.7 row must stay separate and keep its distinct rates.+ {+ model: "minimax-m2.7",+ want: ModelPrice{Provider: "minimax", Model: "m2.7", InputPerM: 0.3, CacheReadPerM: 0.06, CacheWritePerM: 0.375, OutputPerM: 1.2},+ },+ }++ for _, tc := range cases {+ got, ok := PriceForModelAlias(tc.model)+ if !ok {+ t.Fatalf("PriceForModelAlias(%q) did not resolve", tc.model)+ }+ if got != tc.want {+ t.Fatalf("PriceForModelAlias(%q) = %+v, want %+v", tc.model, got, tc.want)+ }+ }++ for _, model := range []string{"minimax-m3.5", "minimax-m3-highspeed", "some-vendor/minimax-m3-preview"} {+ if got, ok := PriceForModelAlias(model); ok {+ t.Fatalf("PriceForModelAlias(%q) unexpectedly resolved to %+v; want unmapped", model, got)+ }+ }+}+// TestGrokPricingMatchesRecordedTurn re-derives the cost of a real// grok 0.2.106 turn from the table and checks it against the costUsdTicks xAI// returned for that same turn (1 tick = 1e-10 USD). This is the end-to-end