Repository navigation
feat(providers): add Xiaomi Token Plan (China, Singapore, Europe) - #1093
Merged
Merged
Conversation
Astro-Han
force-pushed
the
feat/providers-xiaomi-token-plan
branch
from
July 16, 2026 09:17
1ef5b5b to
dc2f92e
Compare
57 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Part of #860. Adds the Xiaomi MiMo Token Plan subscription as a three-region cohort under three independent persisted provider ids:
xiaomi-token-plan-cn— Xiaomi Token Plan (China),https://token-plan-cn.xiaomimimo.com/v1, categorydomesticxiaomi-token-plan-sgp— Xiaomi Token Plan (Singapore),https://token-plan-sgp.xiaomimimo.com/v1, categoryoverseasxiaomi-token-plan-ams— Xiaomi Token Plan (Europe),https://token-plan-ams.xiaomimimo.com/v1, categoryoverseasEach is a registry-driven
plans-group provider:protocol: 'openai',runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },authKind: 'api_key',catalogBadge: 'Token',modelDiscovery: { kind: 'fallback' }(the Token Plan/v1endpoint publishes no/modelslist). Brand marks reuse the already-vendoredxiaomimimo.svg(no new SVG, noTHIRD_PARTY_LICENSESchange).fallbackModels=['mimo-v2.5-pro', 'mimo-v2.5']for all three regions. This is a hard-coded, guard-asserted allowlist. models.dev's snapshot for these ids still carries the deprecatedmimo-v2-pro(2026-06-30) and speech-onlymimo-v2-tts/mimo-v2.5-tts*models; the guard assertsfunctionCallingon the two documented MiMo chat models and the allowlist deliberately excludes every deprecated and TTS/ASR model.License policy (interactive-only): Token Plan is officially coding-only and prohibits API automation. Following the
tencent-token-planprecedent (#914), nopackages/headless/src/provider-env.tsentry is added; headless credential loading and Harbor cell resolution both resolveapiKey === ''even when an env key and a credentials file are present, asserted by new boundary tests.Why one PR for three regions
The three regions are identical along every dimension except hostname — same protocol, same
/v1OpenAI-compatible path, sametp-key namespace, same model set, same coding-only license, same fallback/discovery behavior. Splitting would produce three near-duplicate reviews with no independent build/test/review boundary, so they ship as one cohort.Deviations from the playbook
apps/desktop/src/renderer/settings/provider-display-copy.tsentries for the three ids. This file is a required exhaustiveRecord<ProviderType, ...>; the compiler flagged it once the registry keys were added. The playbook's file inventory did not list it, but it is mandatory wiring, not gold-plating.packages/core/src/model-metadata.generated.tswas regenerated vianpm run sync:model-metadata, then reduced to only the three new provider blocks (plus the three type-union updates). The live models.dev fetch also carried unrelated drift for other providers (ollama-cloud, openrouter, etc.); that drift was excluded to keep this PR scoped and avoid conflicts with the parallel Alibaba slices.packages/runtime/src/model-factory.tsbuildProviderOptionscase was added. The existingxiaomidirect provider uses the same MiMo models with no reasoning-effort wiring and passes the conformance matrix; the runtime gap report is clean for all three new ids, so no case or override is warranted.Verification
Run from the worktree; all deterministic, on the inert defaults (no live provider calls).
npm run typecheck— pass (all workspaces)npm run test:scripts— 109 pass / 0 fail (includes the new Xiaomi Token Plan sync test)npm --workspace @maka/core test— 1043 pass / 0 failnpm --workspace @maka/runtime test— 1974 pass / 0 fail / 7 skipped (conformance matrix gap report clean for the three new ids)npm --workspace @maka/storage test— 284 pass / 0 fail / 1 skippednpm --workspace @maka/headless test— 1010 pass / 0 fail / 1 skippednpm --workspace maka-agent test— 409 pass / 0 failnpm --workspace @maka/desktop test— 2556 pass / 0 failnpm run check:stale— dist is freshgit diff --check— cleanNo sanitized live smoke was run: maintainers have no Token Plan subscription, so all coverage is from deterministic tests. Unconfirmed items from the facts research, to be corrected on user feedback:
api-keyheader while models.dev marks the idsopenai-compatible(implying Bearer). This PR sends Bearer to match the existingxiaomidirect provider. Not empirically verified.GET /models: the Token Plan/v1endpoint's discovery behavior is undocumented and unverified; modeled asfallback(no/modelsrequest), matching the coding-only interactive contract.