Files
magpie/internal/provider/testdata/xiaomi_catalog.json
T
yetoneandmengyianx f31ae38aeb provider: Xiaomi MiMo is priced at xiaomi's list price, not its Token Plans' $0, and pay as you go looks only in xiaomi (#1873)
mengyianx found every pay-as-you-go MiMo call counted at $0.000:
models.dev's xiaomi-token-plan-cn, -sgp and -ams list all nine models
at cost 0 (the plan's per-token charge, not the model's price), the
preset's catalog was "xiaomi-token-plan-cn, xiaomi" at every region, and
catalog.PricedBy takes the first catalog with a cost field. makerCatalogs
puts the plan catalog ahead of xiaomi too, so the maker fallback gave $0
as well.

What changed:
- membershipCatalogs (never read for a price) gains the three
  xiaomi-token-plan catalogs, as #1370 did for Kimi Code. That covers
  ListPrice, MakerPrice and PricedName through makerPriceCatalogs.
  kimiCodeMember now checks a list of Kimi Code's plans of its own
  (kimiCodePlans), so a Xiaomi provider isn't taken for Kimi Code and
  its ids aren't mapped to Kimi's.
- Each Xiaomi region names its own catalog: plan-cn/sgp/ams
  "xiaomi-token-plan-<r>, xiaomi", pay as you go "xiaomi" alone. A plan
  user is priced at the API-equivalent price, the same meaning as #1370.
- PricedBy is unchanged: a catalog that lists a model at $0 still prices
  it at $0 (nvidia, modelscope have truly free models).
- docs/subsystems/providers-accounts.md says so.

Providers saved before this: the preset's own catalog stays
"xiaomi-token-plan-cn, xiaomi", the same string an existing provider
saved with the old default holds. normalize already lets a catalog that
equals the preset's or one of its regions' follow the region the
provider is at (the Tencent Cloud mechanism), on every read, so an old
default at pay-as-you-go reads as "xiaomi" and at Singapore as
"xiaomi-token-plan-sgp, xiaomi"; nothing is written to providers.json
until the user next saves it. Any other catalog the user typed is kept
as typed, and is priced right anyway because the plan catalogs are out
of pricing. The one value that can't be told apart is a bare "xiaomi"
typed at a plan region (the issue's workaround, which was for pay as
you go): it equals the pay-as-you-go region's catalog, so it reads as
that plan's "xiaomi-token-plan-<r>, xiaomi". Its prices are identical
either way; only the model-metadata lookup order differs. That is the
existing rule for every preset with region catalogs, kept rather than
special-cased.

Siblings: scanned the models.dev cache (read only) for catalogs whose
priced models are all or mostly $0. Of those, only kimi-code-plan-* and
xiaomi-token-plan-* are named by any preset or region. stepfun's
*-step-plan catalogs carry no cost at all, so they never shadowed a
price. alibaba/minimax/zai/zhipuai/volcengine/tencent coding and token
plan catalogs are all-$0 on models.dev but no preset uses them.

Tests (internal/provider/xiaomi_price_test.go, fixture
testdata/xiaomi_catalog.json cut from models.dev's real entries):
- TestXiaomiListPrice: every region, the old default, a user's own
  catalogs: mimo-v2.6-flash $0.14/$0.28/$0.0028, mimo-v2.6-pro
  $0.435/$0.87/$0.0036; MakerPrice; EffectivePrice of a saved provider;
  a relay's own $0 model ahead of xiaomi stays $0; a Xiaomi provider is
  not a Kimi Code member.
- TestXiaomiRegionCatalogs: each region resolves to its catalogs from
  the preset's, the old default and another region's; import links at
  each region; FromPreset; a user's catalog kept at two regions.

Broken by hand, each red, then restored:
- membershipCatalogs back to Kimi only: TestXiaomiListPrice FAIL, plan
  regions and MakerPrice at $0.
- region catalogs removed: TestXiaomiRegionCatalogs FAIL (api with the
  old default stays [xiaomi-token-plan-cn xiaomi], imports at sgp/ams
  get cn's).
- both: TestXiaomiListPrice FAIL, api with the old default at $0 (the
  reported bug).
- kimiCodeMember on membershipCatalogs: FAIL "a Xiaomi Token Plan
  provider counts as a Kimi Code membership".
- PricedBy's exact match skipping all-zero costs: FAIL "relay
  mimo-v2.6-flash: ... want its own $0".

Run: gofmt -l (nothing); go vet ./... on darwin, GOOS=linux -tags nogui,
GOOS=windows; go build on all three; go test -tags nogui -count=1
./internal/provider ./internal/catalog ./internal/cli ./internal/gui
./internal/usage, all ok, in a sandbox HOME with pinned caches.
Real use: built binaries before and after, sandbox HOME with a copy of
the real models.dev cache and a providers.json holding the reporter's
saved state. `magpie model price xiaomi/mimo-v2.6-flash` printed $0/$0
before and $0.14/$0.28 after; an old-default provider at Singapore went
$0 -> $0.14/$0.28 and shows catalog "xiaomi-token-plan-sgp, xiaomi";
one with the user's "openrouter, xiaomi" kept it; providers.json was
byte-identical afterwards. Not tried: a real MiMo key or call, the GUI
editor's region switch, the full go test ./... suite.

Co-authored-by: mengyianx <106875577+mengyianx@users.noreply.github.com>
2026-10-13 05:57:40 +08:00

350 lines
6.7 KiB
JSON

{
"xiaomi": {
"id": "xiaomi",
"models": {
"mimo-v2.6-pro": {
"id": "mimo-v2.6-pro",
"name": "MiMo-V2.6-Pro",
"cost": {
"input": 0.435,
"output": 0.87,
"cache_read": 0.0036
}
},
"mimo-v2-flash": {
"id": "mimo-v2-flash",
"name": "MiMo-V2-Flash",
"cost": {
"input": 0.14,
"output": 0.28,
"cache_read": 0.0028
}
},
"mimo-v2.5": {
"id": "mimo-v2.5",
"name": "MiMo-V2.5",
"cost": {
"input": 0.14,
"output": 0.28,
"cache_read": 0.0028
}
},
"mimo-v2-omni": {
"id": "mimo-v2-omni",
"name": "MiMo-V2-Omni",
"cost": {
"input": 0.14,
"output": 0.28,
"cache_read": 0.0028
}
},
"mimo-v2.6-pro-ultraspeed": {
"id": "mimo-v2.6-pro-ultraspeed",
"name": "MiMo-V2.6-Pro-UltraSpeed",
"cost": {
"input": 4.35,
"output": 8.7,
"cache_read": 0.036
}
},
"mimo-v2-pro": {
"id": "mimo-v2-pro",
"name": "MiMo-V2-Pro",
"cost": {
"input": 0.435,
"output": 0.87,
"cache_read": 0.0036
}
},
"mimo-v2.5-pro": {
"id": "mimo-v2.5-pro",
"name": "MiMo-V2.5-Pro",
"cost": {
"input": 0.435,
"output": 0.87,
"cache_read": 0.0036
}
},
"mimo-v2.6-flash": {
"id": "mimo-v2.6-flash",
"name": "MiMo-V2.6-Flash",
"cost": {
"input": 0.14,
"output": 0.28,
"cache_read": 0.0028
}
},
"mimo-v2.5-pro-ultraspeed": {
"id": "mimo-v2.5-pro-ultraspeed",
"name": "MiMo-V2.5-Pro-UltraSpeed",
"cost": {
"input": 1.305,
"output": 2.61,
"cache_read": 0.0108
}
}
}
},
"xiaomi-token-plan-cn": {
"id": "xiaomi-token-plan-cn",
"models": {
"mimo-v2.6-pro": {
"id": "mimo-v2.6-pro",
"name": "MiMo-V2.6-Pro",
"cost": {
"input": 0,
"output": 0,
"cache_read": 0
},
"canonical_model_id": "xiaomi/mimo-v2.6-pro"
},
"mimo-v2.5": {
"id": "mimo-v2.5",
"name": "MiMo-V2.5",
"cost": {
"input": 0,
"output": 0,
"cache_read": 0
},
"canonical_model_id": "xiaomi/mimo-v2.5"
},
"mimo-v2.5-tts-voicedesign": {
"id": "mimo-v2.5-tts-voicedesign",
"name": "MiMo-V2.5-TTS-VoiceDesign",
"cost": {
"input": 0,
"output": 0
}
},
"mimo-v2.5-tts": {
"id": "mimo-v2.5-tts",
"name": "MiMo-V2.5-TTS",
"cost": {
"input": 0,
"output": 0
}
},
"mimo-v2-pro": {
"id": "mimo-v2-pro",
"name": "MiMo-V2-Pro",
"cost": {
"input": 0,
"output": 0,
"cache_read": 0
},
"canonical_model_id": "xiaomi/mimo-v2-pro"
},
"mimo-v2-tts": {
"id": "mimo-v2-tts",
"name": "MiMo-V2-TTS",
"cost": {
"input": 0,
"output": 0
}
},
"mimo-v2.5-pro": {
"id": "mimo-v2.5-pro",
"name": "MiMo-V2.5-Pro",
"cost": {
"input": 0,
"output": 0,
"cache_read": 0
},
"canonical_model_id": "xiaomi/mimo-v2.5-pro"
},
"mimo-v2.6-flash": {
"id": "mimo-v2.6-flash",
"name": "MiMo-V2.6-Flash",
"cost": {
"input": 0,
"output": 0,
"cache_read": 0
},
"canonical_model_id": "xiaomi/mimo-v2.6-flash"
},
"mimo-v2.5-tts-voiceclone": {
"id": "mimo-v2.5-tts-voiceclone",
"name": "MiMo-V2.5-TTS-VoiceClone",
"cost": {
"input": 0,
"output": 0
}
}
}
},
"xiaomi-token-plan-sgp": {
"id": "xiaomi-token-plan-sgp",
"models": {
"mimo-v2.6-pro": {
"id": "mimo-v2.6-pro",
"name": "MiMo-V2.6-Pro",
"cost": {
"input": 0,
"output": 0,
"cache_read": 0
},
"canonical_model_id": "xiaomi/mimo-v2.6-pro"
},
"mimo-v2.6-flash": {
"id": "mimo-v2.6-flash",
"name": "MiMo-V2.6-Flash",
"cost": {
"input": 0,
"output": 0,
"cache_read": 0
},
"canonical_model_id": "xiaomi/mimo-v2.6-flash"
},
"mimo-v2.5-tts-voiceclone": {
"id": "mimo-v2.5-tts-voiceclone",
"name": "MiMo-V2.5-TTS-VoiceClone",
"cost": {
"input": 0,
"output": 0
}
},
"mimo-v2.5-pro": {
"id": "mimo-v2.5-pro",
"name": "MiMo-V2.5-Pro",
"cost": {
"input": 0,
"output": 0,
"cache_read": 0
},
"canonical_model_id": "xiaomi/mimo-v2.5-pro"
},
"mimo-v2-tts": {
"id": "mimo-v2-tts",
"name": "MiMo-V2-TTS",
"cost": {
"input": 0,
"output": 0
}
},
"mimo-v2-pro": {
"id": "mimo-v2-pro",
"name": "MiMo-V2-Pro",
"cost": {
"input": 0,
"output": 0,
"cache_read": 0
},
"canonical_model_id": "xiaomi/mimo-v2-pro"
},
"mimo-v2.5-tts": {
"id": "mimo-v2.5-tts",
"name": "MiMo-V2.5-TTS",
"cost": {
"input": 0,
"output": 0
}
},
"mimo-v2.5-tts-voicedesign": {
"id": "mimo-v2.5-tts-voicedesign",
"name": "MiMo-V2.5-TTS-VoiceDesign",
"cost": {
"input": 0,
"output": 0
}
},
"mimo-v2.5": {
"id": "mimo-v2.5",
"name": "MiMo-V2.5",
"cost": {
"input": 0,
"output": 0,
"cache_read": 0
},
"canonical_model_id": "xiaomi/mimo-v2.5"
}
}
},
"xiaomi-token-plan-ams": {
"id": "xiaomi-token-plan-ams",
"models": {
"mimo-v2.6-pro": {
"id": "mimo-v2.6-pro",
"name": "MiMo-V2.6-Pro",
"cost": {
"input": 0,
"output": 0,
"cache_read": 0
},
"canonical_model_id": "xiaomi/mimo-v2.6-pro"
},
"mimo-v2.6-flash": {
"id": "mimo-v2.6-flash",
"name": "MiMo-V2.6-Flash",
"cost": {
"input": 0,
"output": 0,
"cache_read": 0
},
"canonical_model_id": "xiaomi/mimo-v2.6-flash"
},
"mimo-v2.5-tts-voiceclone": {
"id": "mimo-v2.5-tts-voiceclone",
"name": "MiMo-V2.5-TTS-VoiceClone",
"cost": {
"input": 0,
"output": 0
}
},
"mimo-v2.5-pro": {
"id": "mimo-v2.5-pro",
"name": "MiMo-V2.5-Pro",
"cost": {
"input": 0,
"output": 0,
"cache_read": 0
},
"canonical_model_id": "xiaomi/mimo-v2.5-pro"
},
"mimo-v2-tts": {
"id": "mimo-v2-tts",
"name": "MiMo-V2-TTS",
"cost": {
"input": 0,
"output": 0
}
},
"mimo-v2-pro": {
"id": "mimo-v2-pro",
"name": "MiMo-V2-Pro",
"cost": {
"input": 0,
"output": 0,
"cache_read": 0
},
"canonical_model_id": "xiaomi/mimo-v2-pro"
},
"mimo-v2.5-tts": {
"id": "mimo-v2.5-tts",
"name": "MiMo-V2.5-TTS",
"cost": {
"input": 0,
"output": 0
}
},
"mimo-v2.5-tts-voicedesign": {
"id": "mimo-v2.5-tts-voicedesign",
"name": "MiMo-V2.5-TTS-VoiceDesign",
"cost": {
"input": 0,
"output": 0
}
},
"mimo-v2.5": {
"id": "mimo-v2.5",
"name": "MiMo-V2.5",
"cost": {
"input": 0,
"output": 0,
"cache_read": 0
},
"canonical_model_id": "xiaomi/mimo-v2.5"
}
}
}
}