@lesetong/pi-mimo
Pi extension for Xiaomi MiMo AI models with multi-region & auth.json support
Package details
Install @lesetong/pi-mimo from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@lesetong/pi-mimo- Package
@lesetong/pi-mimo- Version
1.4.3- Published
- May 1, 2026
- Downloads
- not available
- Author
- lesetong
- License
- MIT
- Types
- extension
- Size
- 14.7 KB
- Dependencies
- 0 dependencies ยท 2 peers
Pi manifest JSON
{
"extensions": [
"./extensions/index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
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-mimo
Via git (GitHub)
pi install git:github.com/leset0ng/pi-mimo
Setup
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" }
EOF
Note: 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:
pi
Select 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.ts
How 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