feat(ai): switch xiaomi default to api billing, add per-region token plan providers (#4112)
Built-in `xiaomi` provider now targets the API billing endpoint (https://api.xiaomimimo.com/anthropic) — a single stable URL for keys issued at platform.xiaomimimo.com. The Token Plan endpoints are exposed as three sibling providers, each with its own env var: - xiaomi-token-plan-cn: XIAOMI_TOKEN_PLAN_CN_API_KEY - xiaomi-token-plan-ams: XIAOMI_TOKEN_PLAN_AMS_API_KEY - xiaomi-token-plan-sgp: XIAOMI_TOKEN_PLAN_SGP_API_KEY BREAKING CHANGE: users who previously set XIAOMI_API_KEY against the Token Plan AMS endpoint must move to xiaomi-token-plan-ams and set XIAOMI_TOKEN_PLAN_AMS_API_KEY. This also resolves the 401 reported by on #4005, where a platform.xiaomimimo.com key fails against the Token Plan endpoint. closes #4082
This commit is contained in:
@@ -69,9 +69,10 @@ pi
|
||||
| Kimi For Coding | `KIMI_API_KEY` | `kimi-coding` |
|
||||
| MiniMax | `MINIMAX_API_KEY` | `minimax` |
|
||||
| MiniMax (China) | `MINIMAX_CN_API_KEY` | `minimax-cn` |
|
||||
| Xiaomi MiMo Token Plan | `XIAOMI_API_KEY` | `xiaomi` |
|
||||
|
||||
The Xiaomi MiMo provider targets the Xiaomi MiMo Token Plan Anthropic-compatible endpoint.
|
||||
| Xiaomi MiMo | `XIAOMI_API_KEY` | `xiaomi` |
|
||||
| Xiaomi MiMo Token Plan (China) | `XIAOMI_TOKEN_PLAN_CN_API_KEY` | `xiaomi-token-plan-cn` |
|
||||
| Xiaomi MiMo Token Plan (Amsterdam) | `XIAOMI_TOKEN_PLAN_AMS_API_KEY` | `xiaomi-token-plan-ams` |
|
||||
| Xiaomi MiMo Token Plan (Singapore) | `XIAOMI_TOKEN_PLAN_SGP_API_KEY` | `xiaomi-token-plan-sgp` |
|
||||
|
||||
Reference for environment variables and `auth.json` keys: [`const envMap`](https://github.com/badlogic/pi-mono/blob/main/packages/ai/src/env-api-keys.ts) in [`packages/ai/src/env-api-keys.ts`](https://github.com/badlogic/pi-mono/blob/main/packages/ai/src/env-api-keys.ts).
|
||||
|
||||
@@ -87,7 +88,10 @@ Store credentials in `~/.pi/agent/auth.json`:
|
||||
"google": { "type": "api_key", "key": "..." },
|
||||
"opencode": { "type": "api_key", "key": "..." },
|
||||
"opencode-go": { "type": "api_key", "key": "..." },
|
||||
"xiaomi": { "type": "api_key", "key": "..." }
|
||||
"xiaomi": { "type": "api_key", "key": "..." },
|
||||
"xiaomi-token-plan-cn": { "type": "api_key", "key": "..." },
|
||||
"xiaomi-token-plan-ams": { "type": "api_key", "key": "..." },
|
||||
"xiaomi-token-plan-sgp": { "type": "api_key", "key": "..." }
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user