feat:Add Xiaomi Token Plan provider support#86179
Conversation
|
Codex review: needs maintainer review before merge. Reviewed May 30, 2026, 4:24 AM ET / 08:24 UTC. Summary PR surface: Source +655, Tests +575, Docs +74. Total +1304 across 23 files. Reproducibility: not applicable. as a feature PR rather than a broken existing-behavior report. Source inspection shows current main lacks a first-class bundled Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land a maintainer-approved version that keeps Xiaomi Token Plan ownership inside the Xiaomi plugin, preserves existing pay-as-you-go behavior, and explicitly accepts the regional and pricing contract before merge. Do we have a high-confidence way to reproduce the issue? Not applicable as a feature PR rather than a broken existing-behavior report. Source inspection shows current main lacks a first-class bundled Is this the best way to solve the issue? Yes, with maintainer review: the implementation keeps auth, onboarding, catalog, and vendor behavior in the Xiaomi plugin and uses a generic provider-discovery adjustment for runtime-owned catalog entries. The safer pre-merge state is explicit maintainer acceptance of the new provider contract, regional proof gap, and cost metadata. AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against b09cab4ebd2c. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +655, Tests +575, Docs +74. Total +1304 across 23 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
ClawSweeper PR egg ✨ Hatched: 🥚 common Clockwork Proofling Hatch commandComment Hatchability rules:
Rarity: 🥚 common. What is this egg doing here?
|
|
Thanks for the PR. Before this can move forward, please add live proof from the affected surface, not just unit tests, mocked tests, or source inspection. A useful proof update should include:
Please redact secrets, tokens, phone numbers, and private message content from logs or screenshots. |
|
Thanks for the review @omarshahine . I'm currently running live verification against the affected surface — will update the PR |
|
@omarshahine Proof updated! |
This comment was marked as spam.
This comment was marked as spam.
bd74f3c to
6e87f3c
Compare
6e87f3c to
3d676d4
Compare
…el and wrapStreamFn
…ctly validate key prefixes
…gs use manifest pricing with tiered cache-read rates
…ssage test assertions
ee89e35 to
ccec053
Compare
|
Verification before merge: Behavior addressed: Xiaomi Token Plan provider support, including regional base URL selection, token-plan key prefix validation, runtime model pricing/catalog behavior, and provider discovery ownership so Token Plan cannot fall back to a static SGP catalog when runtime region config is required.
|
Summary
xiaomi-token-plansupport to the bundled Xiaomi provider plugintp-.../sk-...key-shape validationWhy
OpenClaw's bundled Xiaomi plugin only supported pay-as-you-go
xiaomisetup, while issue #86169 asked for Xiaomi MiMo Token Plan support without requiring manual custom-provider wiring.Screenshots
Model costs
mimo-v2.5-promimo-v2.5Prices are USD per million tokens. Cache-read pricing uses
tieredPricingwith a step at 256,000 input tokens.Real behavior proof
Behavior addressed: OpenClaw can onboard and resolve Xiaomi MiMo Token Plan as a first-class provider with regional preset endpoints, strict key-prefix validation, and tiered cache-read pricing.
Real environment tested: macOS local source checkout at 1b10c6a with live Xiaomi Token Plan China (cn) region tp-... API key. All three regional endpoints probed; regional key isolation confirmed.
Exact steps or command run after this patch:
curl -s "https://token-plan-cn.xiaomimimo.com/v1/models" -H "Authorization: Bearer tp-***"— HTTP 200, 8 models returned including mimo-v2.5 and mimo-v2.5-pro.curl -s "https://token-plan-cn.xiaomimimo.com/v1/chat/completions"withmimo-v2.5-pro— HTTP 200,model: mimo-v2.5-pro,usage: prompt=255, completion=20, cacheRead=192.curl -s "https://token-plan-cn.xiaomimimo.com/v1/chat/completions"withmimo-v2.5— HTTP 200, valid response.openclaw agent --local --agent main --model "xiaomi-token-plan/mimo-v2.5" --message "Reply with ok" --thinking off --json—text: ok, providerxiaomi-token-plan, modelmimo-v2.5,fallback: False,usage: input=90, output=2, cacheRead=22656.openclaw onboard --non-interactive --accept-risk --auth-choice xiaomi-token-plan-cn --xiaomi-token-plan-api-key "tp-***" --json— config written with correct cn region baseUrl, aliases, and auth profile.curl -s "https://token-plan-sgp.xiaomimimo.com/v1/models" -H "Authorization: Bearer tp-***"— HTTP 401,"message": "Invalid API Key". Confirms CN key is region-locked to CN endpoint.curl -s "https://token-plan-ams.xiaomimimo.com/v1/models" -H "Authorization: Bearer tp-***"— HTTP 401,"message": "Invalid API Key". Confirms CN key is region-locked to CN endpoint.node scripts/run-vitest.mjs extensions/xiaomi/— 3 files, 35 tests passed.pnpm tsgoclean.pnpm buildclean.Evidence after fix: All three regional endpoints respond correctly. CN endpoint returns valid chat completions with working prompt caching (cacheRead observed). SGP and AMS endpoints correctly reject the CN-region key with 401, confirming regional isolation works at the API level. Model dropdown shows specific names (Xiaomi MiMo V2.5 Pro). Non-interactive openclaw onboard with xiaomi-token-plan-cn succeeds end-to-end. Costs flow from manifest to usage tracking with tiered cache-read pricing. Key validation rejects unknown prefixes (bad-key) and cross-prefix entries (tp- for payg, sk- for token-plan). Token Plan catalog requires explicit non-empty regional baseUrl.
Observed result after fix: All live API, agent, and onboarding tests pass for CN region. SGP and AMS endpoints correctly enforce key-region binding (401 Invalid API Key). Provider correctly resolves the cn region base URL, authenticates with tp-... key, and returns valid chat completions. Model dropdown shows specific model names instead of generic labels. Cost tracking uses correct tiered pricing. Strict key-prefix validation works for both payg (sk-) and token-plan (tp-) paths.
What was not tested: The SGP and AMS endpoints with their own regional keys (only a CN key is available for this verification).
Fixes #86169.