Skip to content

feat(models): add Xiaomi MiMo model family - #2200

Merged
steebchen merged 10 commits into
theopenco:mainfrom
analogpvt:feat/add-xiaomi-mimo-models
May 7, 2026
Merged

steebchen merged 10 commits into
theopenco:mainfrom
analogpvt:feat/add-xiaomi-mimo-models

Conversation

@analogpvt

@analogpvt analogpvt commented May 7, 2026 •

Copy link
Copy Markdown
Contributor

Adds Xiaomi as a new provider and registers all MiMo models from the official model page:

Provider

  • xiaomi — endpoint: https://api.xiaomimimo.com/v1

Models

Model Context Max Output Capabilities
mimo-v2.5-pro 1M 128K reasoning, tools, JSON, streaming
mimo-v2-pro 1M 128K reasoning, tools, JSON, streaming
mimo-v2.5 1M 128K vision, reasoning, tools, JSON, streaming
mimo-v2-omni 256K 128K vision, tools, JSON, streaming
mimo-v2-flash 256K — reasoning, tools, JSON, streaming

Pricing (overseas, USD / 1M tokens)

  • mimo-v2.5-pro / mimo-v2-pro: ≤256K: $1 in / $3 out | ≤1M: $2 in / $6 out
  • mimo-v2.5: ≤256K: $0.40 in / $2 out | ≤1M: $0.80 in / $4 out
  • mimo-v2-omni: $0.40 in / $2 out
  • mimo-v2-flash: $0.10 in / $0.30 out

Files changed

  • packages/models/src/models/xiaomi.ts — new model definitions
  • packages/models/src/providers.ts — added xiaomi provider
  • packages/models/src/models.ts — registered xiaomiModels
  • packages/actions/src/get-provider-endpoint.ts — added xiaomi endpoint routing

Summary by CodeRabbit

  • New Features

    • Added Xiaomi MiMo provider with five new models (mimo-v2.5-pro, mimo-v2-pro, mimo-v2.5, mimo-v2-omni, mimo-v2-flash)
    • Xiaomi models support streaming, vision, tools, JSON output, and advanced reasoning
  • Configuration

    • Default Xiaomi API endpoint included; optional environment variable can override it
    • Required API key placeholder added to example env files
  • Tests

    • Added tests for Xiaomi endpoint resolution and custom base URL handling

@coderabbitai

coderabbitai Bot commented May 7, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds 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.

Changes

Xiaomi Provider Integration

Layer / File(s) Summary
Model Definitions
packages/models/src/models/xiaomi.ts
Defines five Xiaomi models with metadata, provider pricing/tiers, context/output limits, and capability flags.
Model Registry
packages/models/src/models.ts
Imports xiaomiModels and inserts ...xiaomiModels into the exported models array.
Provider Metadata
packages/models/src/providers.ts
Registers Xiaomi provider object (id: "xiaomi") with required LLM_XIAOMI_API_KEY (optional LLM_XIAOMI_BASE_URL), streaming: true, cancellation: true.
Endpoint Configuration
packages/actions/src/get-provider-endpoint.ts
Adds "xiaomi" to base URL resolution and provider endpoint switch; uses env baseUrl or defaults to https://api.xiaomimimo.com.
Environment Examples
.env.example, .env.unified.example
Adds LLM_XIAOMI_API_KEY placeholder and commented LLM_XIAOMI_BASE_URL template lines.
Tests
packages/actions/src/get-provider-endpoint.spec.ts
Adds tests for Xiaomi endpoint default, custom baseUrl, and streaming invocation behavior; captures/restores env var.
CI Workflow Env
.github/workflows/e2e.yml
Passes LLM_XIAOMI_API_KEY secret into the e2e shard step environment used by vitest.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • theopenco/llmgateway#2051: Both PRs modify the same code surfaces (get-provider-endpoint.ts, providers.ts, models exports, and .env examples) to add a new LLM provider entry and wiring.
  • theopenco/llmgateway#2087: Modifies get-provider-endpoint.ts base URL/endpoint resolution for specific providers; related control flow changes.
  • theopenco/llmgateway#2064: Updates provider endpoint resolution in get-provider-endpoint.ts, touching similar control flow.

Suggested reviewers

  • steebchen
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately reflects the main change: adding the Xiaomi MiMo model family as a new provider with associated model definitions.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 177c590 and bbb1cd2.

📒 Files selected for processing (4)
  • packages/actions/src/get-provider-endpoint.ts
  • packages/models/src/models.ts
  • packages/models/src/models/xiaomi.ts
  • packages/models/src/providers.ts

Comment thread packages/models/src/models/xiaomi.ts
@analogpvt
analogpvt force-pushed the feat/add-xiaomi-mimo-models branch from e4d83f4 to b5517e6 Compare May 7, 2026 17:52

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between bbb1cd2 and e4d83f4.

📒 Files selected for processing (5)
  • .env.example
  • .env.unified.example
  • packages/actions/src/get-provider-endpoint.spec.ts
  • packages/actions/src/get-provider-endpoint.ts
  • packages/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

Comment thread packages/actions/src/get-provider-endpoint.spec.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
packages/actions/src/get-provider-endpoint.spec.ts (1)

253-261: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Default Xiaomi endpoint test is not environment-isolated.

Line 253 depends on process env through provider resolution; if LLM_XIAOMI_BASE_URL is 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

📥 Commits

Reviewing files that changed from the base of the PR and between e4d83f4 and fe6d6d0.

📒 Files selected for processing (7)
  • .env.example
  • .env.unified.example
  • packages/actions/src/get-provider-endpoint.spec.ts
  • packages/actions/src/get-provider-endpoint.ts
  • packages/models/src/models.ts
  • packages/models/src/models/xiaomi.ts
  • packages/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

openclaw and others added 9 commits May 8, 2026 02:56
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
@analogpvt
analogpvt force-pushed the feat/add-xiaomi-mimo-models branch from 303f307 to ca28db4 Compare May 7, 2026 19:01
@steebchen
steebchen enabled auto-merge May 7, 2026 19:03
@steebchen
steebchen added this pull request to the merge queue May 7, 2026
Merged via the queue into theopenco:main with commit d792e98 May 7, 2026
10 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