@lesetong/pi-mimo
v1.4.3
Published
Pi extension for Xiaomi MiMo AI models with multi-region & auth.json support
Downloads
425
Maintainers
Readme
@lesetong/pi-mimo
Pi extension for Xiaomi MiMo AI models. Auto-discovers and registers all available models from the MiMo API.
Supports multiple regions (CN / SGP / AMS) and both OpenAI-compatible and Anthropic-compatible protocols.
Install
Via npm
pi install npm:@lesetong/pi-mimoVia git (GitHub)
pi install git:github.com/leset0ng/pi-mimoSetup
Option 1: Environment variables
export MIMO_API_KEY="tp-xxxxx"
# Optional: choose region and protocol
export MIMO_BASE_URL="https://token-plan-sgp.xiaomimimo.com/v1"
export MIMO_API="openai-completions" # or "anthropic-messages"Option 2: pi auth.json (recommended)
Store everything in ~/.pi/agent/auth.json — no env vars needed:
{
"mimo": {
"type": "api_key",
"key": "tp-xxxxx",
"baseUrl": "https://token-plan-sgp.xiaomimimo.com/v1",
"api": "openai-completions"
}
}Or append with one command:
cat <<'EOF' >> ~/.pi/agent/auth.json
, "mimo": { "type": "api_key", "key": "tp-xxxxx", "baseUrl": "https://token-plan-sgp.xiaomimimo.com/v1", "api": "openai-completions" }
EOFNote: Make sure the resulting JSON is valid (no duplicate keys, proper commas).
Region & Protocol Matrix
| Region | OpenAI-compatible | Anthropic-compatible |
|--------|-------------------|----------------------|
| China (CN) | https://token-plan-cn.xiaomimimo.com/v1 | https://token-plan-cn.xiaomimimo.com/anthropic |
| Singapore (SGP) | https://token-plan-sgp.xiaomimimo.com/v1 | https://token-plan-sgp.xiaomimimo.com/anthropic |
| Europe (AMS) | https://token-plan-ams.xiaomimimo.com/v1 | https://token-plan-ams.xiaomimimo.com/anthropic |
Default: Singapore OpenAI-compatible (https://token-plan-sgp.xiaomimimo.com/v1).
Usage
Start pi normally — MiMo models appear under the mimo provider:
piSelect a MiMo model with /model or use mimo/<model-id> directly.
Development
Test locally without publishing:
# With env variables
MIMO_API_KEY="tp-xxxxx" MIMO_BASE_URL="https://token-plan-cn.xiaomimimo.com/v1" pi -e ./extensions/index.ts
# With auth.json (ensure ~/.pi/agent/auth.json contains the mimo key)
pi -e ./extensions/index.tsHow it works
On startup, the extension:
- Reads config from
MIMO_API_KEY/MIMO_BASE_URL/MIMO_APIenv vars, or~/.pi/agent/auth.json - Fetches models from
<baseUrl>/models(falls back to OpenAI path for Anthropic endpoints) - Enriches with platform metadata from
https://platform.xiaomimimo.com/api/v1/models - Filters out non-coding models (TTS, image-gen, embeddings, etc.)
- Registers them under the
mimoprovider
License
MIT
