Skip to content

feat(providers): add Xiaomi Token Plan (China, Singapore, Europe) - #1093

Merged
Astro-Han merged 1 commit into
mainfrom
feat/providers-xiaomi-token-plan
Jul 16, 2026
Merged

Astro-Han merged 1 commit into
mainfrom
feat/providers-xiaomi-token-plan

Conversation

@Astro-Han

Copy link
Copy Markdown
Contributor

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, category domestic
  • xiaomi-token-plan-sgp — Xiaomi Token Plan (Singapore), https://token-plan-sgp.xiaomimimo.com/v1, category overseas
  • xiaomi-token-plan-ams — Xiaomi Token Plan (Europe), https://token-plan-ams.xiaomimimo.com/v1, category overseas

Each 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 /v1 endpoint publishes no /models list). Brand marks reuse the already-vendored xiaomimimo.svg (no new SVG, no THIRD_PARTY_LICENSES change).

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 deprecated mimo-v2-pro (2026-06-30) and speech-only mimo-v2-tts / mimo-v2.5-tts* models; the guard asserts functionCalling on 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-plan precedent (#914), no packages/headless/src/provider-env.ts entry is added; headless credential loading and Harbor cell resolution both resolve apiKey === '' 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 /v1 OpenAI-compatible path, same tp- 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

  • Added apps/desktop/src/renderer/settings/provider-display-copy.ts entries for the three ids. This file is a required exhaustive Record<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.
  • The generated packages/core/src/model-metadata.generated.ts was regenerated via npm 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.
  • No packages/runtime/src/model-factory.ts buildProviderOptions case was added. The existing xiaomi direct 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 fail
  • npm --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 skipped
  • npm --workspace @maka/headless test — 1010 pass / 0 fail / 1 skipped
  • npm --workspace maka-agent test — 409 pass / 0 fail
  • npm --workspace @maka/desktop test — 2556 pass / 0 fail
  • npm run check:stale — dist is fresh
  • git diff --check — clean

No 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:

  • Auth header: official examples use an api-key header while models.dev marks the ids openai-compatible (implying Bearer). This PR sends Bearer to match the existing xiaomi direct provider. Not empirically verified.
  • GET /models: the Token Plan /v1 endpoint's discovery behavior is undocumented and unverified; modeled as fallback (no /models request), matching the coding-only interactive contract.

@Astro-Han
Astro-Han force-pushed the feat/providers-xiaomi-token-plan branch from 1ef5b5b to dc2f92e Compare July 16, 2026 09:17
@Astro-Han
Astro-Han merged commit 3343a16 into main Jul 16, 2026
3 checks passed
@Astro-Han
Astro-Han deleted the feat/providers-xiaomi-token-plan branch July 16, 2026 09:21
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