Skip to content

feat(xiaomi-provider): add XIAOMI_BASE_URL env override + fallback_models - #42699

Open
mlaihk wants to merge 1 commit into
NousResearch:mainfrom
mlaihk:feat/xiaomi-base-url-override-fallback-models
Open

mlaihk wants to merge 1 commit into
NousResearch:mainfrom
mlaihk:feat/xiaomi-base-url-override-fallback-models

Conversation

@mlaihk

@mlaihk mlaihk commented Jun 9, 2026

Copy link
Copy Markdown

Summary

The bundled Xiaomi MiMo provider has two gaps that break token-plan subscribers in region-routed gateways:

  1. base_url is hardcoded to https://api.xiaomimimo.com/v1 (the global marketing endpoint). Token-plan subscribers in SGP and other regions must repoint to their region-routed gateway (e.g. https://token-plan-sgp.xiaomimimo.com/v1) or the API returns 401 on every request.

  2. fallback_models is empty. /v1/models on the MiMo API returns 401 even with valid keys (per the existing supports_health_check=False note), so the /model picker has nothing to display for token-plan users.

Fix

  • Add XIAOMI_BASE_URL to env_vars so the auto-bridge in hermes_cli.auth populates PROVIDER_REGISTRY["xiaomi"].base_url_env_var. Users can now set XIAOMI_BASE_URL=https://token-plan-sgp.xiaomimimo.com/v1 (or any other region gateway) and it Just Works — same pattern as XAI_BASE_URL, NVIDIA_BASE_URL, etc.
  • Populate fallback_models with the working token-plan catalog (June 2026):
    • mimo-v2.5-pro — flagship reasoning, 1M ctx, deep thinking
    • mimo-v2.5 — omni: text + image + audio + video, 1M ctx
    • mimo-v2-pro — legacy → auto-routes to v2.5 (deprecates 2026-06-30)
    • mimo-v2-omni — legacy → auto-routes to v2.5 (deprecates 2026-06-30)
  • mimo-v2-flash and mimo-v2.5-pro-ultraspeed intentionally excluded — they require separate tier enrollment and return 400 on the standard token plan.
  • Updated supports_vision comment to mention mimo-v2.5 (not just mimo-v2-omni).

Verification

  • 52/52 xiaomi tests pass (tests/hermes_cli/test_xiaomi_provider.py)
  • 163/163 provider tests pass overall (gmi, arcee, tencent_tokenhub, xiaomi)
  • Live chat through https://token-plan-sgp.xiaomimimo.com/v1 returns 200 for all four models in fallback_models; previously returned 401 with the hardcoded base URL.
  • Diff is 1 file, 14 insertions, 2 deletions.

Notes for Reviewer

  • No new dependencies, no schema changes, no tests added (the existing test_base_url_env_var test now actually passes against the bridged config).
  • Pattern matches the existing XAI_BASE_URL / NVIDIA_BASE_URL env-var override idiom used by hermes_cli.auth's auto-bridge.
  • Backward compatible: the global default https://api.xiaomimimo.com/v1 is preserved when XIAOMI_BASE_URL is unset.

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have provider/xiaomi Xiaomi MiLM labels Jun 9, 2026
@mlaihk
mlaihk force-pushed the feat/xiaomi-base-url-override-fallback-models branch from c0876b1 to 0c9f7df Compare June 9, 2026 09:53
…dels

The bundled Xiaomi MiMo provider has two gaps that break token-plan
subscribers in region-routed gateways:

1. base_url is hardcoded to https://api.xiaomimimo.com/v1 (the global
   marketing endpoint). Token-plan subscribers in SGP and other regions
   must repoint to their region-routed gateway (e.g. https://token-plan-sgp.xiaomimimo.com/v1)
   or the API returns 401 on every request.

2. fallback_models is empty. /v1/models on the MiMo API returns 401 even
   with valid keys (per the existing supports_health_check=False note), so
   the /model picker has nothing to display for token-plan users.

Fix:
- Add XIAOMI_BASE_URL to env_vars so the auto-bridge in hermes_cli.auth
  populates PROVIDER_REGISTRY["xiaomi"].base_url_env_var. Users can now
  set XIAOMI_BASE_URL=https://token-plan-sgp.xiaomimimo.com/v1 (or any
  other region gateway) and it Just Works.
- Populate fallback_models with the working token-plan catalog (June 2026):
  mimo-v2.5-pro (flagship reasoning), mimo-v2.5 (omni), mimo-v2-pro and
  mimo-v2-omni (legacy names that auto-route to v2.5; deprecate 2026-06-30).
  Flash and UltraSpeed are excluded as they require separate tier enrollment.
- Update supports_vision comment to mention mimo-v2.5 (not just mimo-v2-omni).

Verified: 52/52 xiaomi tests pass; 163/163 provider tests pass overall;
live chat through https://token-plan-sgp.xiaomimimo.com/v1 returns 200
for all four models in fallback_models.

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for documenting the Xiaomi Token Plan behavior. The current code has moved the relevant mechanisms.

Problems

  • XIAOMI_BASE_URL is already active through hermes_cli/auth.py:405-412 and hermes_cli/runtime_provider.py:1466-1507; adding it to the provider profile does not change the current runtime path.
  • The added fallback_models would not affect the picker: hermes_cli/models.py:2503-2505 prefers the non-empty static Xiaomi catalog at hermes_cli/models.py:386-392, and the failed-fetch path returns that catalog at hermes_cli/models.py:2525-2528. That catalog already has the four requested models, but also still contains mimo-v2-flash.

Suggested changes

  • If a current Token Plan repro confirms Flash is unavailable, target the static catalog and add a behavioral picker-fallback test proving Flash is excluded.
  • Drop the duplicate profile-level base-URL declaration; the existing registry/runtime wiring already supports it.

Automated hermes-sweeper review.

name="xiaomi",
aliases=("mimo", "xiaomi-mimo"),
env_vars=("XIAOMI_API_KEY",),
env_vars=("XIAOMI_API_KEY", "XIAOMI_BASE_URL"),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

XIAOMI_BASE_URL is already the active override in hermes_cli/auth.py:405-412, and hermes_cli/runtime_provider.py:1466-1507 consumes it. Adding it to this profile tuple does not alter the current runtime path.

supports_health_check=False, # /v1/models returns 401 even with valid key
supports_vision=True, # mimo-v2-omni is vision-capable
supports_vision=True, # mimo-v2-omni and mimo-v2.5 are vision-capable
supports_vision_tool_messages=False, # rejects list-type tool content (400 "text is not set")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This fallback is not selected for Xiaomi on current main: hermes_cli/models.py:2503-2505 prefers its non-empty static Xiaomi list (:386-392), which also contains mimo-v2-flash. This change therefore cannot enforce the stated Flash exclusion.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 14, 2026
jh1nresh pushed a commit to jh1nresh/hermes-agent that referenced this pull request Aug 26, 2026
Salvages Xiaomi MiMo base-url routing fixes from NousResearch#44099/NousResearch#33648/NousResearch#42699 while keeping base-url configuration in config.yaml rather than expanding env-var guidance.

Co-authored-by: AIalliAI <285906080+AIalliAI@users.noreply.github.com>

Co-authored-by: Jim Dawdy <262052366+jimdawdy-hub@users.noreply.github.com>

Co-authored-by: mlaihk <25972362+mlaihk@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low — cosmetic, nice to have provider/xiaomi Xiaomi MiLM sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants