Skip to content

fix(normalize): lowercase Xiaomi model IDs for case-insensitive config - #15066

Merged
kshitijk4poor merged 1 commit into
mainfrom
fix/xiaomi-model-case-insensitive
Apr 24, 2026
Merged

fix(normalize): lowercase Xiaomi model IDs for case-insensitive config#15066
kshitijk4poor merged 1 commit into
mainfrom
fix/xiaomi-model-case-insensitive

Conversation

@kshitijk4poor

@kshitijk4poor kshitijk4poor commented Apr 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

Xiaomi's API (api.xiaomimimo.com) requires lowercase model IDs like mimo-v2.5-pro but rejects mixed-case names like MiMo-V2.5-Pro. Users naturally copy the marketing-style case from docs and the ProviderEntry description (MiMo-V2.5 and V2 models — pro, omni, flash), then hit unrecognized model errors.

Problem

normalize_model_for_provider() for the xiaomi provider (in _MATCHING_PREFIX_STRIP_PROVIDERS) only strips the xiaomi/ prefix but does not normalize case. So:

User config Sent to API Result
mimo-v2.5-pro mimo-v2.5-pro ✅ Works
MiMo-V2.5-Pro MiMo-V2.5-Pro ❌ API rejects
xiaomi/MiMo-V2.5-Pro MiMo-V2.5-Pro ❌ API rejects

Fix

  • Add _LOWERCASE_MODEL_PROVIDERS frozenset (currently just xiaomi) in model_normalize.py
  • Apply .lower() after prefix stripping for providers in this set
  • Other providers (minimax, zai, etc.) are not affected — their APIs accept mixed case

After fix

User config Sent to API Result
mimo-v2.5-pro mimo-v2.5-pro ✅ Works
MiMo-V2.5-Pro mimo-v2.5-pro ✅ Works
xiaomi/MiMo-V2.5-Pro mimo-v2.5-pro ✅ Works
MIMO-V2.5-PRO mimo-v2.5-pro ✅ Works

Test plan

  • 15 new tests in test_xiaomi_provider.py:
    • 8 parametrized tests for mixed-case bare names (all model variants)
    • 3 parametrized tests for prefix+case combos
    • 3 parametrized edge-case tests (None, empty, whitespace)
    • 1 invariant test: _LOWERCASE_MODEL_PROVIDERS ⊆ _MATCHING_PREFIX_STRIP_PROVIDERS
  • All 52 Xiaomi provider tests pass
  • All 55 model normalization tests pass
  • 317 total tests across related suites — 0 new failures
  • Cross-provider non-regression verified: minimax, zai, kimi-coding, alibaba, arcee all preserve case
  • Aggregator paths (openrouter, nous) unaffected

Files changed

  • hermes_cli/model_normalize.py — add _LOWERCASE_MODEL_PROVIDERS, apply .lower() in the direct-provider normalization path, add docstring example
  • tests/hermes_cli/test_xiaomi_provider.py — 15 new tests for case-insensitive normalization + invariant + edge cases

Xiaomi's API (api.xiaomimimo.com) requires lowercase model IDs like
"mimo-v2.5-pro" but rejects mixed-case names like "MiMo-V2.5-Pro"
that users copy from marketing docs or the ProviderEntry description.

Add _LOWERCASE_MODEL_PROVIDERS set and apply .lower() to model names
for providers in this set (currently just xiaomi) after stripping the
provider prefix. This ensures any case variant in config.yaml is
normalized before hitting the API.

Other providers (minimax, zai, etc.) are NOT affected — their APIs
accept mixed case (e.g. MiniMax-M2.7).
@kshitijk4poor
kshitijk4poor force-pushed the fix/xiaomi-model-case-insensitive branch from 1f7e0a3 to 00a770c Compare April 24, 2026 10:30
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/cli CLI entry point, hermes_cli/, setup wizard provider/xiaomi Xiaomi MiLM labels Apr 24, 2026
@kshitijk4poor
kshitijk4poor merged commit 7897f65 into main Apr 24, 2026
@kshitijk4poor
kshitijk4poor deleted the fix/xiaomi-model-case-insensitive branch April 24, 2026 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have provider/xiaomi Xiaomi MiLM type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants