From 24f04ad6f81636e39ba9ef9f559e4c9c775d7134 Mon Sep 17 00:00:00 2001 From: Bastion Date: Mon, 18 May 2026 14:58:08 -0700 Subject: [PATCH] Xiaomi MiMo provider profile - sends reasoning_effort to MiMo API The bundled Xiaomi profile lacks build_api_kwargs_extras, so reasoning_effort was parsed from config but silently dropped. This user plugin overrides the profile with the missing method. Mapping: xhigh->high, high->high, medium->medium, low->low, none->omit --- SKILL.md | 23 ++++++++++++ plugins/model-providers/xiaomi/__init__.py | 43 ++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 SKILL.md create mode 100644 plugins/model-providers/xiaomi/__init__.py diff --git a/SKILL.md b/SKILL.md new file mode 100644 index 0000000..e4dd50a --- /dev/null +++ b/SKILL.md @@ -0,0 +1,23 @@ +# Xiaomi MiMo Provider Profile + +Sends `reasoning_effort` as a top-level API parameter to the Xiaomi MiMo API. + +## What it fixes + +The bundled Xiaomi provider profile in Hermes does not include a `build_api_kwargs_extras` method, so the `reasoning_effort` parameter from config is parsed but silently dropped. This plugin overrides that profile with the missing method. + +## Mapping + +- `xhigh` → `high` (MiMo API only accepts low/medium/high) +- `high` → `high` +- `medium` → `medium` +- `low` → `low` +- `none`/empty → omitted + +## Installation + +Deployed as a user plugin to `/opt/data/plugins/model-providers/xiaomi/`. User plugins load after bundled ones with last-writer-wins, so this persists across container restarts without modifying the image. + +## Files + +- `plugins/model-providers/xiaomi/__init__.py` — Provider profile override diff --git a/plugins/model-providers/xiaomi/__init__.py b/plugins/model-providers/xiaomi/__init__.py new file mode 100644 index 0000000..f5ef216 --- /dev/null +++ b/plugins/model-providers/xiaomi/__init__.py @@ -0,0 +1,43 @@ +"""Xiaomi MiMo provider profile — user override. + +Extends the bundled Xiaomi profile to send ``reasoning_effort`` as a +top-level API parameter. The MiMo API accepts ``low``, ``medium``, +``high`` (``xhigh`` is clamped to ``high``). +""" + +from __future__ import annotations + +from typing import Any + +from providers import register_provider +from providers.base import ProviderProfile + + +class XiaomiProfile(ProviderProfile): + """Xiaomi MiMo — top-level reasoning_effort.""" + + def build_api_kwargs_extras( + self, *, reasoning_config: dict | None = None, model: str | None = None, **context + ) -> tuple[dict[str, Any], dict[str, Any]]: + extra_body: dict[str, Any] = {} + top_level: dict[str, Any] = {} + + if isinstance(reasoning_config, dict): + effort = (reasoning_config.get("effort") or "").strip().lower() + if effort in ("xhigh",): + top_level["reasoning_effort"] = "high" + elif effort in ("low", "medium", "high"): + top_level["reasoning_effort"] = effort + + return extra_body, top_level + + +xiaomi = XiaomiProfile( + name="xiaomi", + aliases=("mimo", "xiaomi-mimo"), + env_vars=("XIAOMI_API_KEY",), + base_url="https://api.xiaomimimo.com/v1", + supports_health_check=False, +) + +register_provider(xiaomi)