Skip to content

feat(ai): add Xiaomi MiMo Token Plan support#578

Merged
wyuc merged 1 commit into
THU-MAIC:mainfrom
xuruiray:codex/add-xiaomi-mimo-provider-pr
May 17, 2026
Merged

feat(ai): add Xiaomi MiMo Token Plan support#578
wyuc merged 1 commit into
THU-MAIC:mainfrom
xuruiray:codex/add-xiaomi-mimo-provider-pr

Conversation

@xuruiray
Copy link
Copy Markdown
Contributor

Summary

Add Xiaomi MiMo Token Plan support to the built-in Xiaomi provider and make the model connection check use the same unified LLM wrapper as normal generation.

Related Issues

N/A

Changes

  • Added Xiaomi MiMo Token Plan OpenAI-compatible Base URL presets for China, Singapore, and Europe.
  • Expanded the built-in Xiaomi MiMo model catalog to include mimo-v2-pro, mimo-v2-omni, and mimo-v2-flash alongside the existing V2.5 models.
  • Added thinking metadata for the added MiMo models.
  • Updated /api/verify-model to call through callLLM with thinking disabled, so OpenAI-compatible provider request adapters are applied during connection tests.
  • Added Xiaomi provider and verify-model route tests.
  • Documented MiMo Token Plan setup in .env.example, README.md, and README-zh.md, with locale labels for the new Base URL chips.
  • Fixed the OpenAI-compatible fetch wrapper assignment for Next/TypeScript build compatibility.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • CI/CD or build changes

Verification

Steps to reproduce / test

  1. Configure Xiaomi Token Plan credentials with MIMO_API_KEY=tp-..., MIMO_BASE_URL=https://token-plan-cn.xiaomimimo.com/v1, and DEFAULT_MODEL=xiaomi:mimo-v2.5-pro.
  2. Use the settings model connection test or any server-side LLM call path using xiaomi:mimo-v2.5-pro.
  3. Confirm the model returns text successfully and the Token Plan endpoint is used.

What I personally verified

  • pnpm vitest run tests/ai/xiaomi-provider.test.ts tests/api/verify-model.test.ts tests/ai/openai-provider.test.ts tests/server/provider-config.test.ts tests/ai/thinking-config.test.ts
    • Result: 5 test files passed, 62 tests passed.
  • pnpm test
    • Result: 47 test files passed, 338 tests passed.
  • pnpm check:i18n-keys
    • Result: passed for 6 locale files.
  • pnpm check
    • Result: all matched files use Prettier style.
  • pnpm lint
    • Result: 0 errors, 7 existing warnings in unrelated files.
  • pnpm build
    • Result: compiled successfully; Next emitted existing workspace-root and middleware convention warnings.
  • Real Xiaomi MiMo Token Plan smoke via getModel + callLLM against https://token-plan-cn.xiaomimimo.com/v1, using mimo-v2.5-pro and thinking disabled.
    • Sanitized result: text=MIMO_OK, inputTokens=263, outputTokens=4, reasoningTokens=0.

Evidence

  • CI passes (pnpm check && pnpm lint && npx tsc --noEmit)
  • Manually tested locally
  • Screenshots / recordings attached (if UI changes)

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have added/updated documentation as needed
  • My changes do not introduce new warnings

Summary:
- Added Xiaomi MiMo Token Plan regional endpoints and expanded the MiMo model catalog.
- Routed model verification through the unified LLM wrapper with thinking disabled.
- Documented MiMo Token Plan setup and added provider/verification tests.

Rationale:
- Token Plan keys require Token Plan base URLs, and verify-model needs the provider-specific request wrapper to work reliably with OpenAI-compatible reasoning params.

Tests:
- pnpm vitest run tests/ai/xiaomi-provider.test.ts tests/api/verify-model.test.ts tests/ai/openai-provider.test.ts tests/server/provider-config.test.ts tests/ai/thinking-config.test.ts
- pnpm test
- pnpm check:i18n-keys
- pnpm check
- pnpm lint (0 errors, existing warnings only)
- pnpm build
- MiMo Token Plan smoke via getModel + callLLM against https://token-plan-cn.xiaomimimo.com/v1 with mimo-v2.5-pro returned MIMO_OK

Co-authored-by: Codex <codex@openai.com>
Copy link
Copy Markdown
Contributor

@wyuc wyuc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Verified the model-metadata wiring and the verify-model refactor; also checked the settings UI locally (Token Plan chips + 5 models render fine, no component change).

No Token Plan key on my side, so no e2e against the real endpoints — relying on the author's smoke test + green CI.

Approving.

@wyuc wyuc merged commit 679130a into THU-MAIC:main May 17, 2026
2 checks passed
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.

2 participants