@openclaw/xiaomi-provider 2026.9.5 → 2026.9.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/assets/icon.png CHANGED
Binary file
@@ -0,0 +1,186 @@
1
+ import { buildManifestModelProviderConfig } from "openclaw/plugin-sdk/provider-catalog-shared";
2
+ //#region extensions/xiaomi/openclaw.plugin.json
3
+ var modelCatalog = {
4
+ "modelsDev": {
5
+ "xiaomi": "xiaomi",
6
+ "xiaomi-token-plan": "xiaomi-token-plan-sgp"
7
+ },
8
+ "providers": {
9
+ "xiaomi": {
10
+ "baseUrl": "https://api.xiaomimimo.com/v1",
11
+ "api": "openai-completions",
12
+ "models": [
13
+ {
14
+ "id": "mimo-v2.6-pro",
15
+ "name": "Xiaomi MiMo V2.6 Pro",
16
+ "input": ["text", "image"],
17
+ "reasoning": true,
18
+ "contextWindow": 1048576,
19
+ "maxTokens": 131072,
20
+ "cost": {
21
+ "input": .435,
22
+ "output": .87,
23
+ "cacheRead": .0036,
24
+ "cacheWrite": 0
25
+ },
26
+ "compat": { "codeMode": "preferred" }
27
+ },
28
+ {
29
+ "id": "mimo-v2.6-flash",
30
+ "name": "Xiaomi MiMo V2.6 Flash",
31
+ "input": ["text", "image"],
32
+ "reasoning": true,
33
+ "contextWindow": 1048576,
34
+ "maxTokens": 131072,
35
+ "cost": {
36
+ "input": .14,
37
+ "output": .28,
38
+ "cacheRead": .0028,
39
+ "cacheWrite": 0
40
+ },
41
+ "compat": { "codeMode": "preferred" }
42
+ },
43
+ {
44
+ "id": "mimo-v2.6-pro-ultraspeed",
45
+ "name": "Xiaomi MiMo V2.6 Pro UltraSpeed",
46
+ "input": ["text", "image"],
47
+ "reasoning": true,
48
+ "contextWindow": 1048576,
49
+ "maxTokens": 131072,
50
+ "cost": {
51
+ "input": 4.35,
52
+ "output": 8.7,
53
+ "cacheRead": .036,
54
+ "cacheWrite": 0
55
+ }
56
+ },
57
+ {
58
+ "id": "mimo-v2.5",
59
+ "name": "Xiaomi MiMo V2.5",
60
+ "input": ["text", "image"],
61
+ "reasoning": true,
62
+ "contextWindow": 1048576,
63
+ "maxTokens": 131072,
64
+ "cost": {
65
+ "input": .14,
66
+ "output": .28,
67
+ "cacheRead": .0028,
68
+ "cacheWrite": 0
69
+ },
70
+ "compat": { "codeMode": "preferred" }
71
+ },
72
+ {
73
+ "id": "mimo-v2.5-pro",
74
+ "name": "Xiaomi MiMo V2.5 Pro",
75
+ "input": ["text"],
76
+ "reasoning": true,
77
+ "contextWindow": 1048576,
78
+ "maxTokens": 131072,
79
+ "cost": {
80
+ "input": .435,
81
+ "output": .87,
82
+ "cacheRead": .0036,
83
+ "cacheWrite": 0
84
+ }
85
+ }
86
+ ]
87
+ },
88
+ "xiaomi-token-plan": {
89
+ "baseUrl": "https://token-plan-sgp.xiaomimimo.com/v1",
90
+ "api": "openai-completions",
91
+ "models": [
92
+ {
93
+ "id": "mimo-v2.6-pro",
94
+ "name": "Xiaomi MiMo V2.6 Pro",
95
+ "input": ["text", "image"],
96
+ "reasoning": true,
97
+ "contextWindow": 1048576,
98
+ "maxTokens": 131072,
99
+ "cost": {
100
+ "input": 0,
101
+ "output": 0,
102
+ "cacheRead": 0,
103
+ "cacheWrite": 0
104
+ },
105
+ "compat": { "codeMode": "preferred" }
106
+ },
107
+ {
108
+ "id": "mimo-v2.6-flash",
109
+ "name": "Xiaomi MiMo V2.6 Flash",
110
+ "input": ["text", "image"],
111
+ "reasoning": true,
112
+ "contextWindow": 1048576,
113
+ "maxTokens": 131072,
114
+ "cost": {
115
+ "input": 0,
116
+ "output": 0,
117
+ "cacheRead": 0,
118
+ "cacheWrite": 0
119
+ },
120
+ "compat": { "codeMode": "preferred" }
121
+ },
122
+ {
123
+ "id": "mimo-v2.5-pro",
124
+ "name": "Xiaomi MiMo V2.5 Pro",
125
+ "input": ["text"],
126
+ "reasoning": true,
127
+ "contextWindow": 1048576,
128
+ "maxTokens": 131072,
129
+ "cost": {
130
+ "input": 0,
131
+ "output": 0,
132
+ "cacheRead": 0,
133
+ "cacheWrite": 0
134
+ }
135
+ },
136
+ {
137
+ "id": "mimo-v2.5",
138
+ "name": "Xiaomi MiMo V2.5",
139
+ "input": ["text", "image"],
140
+ "reasoning": true,
141
+ "contextWindow": 1048576,
142
+ "maxTokens": 131072,
143
+ "cost": {
144
+ "input": 0,
145
+ "output": 0,
146
+ "cacheRead": 0,
147
+ "cacheWrite": 0
148
+ },
149
+ "compat": { "codeMode": "preferred" }
150
+ }
151
+ ]
152
+ }
153
+ },
154
+ "discovery": {
155
+ "xiaomi": "refreshable",
156
+ "xiaomi-token-plan": "refreshable"
157
+ }
158
+ };
159
+ //#endregion
160
+ //#region extensions/xiaomi/provider-catalog.ts
161
+ const XIAOMI_PROVIDER_ID = "xiaomi";
162
+ const XIAOMI_TOKEN_PLAN_PROVIDER_ID = "xiaomi-token-plan";
163
+ const XIAOMI_DEFAULT_MODEL_ID = "mimo-v2.6-pro";
164
+ const XIAOMI_TOKEN_PLAN_DEFAULT_MODEL_ID = "mimo-v2.6-pro";
165
+ const XIAOMI_TOKEN_PLAN_BASE_URLS = {
166
+ ams: "https://token-plan-ams.xiaomimimo.com/v1",
167
+ cn: "https://token-plan-cn.xiaomimimo.com/v1",
168
+ sgp: "https://token-plan-sgp.xiaomimimo.com/v1"
169
+ };
170
+ function buildXiaomiProvider() {
171
+ return buildManifestModelProviderConfig({
172
+ providerId: XIAOMI_PROVIDER_ID,
173
+ catalog: modelCatalog.providers.xiaomi
174
+ });
175
+ }
176
+ function buildXiaomiTokenPlanProvider() {
177
+ return buildManifestModelProviderConfig({
178
+ providerId: XIAOMI_TOKEN_PLAN_PROVIDER_ID,
179
+ catalog: modelCatalog.providers[XIAOMI_TOKEN_PLAN_PROVIDER_ID]
180
+ });
181
+ }
182
+ function resolveXiaomiTokenPlanBaseUrl(region) {
183
+ return XIAOMI_TOKEN_PLAN_BASE_URLS[region];
184
+ }
185
+ //#endregion
186
+ export { buildXiaomiProvider as a, XIAOMI_TOKEN_PLAN_PROVIDER_ID as i, XIAOMI_PROVIDER_ID as n, buildXiaomiTokenPlanProvider as o, XIAOMI_TOKEN_PLAN_DEFAULT_MODEL_ID as r, resolveXiaomiTokenPlanBaseUrl as s, XIAOMI_DEFAULT_MODEL_ID as t };
package/dist/api.js CHANGED
@@ -1,3 +1,3 @@
1
- import { a as buildXiaomiProvider, t as XIAOMI_DEFAULT_MODEL_ID } from "./.setup/provider-catalog-B2pu2gGC.mjs";
1
+ import { a as buildXiaomiProvider, t as XIAOMI_DEFAULT_MODEL_ID } from "./.setup/provider-catalog-v9-9qyII.mjs";
2
2
  import { XIAOMI_DEFAULT_MODEL_REF, applyXiaomiConfig, applyXiaomiProviderConfig } from "./onboard.js";
3
3
  export { XIAOMI_DEFAULT_MODEL_ID, XIAOMI_DEFAULT_MODEL_REF, applyXiaomiConfig, applyXiaomiProviderConfig, buildXiaomiProvider };
package/dist/index.js CHANGED
@@ -1,13 +1,14 @@
1
- import { a as buildXiaomiProvider, i as XIAOMI_TOKEN_PLAN_PROVIDER_ID, n as XIAOMI_PROVIDER_ID, o as buildXiaomiTokenPlanProvider } from "./.setup/provider-catalog-B2pu2gGC.mjs";
1
+ import { a as buildXiaomiProvider, i as XIAOMI_TOKEN_PLAN_PROVIDER_ID, n as XIAOMI_PROVIDER_ID, o as buildXiaomiTokenPlanProvider } from "./.setup/provider-catalog-v9-9qyII.mjs";
2
2
  import { XIAOMI_DEFAULT_MODEL_REF, XIAOMI_TOKEN_PLAN_DEFAULT_MODEL_REF, applyXiaomiConnectionConfig, applyXiaomiTokenPlanConfig } from "./onboard.js";
3
3
  import { buildXiaomiSpeechProvider } from "./speech-provider.js";
4
4
  import { isMiMoReasoningModelRef, resolveMiMoThinkingProfile } from "./thinking.js";
5
5
  import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
6
- import { applyAuthProfileConfig, buildApiKeyCredential, ensureApiKeyFromOptionEnvOrPrompt, normalizeApiKeyInput, normalizeOptionalSecretInput, upsertAuthProfileWithLockOrThrow, validateApiKeyInput } from "openclaw/plugin-sdk/provider-auth-api-key";
6
+ import { applyAuthProfileConfig, buildApiKeyCredential, captureProviderApiKey, normalizeOptionalSecretInput, persistProviderApiKey } from "openclaw/plugin-sdk/provider-auth-api-key";
7
7
  import { buildOpenAICompatibleLiveProviderCatalog } from "openclaw/plugin-sdk/provider-catalog-live-runtime";
8
8
  import { applyModelCompatPatch, buildProviderReplayFamilyHooks } from "openclaw/plugin-sdk/provider-model-shared";
9
9
  import { createDeepSeekV4OpenAICompatibleThinkingWrapper } from "openclaw/plugin-sdk/provider-stream-shared";
10
10
  import { PROVIDER_LABELS } from "openclaw/plugin-sdk/provider-usage";
11
+ import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
11
12
  //#region extensions/xiaomi/index.ts
12
13
  const PAYG_FLAG_NAME = "--xiaomi-api-key";
13
14
  const PAYG_OPTION_KEY = "xiaomiApiKey";
@@ -34,20 +35,11 @@ const XIAOMI_PROVIDER_HOOKS = {
34
35
  resolveThinkingProfile: ({ modelId }) => resolveMiMoThinkingProfile(modelId),
35
36
  isModernModelRef: ({ modelId }) => Boolean(resolveMiMoThinkingProfile(modelId))
36
37
  };
37
- function trimConfiguredBaseUrl(ctx, providerId) {
38
- const configuredProvider = ctx.config.models?.providers?.[providerId];
39
- return (typeof configuredProvider?.baseUrl === "string" ? configuredProvider.baseUrl.trim() : "") || void 0;
40
- }
41
- function hasConfiguredProviderEntry(ctx, providerId) {
42
- const configuredProvider = ctx.config.models?.providers?.[providerId];
43
- return Boolean(configuredProvider && typeof configuredProvider === "object");
44
- }
45
38
  async function resolveXiaomiCatalog(params) {
46
39
  const auth = params.ctx.resolveProviderApiKey(params.providerId);
47
40
  if (!auth.apiKey) return null;
48
- if (params.requireConfiguredProvider === true && !hasConfiguredProviderEntry(params.ctx, params.providerId)) return null;
49
- const explicitBaseUrl = trimConfiguredBaseUrl(params.ctx, params.providerId);
50
- if (params.requireBaseUrl === true && !explicitBaseUrl) return null;
41
+ const explicitBaseUrl = normalizeOptionalString(params.ctx.config.models?.providers?.[params.providerId]?.baseUrl);
42
+ if (params.requiresRegion && !explicitBaseUrl) return null;
51
43
  return await buildOpenAICompatibleLiveProviderCatalog({
52
44
  discoveryMode: "strict",
53
45
  providerId: params.providerId,
@@ -73,43 +65,26 @@ function assertCompatibleXiaomiKey(params) {
73
65
  const message = buildXiaomiKeyMismatchMessage(params);
74
66
  if (message) throw new Error(message);
75
67
  }
76
- function resolveProfileId(providerId) {
77
- return `${providerId}:default`;
78
- }
79
68
  async function runXiaomiApiKeyAuth(ctx, params) {
80
- let capturedSecretInput;
81
- let capturedCredential = false;
82
- let capturedMode;
83
- const profileId = resolveProfileId(params.providerId);
69
+ const profileId = `${params.providerId}:default`;
70
+ const { apiKey, input, mode } = await captureProviderApiKey(ctx, {
71
+ token: normalizeOptionalSecretInput(ctx.opts?.[params.optionKey]) ?? normalizeOptionalSecretInput(ctx.opts?.token),
72
+ tokenProvider: normalizeOptionalSecretInput(ctx.opts?.[params.optionKey]) ? params.providerId : normalizeOptionalSecretInput(ctx.opts?.tokenProvider),
73
+ env: ctx.env,
74
+ expectedProviders: [params.providerId],
75
+ provider: params.providerId,
76
+ envLabel: params.envVar,
77
+ promptMessage: params.promptMessage,
78
+ missingInputMessage: `Missing Xiaomi API key for provider "${params.providerId}".`
79
+ });
84
80
  assertCompatibleXiaomiKey({
85
- actualKey: await ensureApiKeyFromOptionEnvOrPrompt({
86
- token: normalizeOptionalSecretInput(ctx.opts?.[params.optionKey]) ?? normalizeOptionalSecretInput(ctx.opts?.token),
87
- tokenProvider: normalizeOptionalSecretInput(ctx.opts?.[params.optionKey]) ? params.providerId : normalizeOptionalSecretInput(ctx.opts?.tokenProvider),
88
- secretInputMode: ctx.allowSecretRefPrompt === false ? ctx.secretInputMode ?? "plaintext" : ctx.secretInputMode,
89
- config: ctx.config,
90
- env: ctx.env,
91
- workspaceDir: ctx.workspaceDir,
92
- expectedProviders: [params.providerId],
93
- provider: params.providerId,
94
- envLabel: params.envVar,
95
- promptMessage: params.promptMessage,
96
- normalize: normalizeApiKeyInput,
97
- validate: validateApiKeyInput,
98
- prompter: ctx.prompter,
99
- setCredential: async (key, mode) => {
100
- capturedSecretInput = key;
101
- capturedCredential = true;
102
- capturedMode = mode;
103
- }
104
- }),
81
+ actualKey: apiKey,
105
82
  expectedKind: params.expectedKind
106
83
  });
107
- if (!capturedCredential) throw new Error(`Missing Xiaomi API key for provider "${params.providerId}".`);
108
- const credentialInput = capturedSecretInput ?? "";
109
84
  return {
110
85
  profiles: [{
111
86
  profileId,
112
- credential: buildApiKeyCredential(params.providerId, credentialInput, void 0, capturedMode ? { secretInputMode: capturedMode } : void 0)
87
+ credential: buildApiKeyCredential(params.providerId, input, void 0, mode ? { secretInputMode: mode } : void 0)
113
88
  }],
114
89
  configPatch: params.applyConfig(ctx.config),
115
90
  defaultModel: params.defaultModel
@@ -127,19 +102,11 @@ async function runXiaomiApiKeyAuthNonInteractive(ctx, params) {
127
102
  actualKey: resolved.key,
128
103
  expectedKind: params.expectedKind
129
104
  });
130
- const profileId = resolveProfileId(params.providerId);
131
- if (resolved.source !== "profile") {
132
- const credential = ctx.toApiKeyCredential({
133
- provider: params.providerId,
134
- resolved
135
- });
136
- if (!credential) return null;
137
- await upsertAuthProfileWithLockOrThrow({
138
- profileId,
139
- credential,
140
- agentDir: ctx.agentDir
141
- });
142
- }
105
+ const profileId = `${params.providerId}:default`;
106
+ if (!await persistProviderApiKey(ctx, profileId, {
107
+ provider: params.providerId,
108
+ resolved
109
+ })) return null;
143
110
  const next = applyAuthProfileConfig(ctx.config, {
144
111
  profileId,
145
112
  provider: params.providerId,
@@ -147,70 +114,42 @@ async function runXiaomiApiKeyAuthNonInteractive(ctx, params) {
147
114
  });
148
115
  return params.applyConfig(next);
149
116
  }
150
- function createPaygAuthMethod() {
151
- return {
152
- id: "api-key",
153
- label: "Xiaomi API key (Pay-as-you-go)",
154
- hint: "Endpoint: api.xiaomimimo.com/v1",
155
- kind: "api_key",
156
- wizard: {
157
- choiceId: "xiaomi-api-key",
158
- choiceLabel: "Xiaomi API key (Pay-as-you-go)",
159
- choiceHint: "Endpoint: api.xiaomimimo.com/v1",
160
- ...XIAOMI_WIZARD_GROUP
161
- },
162
- run: async (ctx) => await runXiaomiApiKeyAuth(ctx, {
163
- providerId: XIAOMI_PROVIDER_ID,
164
- optionKey: PAYG_OPTION_KEY,
165
- envVar: PAYG_ENV_VAR,
166
- promptMessage: "Enter Xiaomi MiMo API key (pay-as-you-go, sk-...)",
167
- expectedKind: "payg",
168
- defaultModel: XIAOMI_DEFAULT_MODEL_REF,
169
- applyConfig: applyXiaomiConnectionConfig
170
- }),
171
- runNonInteractive: async (ctx) => await runXiaomiApiKeyAuthNonInteractive(ctx, {
172
- providerId: XIAOMI_PROVIDER_ID,
173
- optionKey: PAYG_OPTION_KEY,
174
- flagName: PAYG_FLAG_NAME,
175
- envVar: PAYG_ENV_VAR,
176
- expectedKind: "payg",
177
- applyConfig: applyXiaomiConnectionConfig
178
- })
179
- };
180
- }
181
- function createTokenPlanAuthMethod(region) {
117
+ function createXiaomiApiKeyAuthMethod(region) {
182
118
  const regionLabel = region === "ams" ? "Europe" : region === "cn" ? "China" : "Singapore";
183
- const choiceId = `xiaomi-token-plan-${region}`;
184
- const choiceLabel = `Xiaomi Token Plan (${regionLabel})`;
185
- const choiceHint = `Endpoint preset: token-plan-${region}.xiaomimimo.com/v1`;
119
+ const choiceLabel = region ? `Xiaomi Token Plan (${regionLabel})` : "Xiaomi API key (Pay-as-you-go)";
120
+ const choiceHint = region ? `Endpoint preset: token-plan-${region}.xiaomimimo.com/v1` : "Endpoint: api.xiaomimimo.com/v1";
121
+ const auth = region ? {
122
+ providerId: XIAOMI_TOKEN_PLAN_PROVIDER_ID,
123
+ optionKey: TOKEN_PLAN_OPTION_KEY,
124
+ flagName: TOKEN_PLAN_FLAG_NAME,
125
+ envVar: TOKEN_PLAN_ENV_VAR,
126
+ promptMessage: `Enter Xiaomi MiMo Token Plan API key (tp-...) for ${regionLabel}`,
127
+ expectedKind: "token-plan",
128
+ defaultModel: XIAOMI_TOKEN_PLAN_DEFAULT_MODEL_REF,
129
+ applyConfig: (cfg) => applyXiaomiTokenPlanConfig(cfg, region)
130
+ } : {
131
+ providerId: XIAOMI_PROVIDER_ID,
132
+ optionKey: PAYG_OPTION_KEY,
133
+ flagName: PAYG_FLAG_NAME,
134
+ envVar: PAYG_ENV_VAR,
135
+ promptMessage: "Enter Xiaomi MiMo API key (pay-as-you-go, sk-...)",
136
+ expectedKind: "payg",
137
+ defaultModel: XIAOMI_DEFAULT_MODEL_REF,
138
+ applyConfig: applyXiaomiConnectionConfig
139
+ };
186
140
  return {
187
- id: `token-plan-${region}`,
141
+ id: region ? `token-plan-${region}` : "api-key",
188
142
  label: choiceLabel,
189
143
  hint: choiceHint,
190
144
  kind: "api_key",
191
145
  wizard: {
192
- choiceId,
146
+ choiceId: region ? `xiaomi-token-plan-${region}` : "xiaomi-api-key",
193
147
  choiceLabel,
194
148
  choiceHint,
195
149
  ...XIAOMI_WIZARD_GROUP
196
150
  },
197
- run: async (ctx) => await runXiaomiApiKeyAuth(ctx, {
198
- providerId: XIAOMI_TOKEN_PLAN_PROVIDER_ID,
199
- optionKey: TOKEN_PLAN_OPTION_KEY,
200
- envVar: TOKEN_PLAN_ENV_VAR,
201
- promptMessage: `Enter Xiaomi MiMo Token Plan API key (tp-...) for ${regionLabel}`,
202
- expectedKind: "token-plan",
203
- defaultModel: XIAOMI_TOKEN_PLAN_DEFAULT_MODEL_REF,
204
- applyConfig: (cfg) => applyXiaomiTokenPlanConfig(cfg, region)
205
- }),
206
- runNonInteractive: async (ctx) => await runXiaomiApiKeyAuthNonInteractive(ctx, {
207
- providerId: XIAOMI_TOKEN_PLAN_PROVIDER_ID,
208
- optionKey: TOKEN_PLAN_OPTION_KEY,
209
- flagName: TOKEN_PLAN_FLAG_NAME,
210
- envVar: TOKEN_PLAN_ENV_VAR,
211
- expectedKind: "token-plan",
212
- applyConfig: (cfg) => applyXiaomiTokenPlanConfig(cfg, region)
213
- })
151
+ run: async (ctx) => await runXiaomiApiKeyAuth(ctx, auth),
152
+ runNonInteractive: async (ctx) => await runXiaomiApiKeyAuthNonInteractive(ctx, auth)
214
153
  };
215
154
  }
216
155
  var xiaomi_default = definePluginEntry({
@@ -218,73 +157,56 @@ var xiaomi_default = definePluginEntry({
218
157
  name: "Xiaomi Provider",
219
158
  description: "Xiaomi provider plugin",
220
159
  register(api) {
221
- api.registerProvider({
160
+ for (const provider of [{
222
161
  id: XIAOMI_PROVIDER_ID,
223
162
  label: "Xiaomi",
224
- docsPath: "/providers/xiaomi",
225
- envVars: [PAYG_ENV_VAR],
226
- auth: [createPaygAuthMethod()],
227
- catalog: {
228
- order: "simple",
229
- run: async (ctx) => resolveXiaomiCatalog({
230
- ctx,
231
- providerId: XIAOMI_PROVIDER_ID,
232
- buildProvider: buildXiaomiProvider
233
- })
234
- },
235
- staticCatalog: {
236
- order: "simple",
237
- run: async () => ({ provider: buildXiaomiProvider() })
238
- },
239
- ...XIAOMI_PROVIDER_HOOKS,
240
- resolveUsageAuth: async (ctx) => {
241
- const apiKey = ctx.resolveApiKeyFromConfigAndStore({
242
- providerIds: [XIAOMI_PROVIDER_ID],
243
- envDirect: [ctx.env.XIAOMI_API_KEY]
244
- });
245
- return apiKey ? { token: apiKey } : null;
246
- },
247
- fetchUsageSnapshot: async () => ({
248
- provider: XIAOMI_PROVIDER_ID,
249
- displayName: PROVIDER_LABELS.xiaomi,
250
- windows: []
251
- })
252
- });
253
- api.registerProvider({
163
+ envVar: PAYG_ENV_VAR,
164
+ auth: () => [createXiaomiApiKeyAuthMethod()],
165
+ buildProvider: buildXiaomiProvider,
166
+ displayName: PROVIDER_LABELS.xiaomi,
167
+ requiresRegion: false
168
+ }, {
254
169
  id: XIAOMI_TOKEN_PLAN_PROVIDER_ID,
255
170
  label: "Xiaomi Token Plan",
171
+ envVar: TOKEN_PLAN_ENV_VAR,
172
+ auth: () => [
173
+ "ams",
174
+ "cn",
175
+ "sgp"
176
+ ].map(createXiaomiApiKeyAuthMethod),
177
+ buildProvider: buildXiaomiTokenPlanProvider,
178
+ displayName: "Xiaomi MiMo Token Plan",
179
+ requiresRegion: true
180
+ }]) api.registerProvider({
181
+ id: provider.id,
182
+ label: provider.label,
256
183
  docsPath: "/providers/xiaomi",
257
- envVars: [TOKEN_PLAN_ENV_VAR],
258
- auth: [
259
- createTokenPlanAuthMethod("ams"),
260
- createTokenPlanAuthMethod("cn"),
261
- createTokenPlanAuthMethod("sgp")
262
- ],
184
+ envVars: [provider.envVar],
185
+ auth: provider.auth(),
263
186
  catalog: {
264
187
  order: "simple",
265
188
  run: async (ctx) => resolveXiaomiCatalog({
266
189
  ctx,
267
- providerId: XIAOMI_TOKEN_PLAN_PROVIDER_ID,
268
- buildProvider: buildXiaomiTokenPlanProvider,
269
- requireConfiguredProvider: true,
270
- requireBaseUrl: true
190
+ providerId: provider.id,
191
+ buildProvider: provider.buildProvider,
192
+ requiresRegion: provider.requiresRegion
271
193
  })
272
194
  },
273
195
  staticCatalog: {
274
196
  order: "simple",
275
- run: async () => ({ provider: buildXiaomiTokenPlanProvider() })
197
+ run: async () => ({ provider: provider.buildProvider() })
276
198
  },
277
199
  ...XIAOMI_PROVIDER_HOOKS,
278
200
  resolveUsageAuth: async (ctx) => {
279
201
  const apiKey = ctx.resolveApiKeyFromConfigAndStore({
280
- providerIds: [XIAOMI_TOKEN_PLAN_PROVIDER_ID],
281
- envDirect: [ctx.env.XIAOMI_TOKEN_PLAN_API_KEY]
202
+ providerIds: [provider.id],
203
+ envDirect: [ctx.env[provider.envVar]]
282
204
  });
283
205
  return apiKey ? { token: apiKey } : null;
284
206
  },
285
207
  fetchUsageSnapshot: async () => ({
286
- provider: XIAOMI_TOKEN_PLAN_PROVIDER_ID,
287
- displayName: "Xiaomi MiMo Token Plan",
208
+ provider: provider.id,
209
+ displayName: provider.displayName,
288
210
  windows: []
289
211
  })
290
212
  });
package/dist/onboard.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as buildXiaomiProvider, i as XIAOMI_TOKEN_PLAN_PROVIDER_ID, n as XIAOMI_PROVIDER_ID, o as buildXiaomiTokenPlanProvider, r as XIAOMI_TOKEN_PLAN_DEFAULT_MODEL_ID, s as resolveXiaomiTokenPlanBaseUrl, t as XIAOMI_DEFAULT_MODEL_ID } from "./.setup/provider-catalog-B2pu2gGC.mjs";
1
+ import { a as buildXiaomiProvider, i as XIAOMI_TOKEN_PLAN_PROVIDER_ID, n as XIAOMI_PROVIDER_ID, o as buildXiaomiTokenPlanProvider, r as XIAOMI_TOKEN_PLAN_DEFAULT_MODEL_ID, s as resolveXiaomiTokenPlanBaseUrl, t as XIAOMI_DEFAULT_MODEL_ID } from "./.setup/provider-catalog-v9-9qyII.mjs";
2
2
  import { createDefaultModelsConnectionPresetAppliers, createDefaultModelsPresetAppliers } from "openclaw/plugin-sdk/provider-onboard";
3
3
  //#region extensions/xiaomi/onboard.ts
4
4
  const XIAOMI_DEFAULT_MODEL_REF = `${XIAOMI_PROVIDER_ID}/${XIAOMI_DEFAULT_MODEL_ID}`;
@@ -36,7 +36,7 @@ const xiaomiTokenPlanPresetAppliers = createDefaultModelsPresetAppliers({
36
36
  const defaultModel = defaultProvider.models?.find((m) => m.id === XIAOMI_TOKEN_PLAN_DEFAULT_MODEL_ID);
37
37
  return [{
38
38
  modelRef: XIAOMI_TOKEN_PLAN_DEFAULT_MODEL_REF,
39
- alias: defaultModel?.name ?? "MiMo V2.5 Pro"
39
+ alias: defaultModel?.name ?? "Xiaomi MiMo V2.6 Pro"
40
40
  }];
41
41
  })()
42
42
  };
@@ -1,2 +1,2 @@
1
- import { a as buildXiaomiProvider, i as XIAOMI_TOKEN_PLAN_PROVIDER_ID, n as XIAOMI_PROVIDER_ID, o as buildXiaomiTokenPlanProvider, r as XIAOMI_TOKEN_PLAN_DEFAULT_MODEL_ID, s as resolveXiaomiTokenPlanBaseUrl, t as XIAOMI_DEFAULT_MODEL_ID } from "./.setup/provider-catalog-B2pu2gGC.mjs";
1
+ import { a as buildXiaomiProvider, i as XIAOMI_TOKEN_PLAN_PROVIDER_ID, n as XIAOMI_PROVIDER_ID, o as buildXiaomiTokenPlanProvider, r as XIAOMI_TOKEN_PLAN_DEFAULT_MODEL_ID, s as resolveXiaomiTokenPlanBaseUrl, t as XIAOMI_DEFAULT_MODEL_ID } from "./.setup/provider-catalog-v9-9qyII.mjs";
2
2
  export { XIAOMI_DEFAULT_MODEL_ID, XIAOMI_PROVIDER_ID, XIAOMI_TOKEN_PLAN_DEFAULT_MODEL_ID, XIAOMI_TOKEN_PLAN_PROVIDER_ID, buildXiaomiProvider, buildXiaomiTokenPlanProvider, resolveXiaomiTokenPlanBaseUrl };
@@ -1,7 +1,7 @@
1
+ import { asOptionalRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
1
2
  import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
2
3
  import { normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/secret-input";
3
4
  import { resolveSpeechProviderApiKey } from "openclaw/plugin-sdk/speech-provider";
4
- import { asOptionalRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
5
5
  //#region extensions/xiaomi/speech-provider.ts
6
6
  const DEFAULT_XIAOMI_TTS_BASE_URL = "https://api.xiaomimimo.com/v1";
7
7
  const DEFAULT_XIAOMI_TTS_MODEL = "mimo-v2.5-tts";
@@ -25,7 +25,7 @@ function normalizeXiaomiTtsBaseUrl(baseUrl) {
25
25
  }
26
26
  function normalizeXiaomiTtsFormat(value) {
27
27
  const normalized = normalizeOptionalString(value)?.toLowerCase();
28
- return XIAOMI_TTS_FORMATS.includes(normalized) ? normalized : void 0;
28
+ return XIAOMI_TTS_FORMATS.find((format) => format === normalized);
29
29
  }
30
30
  function resolveXiaomiTtsConfigRecord(rawConfig) {
31
31
  const providers = asOptionalRecord(rawConfig.providers);
@@ -45,22 +45,8 @@ function normalizeXiaomiTtsProviderConfig(rawConfig) {
45
45
  style: normalizeOptionalString(raw?.style)
46
46
  };
47
47
  }
48
- function readXiaomiTtsProviderConfig(config) {
49
- const normalized = normalizeXiaomiTtsProviderConfig({});
50
- return {
51
- apiKey: normalizeResolvedSecretInputString({
52
- value: config.apiKey,
53
- path: "tts.providers.xiaomi.apiKey"
54
- }) ?? normalized.apiKey,
55
- baseUrl: normalizeXiaomiTtsBaseUrl(normalizeOptionalString(config.baseUrl) ?? normalized.baseUrl),
56
- model: normalizeOptionalString(config.model) ?? normalizeOptionalString(config.modelId) ?? normalized.model,
57
- voice: normalizeOptionalString(config.speakerVoice) ?? normalizeOptionalString(config.speakerVoiceId) ?? normalizeOptionalString(config.voice) ?? normalizeOptionalString(config.voiceId) ?? normalized.voice,
58
- format: normalizeXiaomiTtsFormat(config.format) ?? normalized.format,
59
- style: normalizeOptionalString(config.style) ?? normalized.style
60
- };
61
- }
62
48
  function resolveXiaomiTtsProviderConfig(config) {
63
- const providerConfig = readXiaomiTtsProviderConfig(config);
49
+ const providerConfig = normalizeXiaomiTtsProviderConfig({ xiaomi: config });
64
50
  const resolvedKey = resolveSpeechProviderApiKey(providerConfig.apiKey, process.env.XIAOMI_API_KEY);
65
51
  return {
66
52
  ...providerConfig,
@@ -147,7 +133,7 @@ function buildXiaomiTtsAudio(params) {
147
133
  async function xiaomiTTS(params) {
148
134
  const { text, apiKey, baseUrl, model, voice, format, style, timeoutMs } = params;
149
135
  const requestTimeoutMs = resolveTimerTimeoutMs(timeoutMs, 1);
150
- const { canonicalizeBase64 } = await import("openclaw/plugin-sdk/media-runtime");
136
+ const { canonicalizeBase64 } = await import("openclaw/plugin-sdk/blob-runtime");
151
137
  const { assertOkOrThrowProviderError, readProviderJsonResponse } = await import("openclaw/plugin-sdk/provider-http");
152
138
  const { fetchWithSsrFGuard, ssrfPolicyFromHttpBaseUrlAllowedHostname } = await import("openclaw/plugin-sdk/ssrf-runtime");
153
139
  const controller = new AbortController();
package/dist/thinking.js CHANGED
@@ -1,9 +1,11 @@
1
- import "./.setup/provider-catalog-B2pu2gGC.mjs";
1
+ import "./.setup/provider-catalog-v9-9qyII.mjs";
2
2
  //#region extensions/xiaomi/thinking.ts
3
3
  const MIMO_REASONING_MODEL_IDS = /* @__PURE__ */ new Set([
4
4
  "mimo-v2.5",
5
5
  "mimo-v2.5-pro",
6
- "mimo-v2.6-pro"
6
+ "mimo-v2.6-flash",
7
+ "mimo-v2.6-pro",
8
+ "mimo-v2.6-pro-ultraspeed"
7
9
  ]);
8
10
  function isMiMoReasoningModelId(modelId) {
9
11
  return MIMO_REASONING_MODEL_IDS.has(modelId.toLowerCase());
@@ -42,6 +42,63 @@
42
42
  "baseUrl": "https://api.xiaomimimo.com/v1",
43
43
  "api": "openai-completions",
44
44
  "models": [
45
+ {
46
+ "id": "mimo-v2.6-pro",
47
+ "name": "Xiaomi MiMo V2.6 Pro",
48
+ "input": [
49
+ "text",
50
+ "image"
51
+ ],
52
+ "reasoning": true,
53
+ "contextWindow": 1048576,
54
+ "maxTokens": 131072,
55
+ "cost": {
56
+ "input": 0.435,
57
+ "output": 0.87,
58
+ "cacheRead": 0.0036,
59
+ "cacheWrite": 0
60
+ },
61
+ "compat": {
62
+ "codeMode": "preferred"
63
+ }
64
+ },
65
+ {
66
+ "id": "mimo-v2.6-flash",
67
+ "name": "Xiaomi MiMo V2.6 Flash",
68
+ "input": [
69
+ "text",
70
+ "image"
71
+ ],
72
+ "reasoning": true,
73
+ "contextWindow": 1048576,
74
+ "maxTokens": 131072,
75
+ "cost": {
76
+ "input": 0.14,
77
+ "output": 0.28,
78
+ "cacheRead": 0.0028,
79
+ "cacheWrite": 0
80
+ },
81
+ "compat": {
82
+ "codeMode": "preferred"
83
+ }
84
+ },
85
+ {
86
+ "id": "mimo-v2.6-pro-ultraspeed",
87
+ "name": "Xiaomi MiMo V2.6 Pro UltraSpeed",
88
+ "input": [
89
+ "text",
90
+ "image"
91
+ ],
92
+ "reasoning": true,
93
+ "contextWindow": 1048576,
94
+ "maxTokens": 131072,
95
+ "cost": {
96
+ "input": 4.35,
97
+ "output": 8.7,
98
+ "cacheRead": 0.036,
99
+ "cacheWrite": 0
100
+ }
101
+ },
45
102
  {
46
103
  "id": "mimo-v2.5",
47
104
  "name": "Xiaomi MiMo V2.5",
@@ -84,6 +141,46 @@
84
141
  "baseUrl": "https://token-plan-sgp.xiaomimimo.com/v1",
85
142
  "api": "openai-completions",
86
143
  "models": [
144
+ {
145
+ "id": "mimo-v2.6-pro",
146
+ "name": "Xiaomi MiMo V2.6 Pro",
147
+ "input": [
148
+ "text",
149
+ "image"
150
+ ],
151
+ "reasoning": true,
152
+ "contextWindow": 1048576,
153
+ "maxTokens": 131072,
154
+ "cost": {
155
+ "input": 0,
156
+ "output": 0,
157
+ "cacheRead": 0,
158
+ "cacheWrite": 0
159
+ },
160
+ "compat": {
161
+ "codeMode": "preferred"
162
+ }
163
+ },
164
+ {
165
+ "id": "mimo-v2.6-flash",
166
+ "name": "Xiaomi MiMo V2.6 Flash",
167
+ "input": [
168
+ "text",
169
+ "image"
170
+ ],
171
+ "reasoning": true,
172
+ "contextWindow": 1048576,
173
+ "maxTokens": 131072,
174
+ "cost": {
175
+ "input": 0,
176
+ "output": 0,
177
+ "cacheRead": 0,
178
+ "cacheWrite": 0
179
+ },
180
+ "compat": {
181
+ "codeMode": "preferred"
182
+ }
183
+ },
87
184
  {
88
185
  "id": "mimo-v2.5-pro",
89
186
  "name": "Xiaomi MiMo V2.5 Pro",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/xiaomi-provider",
3
- "version": "2026.9.5",
3
+ "version": "2026.9.7",
4
4
  "description": "OpenClaw Xiaomi provider plugin.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,10 +18,10 @@
18
18
  "minHostVersion": ">=2026.7.2"
19
19
  },
20
20
  "compat": {
21
- "pluginApi": ">=2026.9.5"
21
+ "pluginApi": ">=2026.9.7"
22
22
  },
23
23
  "build": {
24
- "openclawVersion": "2026.9.5",
24
+ "openclawVersion": "2026.9.7",
25
25
  "bundledDist": false
26
26
  },
27
27
  "release": {
@@ -40,7 +40,7 @@
40
40
  "assets/activity.svg"
41
41
  ],
42
42
  "peerDependencies": {
43
- "openclaw": ">=2026.9.5"
43
+ "openclaw": ">=2026.9.7"
44
44
  },
45
45
  "peerDependenciesMeta": {
46
46
  "openclaw": {
@@ -1,106 +0,0 @@
1
- import { buildManifestModelProviderConfig } from "openclaw/plugin-sdk/provider-catalog-shared";
2
- //#region extensions/xiaomi/openclaw.plugin.json
3
- var modelCatalog = {
4
- "modelsDev": {
5
- "xiaomi": "xiaomi",
6
- "xiaomi-token-plan": "xiaomi-token-plan-sgp"
7
- },
8
- "providers": {
9
- "xiaomi": {
10
- "baseUrl": "https://api.xiaomimimo.com/v1",
11
- "api": "openai-completions",
12
- "models": [{
13
- "id": "mimo-v2.5",
14
- "name": "Xiaomi MiMo V2.5",
15
- "input": ["text", "image"],
16
- "reasoning": true,
17
- "contextWindow": 1048576,
18
- "maxTokens": 131072,
19
- "cost": {
20
- "input": .14,
21
- "output": .28,
22
- "cacheRead": .0028,
23
- "cacheWrite": 0
24
- },
25
- "compat": { "codeMode": "preferred" }
26
- }, {
27
- "id": "mimo-v2.5-pro",
28
- "name": "Xiaomi MiMo V2.5 Pro",
29
- "input": ["text"],
30
- "reasoning": true,
31
- "contextWindow": 1048576,
32
- "maxTokens": 131072,
33
- "cost": {
34
- "input": .435,
35
- "output": .87,
36
- "cacheRead": .0036,
37
- "cacheWrite": 0
38
- }
39
- }]
40
- },
41
- "xiaomi-token-plan": {
42
- "baseUrl": "https://token-plan-sgp.xiaomimimo.com/v1",
43
- "api": "openai-completions",
44
- "models": [{
45
- "id": "mimo-v2.5-pro",
46
- "name": "Xiaomi MiMo V2.5 Pro",
47
- "input": ["text"],
48
- "reasoning": true,
49
- "contextWindow": 1048576,
50
- "maxTokens": 131072,
51
- "cost": {
52
- "input": 0,
53
- "output": 0,
54
- "cacheRead": 0,
55
- "cacheWrite": 0
56
- }
57
- }, {
58
- "id": "mimo-v2.5",
59
- "name": "Xiaomi MiMo V2.5",
60
- "input": ["text", "image"],
61
- "reasoning": true,
62
- "contextWindow": 1048576,
63
- "maxTokens": 131072,
64
- "cost": {
65
- "input": 0,
66
- "output": 0,
67
- "cacheRead": 0,
68
- "cacheWrite": 0
69
- },
70
- "compat": { "codeMode": "preferred" }
71
- }]
72
- }
73
- },
74
- "discovery": {
75
- "xiaomi": "refreshable",
76
- "xiaomi-token-plan": "refreshable"
77
- }
78
- };
79
- //#endregion
80
- //#region extensions/xiaomi/provider-catalog.ts
81
- const XIAOMI_PROVIDER_ID = "xiaomi";
82
- const XIAOMI_TOKEN_PLAN_PROVIDER_ID = "xiaomi-token-plan";
83
- const XIAOMI_DEFAULT_MODEL_ID = "mimo-v2.5";
84
- const XIAOMI_TOKEN_PLAN_DEFAULT_MODEL_ID = "mimo-v2.5-pro";
85
- const XIAOMI_TOKEN_PLAN_BASE_URLS = {
86
- ams: "https://token-plan-ams.xiaomimimo.com/v1",
87
- cn: "https://token-plan-cn.xiaomimimo.com/v1",
88
- sgp: "https://token-plan-sgp.xiaomimimo.com/v1"
89
- };
90
- function buildXiaomiProvider() {
91
- return buildManifestModelProviderConfig({
92
- providerId: XIAOMI_PROVIDER_ID,
93
- catalog: modelCatalog.providers.xiaomi
94
- });
95
- }
96
- function buildXiaomiTokenPlanProvider() {
97
- return buildManifestModelProviderConfig({
98
- providerId: XIAOMI_TOKEN_PLAN_PROVIDER_ID,
99
- catalog: modelCatalog.providers[XIAOMI_TOKEN_PLAN_PROVIDER_ID]
100
- });
101
- }
102
- function resolveXiaomiTokenPlanBaseUrl(region) {
103
- return XIAOMI_TOKEN_PLAN_BASE_URLS[region];
104
- }
105
- //#endregion
106
- export { buildXiaomiProvider as a, XIAOMI_TOKEN_PLAN_PROVIDER_ID as i, XIAOMI_PROVIDER_ID as n, buildXiaomiTokenPlanProvider as o, XIAOMI_TOKEN_PLAN_DEFAULT_MODEL_ID as r, resolveXiaomiTokenPlanBaseUrl as s, XIAOMI_DEFAULT_MODEL_ID as t };