# MiMo Local Gateway for Claude Desktop A small local compatibility gateway that presents Anthropic-style model names to Claude Desktop and forwards requests to Xiaomi MiMo's Anthropic-compatible API. ## Install Python 3.11 or newer is required. ### Windows (PowerShell) ```powershell python -m venv .venv .\.venv\Scripts\Activate.ps1 pip install -r requirements.txt Copy-Item .env.example .env ``` ### macOS / Linux (bash) ```bash python3 -m venv .venv source .venv/bin/activate pip install -r requirements.txt cp .env.example .env ``` ### Docker No local Python setup needed. ```bash docker build -t mimo-gateway . ``` ### Configure the API key Open `.env` and replace the placeholder with your Xiaomi MiMo API key: ```dotenv MIMO_API_KEY=your_new_xiaomi_key_here MIMO_BASE_URL=https://api.xiaomimimo.com/anthropic ``` The API key is loaded locally, is never logged, and `.env` is excluded from Git. ## Run ### Windows (PowerShell) ```powershell .\start.ps1 ``` ### macOS / Linux (bash) ```bash chmod +x start.sh # first time only ./start.sh ``` ### Docker ```bash docker run --rm -p 8787:8787 --env-file .env mimo-gateway ``` By default, the gateway listens only at `http://127.0.0.1:8787`. ## Test ```bash curl -i http://127.0.0.1:8787/v1/models curl -i http://127.0.0.1:8787/health ``` To test a message: ```bash curl -s http://127.0.0.1:8787/v1/messages \ -H "Authorization: Bearer dummy" \ -H "Content-Type: application/json" \ -d '{ "model": "claude-sonnet-4-5", "max_tokens": 32, "messages": [{"role": "user", "content": [{"type": "text", "text": "Reply with only OK."}]}], "stream": false }' ``` ## Configure Claude Desktop Use these third-party inference settings: | Setting | Value | |---|---| | Gateway base URL | `http://127.0.0.1:8787` | | Gateway API key | `dummy` | | Auth scheme | `bearer` | | Model ID | `claude-sonnet-4-5` | | Display name | `MiMo 2.5 Pro` | | Tier alias | `sonnet` | | Offer 1M-context variant | Off | For the explicit 1M model, use: | Setting | Value | |---|---| | Model ID | `claude-sonnet-4-5-1m` | | Display name | `MiMo 2.5 Pro 1M` | | Tier alias | `sonnet` | | Offer 1M-context variant | Off | ## Model mapping The gateway maps both bare and `anthropic/`-prefixed Claude-style names: | Incoming model | Xiaomi MiMo model | |---|---| | `claude-sonnet-4-5` | `mimo-v2.5-pro` | | `anthropic/claude-sonnet-4-5` | `mimo-v2.5-pro` | | `claude-sonnet-4-5-1m` | `mimo-v2.5-pro[1m]` | | `anthropic/claude-sonnet-4-5-1m` | `mimo-v2.5-pro[1m]` | Token counting is forwarded when Xiaomi supports it; otherwise the gateway returns a safe local approximation. To change the bind address or port, set `HOST` or `PORT` in `.env`. Keep `HOST=127.0.0.1` unless you intentionally want other devices to reach the gateway.