Adds a FastAPI-based local proxy that remaps Claude model IDs to Xiaomi MiMo and forwards requests to MiMo's Anthropic-compatible API. Includes launchers for Windows (start.ps1), macOS/Linux (start.sh), and Docker. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2.7 KiB
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)
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt
Copy-Item .env.example .env
macOS / Linux (bash)
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
Docker
No local Python setup needed.
docker build -t mimo-gateway .
Configure the API key
Open .env and replace the placeholder with your Xiaomi MiMo API key:
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)
.\start.ps1
macOS / Linux (bash)
chmod +x start.sh # first time only
./start.sh
Docker
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
curl -i http://127.0.0.1:8787/v1/models
curl -i http://127.0.0.1:8787/health
To test a message:
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.