feat(models): add Xiaomi MiMo model family - #2200
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughAdds Xiaomi provider support: registers provider metadata, defines five Xiaomi models and exports them, configures endpoint resolution with a default Xiaomi base URL, updates env example files, adds endpoint tests, and wires the e2e workflow to pass the Xiaomi API key. ChangesXiaomi Provider Integration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/models/src/models/xiaomi.ts`:
- Around line 163-178: The cachedInputPrice for the Xiaomi model entry with
modelName "mimo-v2-flash" is set to 0.01 / 1e6 (10%), inconsistent with other
Xiaomi models that use a 20% cached-read discount; verify the correct
cached-read rate from Xiaomi and, if it should be 20%, update the
cachedInputPrice for the object with providerId "xiaomi" and modelName
"mimo-v2-flash" to inputPrice * 0.20 (i.e., 0.02 / 1e6), keeping inputPrice,
outputPrice, and other fields unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 847534d8-f81a-4b4d-b170-7539ef771e77
📒 Files selected for processing (4)
packages/actions/src/get-provider-endpoint.tspackages/models/src/models.tspackages/models/src/models/xiaomi.tspackages/models/src/providers.ts
e4d83f4 to
b5517e6
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/actions/src/get-provider-endpoint.spec.ts`:
- Around line 252-261: The test "builds the default Xiaomi endpoint" is reading
process.env.LLM_XIAOMI_BASE_URL via getProviderEnvValue when it shouldn't;
update the test to be environment-safe by either (a) adding LLM_XIAOMI_BASE_URL
to the file's saved-original env var set and restoring it in afterEach (capture
original at top and restore in afterEach), and explicitly delete
process.env.LLM_XIAOMI_BASE_URL at the start of this test before calling
getProviderEndpoint("xiaomi", ...), or (b) call getProviderEndpoint("xiaomi", {
skipEnvVars: true }, "mimo-v2.5-pro") so getProviderEnvValue is bypassed—use the
approach consistent with other tests in this file.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 902757a1-e020-47f7-ba1b-c1413346e8e9
📒 Files selected for processing (5)
.env.example.env.unified.examplepackages/actions/src/get-provider-endpoint.spec.tspackages/actions/src/get-provider-endpoint.tspackages/models/src/providers.ts
✅ Files skipped from review due to trivial changes (2)
- .env.unified.example
- .env.example
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/models/src/providers.ts
There was a problem hiding this comment.
♻️ Duplicate comments (1)
packages/actions/src/get-provider-endpoint.spec.ts (1)
253-261:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winDefault Xiaomi endpoint test is not environment-isolated.
Line 253 depends on process env through provider resolution; if
LLM_XIAOMI_BASE_URLis set, this assertion becomes flaky. Please isolate/reset that env var in this suite (or force BYOK behavior for this case).Proposed minimal fix
const originalAzureFoundryApiVersion = process.env.LLM_AZURE_AI_FOUNDRY_API_VERSION; +const originalXiaomiBaseUrl = process.env.LLM_XIAOMI_BASE_URL; @@ if (originalAzureFoundryApiVersion === undefined) { delete process.env.LLM_AZURE_AI_FOUNDRY_API_VERSION; } else { process.env.LLM_AZURE_AI_FOUNDRY_API_VERSION = originalAzureFoundryApiVersion; } + + if (originalXiaomiBaseUrl === undefined) { + delete process.env.LLM_XIAOMI_BASE_URL; + } else { + process.env.LLM_XIAOMI_BASE_URL = originalXiaomiBaseUrl; + } }); @@ it("builds the default Xiaomi endpoint", () => { + delete process.env.LLM_XIAOMI_BASE_URL; + const endpoint = getProviderEndpoint( "xiaomi", undefined, "mimo-v2.5-pro", );🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/actions/src/get-provider-endpoint.spec.ts` around lines 253 - 261, The test for getProviderEndpoint ("builds the default Xiaomi endpoint") is flaky because it reads process.env.LLM_XIAOMI_BASE_URL; update the test to isolate the environment by temporarily clearing or stubbing process.env.LLM_XIAOMI_BASE_URL (or explicitly force BYOK flag) around the call to getProviderEndpoint so the function resolves the default URL; ensure you restore the original env value after the test to avoid cross-test pollution and reference getProviderEndpoint and the "builds the default Xiaomi endpoint" test name when making the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Duplicate comments:
In `@packages/actions/src/get-provider-endpoint.spec.ts`:
- Around line 253-261: The test for getProviderEndpoint ("builds the default
Xiaomi endpoint") is flaky because it reads process.env.LLM_XIAOMI_BASE_URL;
update the test to isolate the environment by temporarily clearing or stubbing
process.env.LLM_XIAOMI_BASE_URL (or explicitly force BYOK flag) around the call
to getProviderEndpoint so the function resolves the default URL; ensure you
restore the original env value after the test to avoid cross-test pollution and
reference getProviderEndpoint and the "builds the default Xiaomi endpoint" test
name when making the change.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 25ccc995-b1af-4feb-9abd-7547c2541446
📒 Files selected for processing (7)
.env.example.env.unified.examplepackages/actions/src/get-provider-endpoint.spec.tspackages/actions/src/get-provider-endpoint.tspackages/models/src/models.tspackages/models/src/models/xiaomi.tspackages/models/src/providers.ts
✅ Files skipped from review due to trivial changes (2)
- .env.unified.example
- .env.example
🚧 Files skipped from review as they are similar to previous changes (3)
- packages/actions/src/get-provider-endpoint.ts
- packages/models/src/providers.ts
- packages/models/src/models/xiaomi.ts
Add Xiaomi as a new provider and register all MiMo models: - mimo-v2.5-pro: 1T params, 42B activations, 1M context, deep thinking - mimo-v2-pro: 1T params, 42B active, 1M context, hybrid attention - mimo-v2.5: Full-modal perception (vision+audio+text), 1M context - mimo-v2-omni: Multimodal (text+vision+speech), 256K context - mimo-v2-flash: High-efficiency inference, 256K context Provider endpoint: https://api.xiaomimimo.com/v1 Pricing tiers based on official platform.xiaomimimo.com rates.
- Add 3 endpoint tests for xiaomi provider (default, custom URL, streaming) - Make base URL configurable via LLM_XIAOMI_BASE_URL env var - Add LLM_XIAOMI_API_KEY to .env.example and .env.unified.example - Verified all 5 models work via live API (basic, streaming, tool calling) Co-authored-by: openclaw <openclaw@users.noreply.github.com>
The flash model has a distinct 10% cached-read discount ratio (0.01/0.10) per official pricing, unlike other MiMo models at 20%.
Add LLM_XIAOMI_BASE_URL to the save/restore pattern in afterEach, and delete it at the start of tests that assert against the default URL. Prevents false failures when the env var is set in the test environment.
Add XiaomiIcon SVG component and register it in ProviderIcons and providerLogoUrls maps. Uses the official Xiaomi logo with orange rounded-rect background and white 'mi' lettering.
The provider-keys component has its own providerLogoUrls map that was missing xiaomi (and a few other newer providers). Added xiaomi plus azure-ai-foundry, minimax, bytedance, and embercloud for completeness.
…ning content - mimo-v2.5-pro, mimo-v2-pro, mimo-v2.5: confirmed to return reasoning_content - mimo-v2-flash: keeps reasoningOutput omit (no reasoning_content in response) - Verified via e2e tests: all 3 reasoning models pass
303f307 to
ca28db4
Compare
Adds Xiaomi as a new provider and registers all MiMo models from the official model page:
Provider
https://api.xiaomimimo.com/v1Models
Pricing (overseas, USD / 1M tokens)
Files changed
packages/models/src/models/xiaomi.ts— new model definitionspackages/models/src/providers.ts— added xiaomi providerpackages/models/src/models.ts— registered xiaomiModelspackages/actions/src/get-provider-endpoint.ts— added xiaomi endpoint routingSummary by CodeRabbit
New Features
Configuration
Tests