@openclaw/xiaomi-provider 2026.9.5 → 2026.9.6
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/dist/.setup/provider-catalog-v9-9qyII.mjs +186 -0
- package/dist/api.js +1 -1
- package/dist/index.js +74 -140
- package/dist/onboard.js +2 -2
- package/dist/provider-catalog.js +1 -1
- package/dist/thinking.js +4 -2
- package/openclaw.plugin.json +97 -0
- package/package.json +4 -4
- package/dist/.setup/provider-catalog-B2pu2gGC.mjs +0 -106
|
@@ -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-
|
|
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,9 +1,9 @@
|
|
|
1
|
-
import { a as buildXiaomiProvider, i as XIAOMI_TOKEN_PLAN_PROVIDER_ID, n as XIAOMI_PROVIDER_ID, o as buildXiaomiTokenPlanProvider } from "./.setup/provider-catalog-
|
|
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,
|
|
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";
|
|
@@ -77,39 +77,25 @@ function resolveProfileId(providerId) {
|
|
|
77
77
|
return `${providerId}:default`;
|
|
78
78
|
}
|
|
79
79
|
async function runXiaomiApiKeyAuth(ctx, params) {
|
|
80
|
-
let capturedSecretInput;
|
|
81
|
-
let capturedCredential = false;
|
|
82
|
-
let capturedMode;
|
|
83
80
|
const profileId = resolveProfileId(params.providerId);
|
|
81
|
+
const { apiKey, input, mode } = await captureProviderApiKey(ctx, {
|
|
82
|
+
token: normalizeOptionalSecretInput(ctx.opts?.[params.optionKey]) ?? normalizeOptionalSecretInput(ctx.opts?.token),
|
|
83
|
+
tokenProvider: normalizeOptionalSecretInput(ctx.opts?.[params.optionKey]) ? params.providerId : normalizeOptionalSecretInput(ctx.opts?.tokenProvider),
|
|
84
|
+
env: ctx.env,
|
|
85
|
+
expectedProviders: [params.providerId],
|
|
86
|
+
provider: params.providerId,
|
|
87
|
+
envLabel: params.envVar,
|
|
88
|
+
promptMessage: params.promptMessage,
|
|
89
|
+
missingInputMessage: `Missing Xiaomi API key for provider "${params.providerId}".`
|
|
90
|
+
});
|
|
84
91
|
assertCompatibleXiaomiKey({
|
|
85
|
-
actualKey:
|
|
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
|
-
}),
|
|
92
|
+
actualKey: apiKey,
|
|
105
93
|
expectedKind: params.expectedKind
|
|
106
94
|
});
|
|
107
|
-
if (!capturedCredential) throw new Error(`Missing Xiaomi API key for provider "${params.providerId}".`);
|
|
108
|
-
const credentialInput = capturedSecretInput ?? "";
|
|
109
95
|
return {
|
|
110
96
|
profiles: [{
|
|
111
97
|
profileId,
|
|
112
|
-
credential: buildApiKeyCredential(params.providerId,
|
|
98
|
+
credential: buildApiKeyCredential(params.providerId, input, void 0, mode ? { secretInputMode: mode } : void 0)
|
|
113
99
|
}],
|
|
114
100
|
configPatch: params.applyConfig(ctx.config),
|
|
115
101
|
defaultModel: params.defaultModel
|
|
@@ -128,18 +114,10 @@ async function runXiaomiApiKeyAuthNonInteractive(ctx, params) {
|
|
|
128
114
|
expectedKind: params.expectedKind
|
|
129
115
|
});
|
|
130
116
|
const profileId = resolveProfileId(params.providerId);
|
|
131
|
-
if (
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
});
|
|
136
|
-
if (!credential) return null;
|
|
137
|
-
await upsertAuthProfileWithLockOrThrow({
|
|
138
|
-
profileId,
|
|
139
|
-
credential,
|
|
140
|
-
agentDir: ctx.agentDir
|
|
141
|
-
});
|
|
142
|
-
}
|
|
117
|
+
if (!await persistProviderApiKey(ctx, profileId, {
|
|
118
|
+
provider: params.providerId,
|
|
119
|
+
resolved
|
|
120
|
+
})) return null;
|
|
143
121
|
const next = applyAuthProfileConfig(ctx.config, {
|
|
144
122
|
profileId,
|
|
145
123
|
provider: params.providerId,
|
|
@@ -147,70 +125,42 @@ async function runXiaomiApiKeyAuthNonInteractive(ctx, params) {
|
|
|
147
125
|
});
|
|
148
126
|
return params.applyConfig(next);
|
|
149
127
|
}
|
|
150
|
-
function
|
|
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) {
|
|
128
|
+
function createXiaomiApiKeyAuthMethod(region) {
|
|
182
129
|
const regionLabel = region === "ams" ? "Europe" : region === "cn" ? "China" : "Singapore";
|
|
183
|
-
const
|
|
184
|
-
const
|
|
185
|
-
const
|
|
130
|
+
const choiceLabel = region ? `Xiaomi Token Plan (${regionLabel})` : "Xiaomi API key (Pay-as-you-go)";
|
|
131
|
+
const choiceHint = region ? `Endpoint preset: token-plan-${region}.xiaomimimo.com/v1` : "Endpoint: api.xiaomimimo.com/v1";
|
|
132
|
+
const auth = region ? {
|
|
133
|
+
providerId: XIAOMI_TOKEN_PLAN_PROVIDER_ID,
|
|
134
|
+
optionKey: TOKEN_PLAN_OPTION_KEY,
|
|
135
|
+
flagName: TOKEN_PLAN_FLAG_NAME,
|
|
136
|
+
envVar: TOKEN_PLAN_ENV_VAR,
|
|
137
|
+
promptMessage: `Enter Xiaomi MiMo Token Plan API key (tp-...) for ${regionLabel}`,
|
|
138
|
+
expectedKind: "token-plan",
|
|
139
|
+
defaultModel: XIAOMI_TOKEN_PLAN_DEFAULT_MODEL_REF,
|
|
140
|
+
applyConfig: (cfg) => applyXiaomiTokenPlanConfig(cfg, region)
|
|
141
|
+
} : {
|
|
142
|
+
providerId: XIAOMI_PROVIDER_ID,
|
|
143
|
+
optionKey: PAYG_OPTION_KEY,
|
|
144
|
+
flagName: PAYG_FLAG_NAME,
|
|
145
|
+
envVar: PAYG_ENV_VAR,
|
|
146
|
+
promptMessage: "Enter Xiaomi MiMo API key (pay-as-you-go, sk-...)",
|
|
147
|
+
expectedKind: "payg",
|
|
148
|
+
defaultModel: XIAOMI_DEFAULT_MODEL_REF,
|
|
149
|
+
applyConfig: applyXiaomiConnectionConfig
|
|
150
|
+
};
|
|
186
151
|
return {
|
|
187
|
-
id: `token-plan-${region}
|
|
152
|
+
id: region ? `token-plan-${region}` : "api-key",
|
|
188
153
|
label: choiceLabel,
|
|
189
154
|
hint: choiceHint,
|
|
190
155
|
kind: "api_key",
|
|
191
156
|
wizard: {
|
|
192
|
-
choiceId,
|
|
157
|
+
choiceId: region ? `xiaomi-token-plan-${region}` : "xiaomi-api-key",
|
|
193
158
|
choiceLabel,
|
|
194
159
|
choiceHint,
|
|
195
160
|
...XIAOMI_WIZARD_GROUP
|
|
196
161
|
},
|
|
197
|
-
run: async (ctx) => await runXiaomiApiKeyAuth(ctx,
|
|
198
|
-
|
|
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
|
-
})
|
|
162
|
+
run: async (ctx) => await runXiaomiApiKeyAuth(ctx, auth),
|
|
163
|
+
runNonInteractive: async (ctx) => await runXiaomiApiKeyAuthNonInteractive(ctx, auth)
|
|
214
164
|
};
|
|
215
165
|
}
|
|
216
166
|
var xiaomi_default = definePluginEntry({
|
|
@@ -218,73 +168,57 @@ var xiaomi_default = definePluginEntry({
|
|
|
218
168
|
name: "Xiaomi Provider",
|
|
219
169
|
description: "Xiaomi provider plugin",
|
|
220
170
|
register(api) {
|
|
221
|
-
|
|
171
|
+
for (const provider of [{
|
|
222
172
|
id: XIAOMI_PROVIDER_ID,
|
|
223
173
|
label: "Xiaomi",
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
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({
|
|
174
|
+
envVar: PAYG_ENV_VAR,
|
|
175
|
+
auth: () => [createXiaomiApiKeyAuthMethod()],
|
|
176
|
+
buildProvider: buildXiaomiProvider,
|
|
177
|
+
displayName: PROVIDER_LABELS.xiaomi,
|
|
178
|
+
requiresRegion: false
|
|
179
|
+
}, {
|
|
254
180
|
id: XIAOMI_TOKEN_PLAN_PROVIDER_ID,
|
|
255
181
|
label: "Xiaomi Token Plan",
|
|
182
|
+
envVar: TOKEN_PLAN_ENV_VAR,
|
|
183
|
+
auth: () => [
|
|
184
|
+
"ams",
|
|
185
|
+
"cn",
|
|
186
|
+
"sgp"
|
|
187
|
+
].map(createXiaomiApiKeyAuthMethod),
|
|
188
|
+
buildProvider: buildXiaomiTokenPlanProvider,
|
|
189
|
+
displayName: "Xiaomi MiMo Token Plan",
|
|
190
|
+
requiresRegion: true
|
|
191
|
+
}]) api.registerProvider({
|
|
192
|
+
id: provider.id,
|
|
193
|
+
label: provider.label,
|
|
256
194
|
docsPath: "/providers/xiaomi",
|
|
257
|
-
envVars: [
|
|
258
|
-
auth:
|
|
259
|
-
createTokenPlanAuthMethod("ams"),
|
|
260
|
-
createTokenPlanAuthMethod("cn"),
|
|
261
|
-
createTokenPlanAuthMethod("sgp")
|
|
262
|
-
],
|
|
195
|
+
envVars: [provider.envVar],
|
|
196
|
+
auth: provider.auth(),
|
|
263
197
|
catalog: {
|
|
264
198
|
order: "simple",
|
|
265
199
|
run: async (ctx) => resolveXiaomiCatalog({
|
|
266
200
|
ctx,
|
|
267
|
-
providerId:
|
|
268
|
-
buildProvider:
|
|
269
|
-
requireConfiguredProvider:
|
|
270
|
-
requireBaseUrl:
|
|
201
|
+
providerId: provider.id,
|
|
202
|
+
buildProvider: provider.buildProvider,
|
|
203
|
+
requireConfiguredProvider: provider.requiresRegion,
|
|
204
|
+
requireBaseUrl: provider.requiresRegion
|
|
271
205
|
})
|
|
272
206
|
},
|
|
273
207
|
staticCatalog: {
|
|
274
208
|
order: "simple",
|
|
275
|
-
run: async () => ({ provider:
|
|
209
|
+
run: async () => ({ provider: provider.buildProvider() })
|
|
276
210
|
},
|
|
277
211
|
...XIAOMI_PROVIDER_HOOKS,
|
|
278
212
|
resolveUsageAuth: async (ctx) => {
|
|
279
213
|
const apiKey = ctx.resolveApiKeyFromConfigAndStore({
|
|
280
|
-
providerIds: [
|
|
281
|
-
envDirect: [ctx.env.
|
|
214
|
+
providerIds: [provider.id],
|
|
215
|
+
envDirect: [ctx.env[provider.envVar]]
|
|
282
216
|
});
|
|
283
217
|
return apiKey ? { token: apiKey } : null;
|
|
284
218
|
},
|
|
285
219
|
fetchUsageSnapshot: async () => ({
|
|
286
|
-
provider:
|
|
287
|
-
displayName:
|
|
220
|
+
provider: provider.id,
|
|
221
|
+
displayName: provider.displayName,
|
|
288
222
|
windows: []
|
|
289
223
|
})
|
|
290
224
|
});
|
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-
|
|
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.
|
|
39
|
+
alias: defaultModel?.name ?? "Xiaomi MiMo V2.6 Pro"
|
|
40
40
|
}];
|
|
41
41
|
})()
|
|
42
42
|
};
|
package/dist/provider-catalog.js
CHANGED
|
@@ -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-
|
|
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 };
|
package/dist/thinking.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import "./.setup/provider-catalog-
|
|
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-
|
|
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());
|
package/openclaw.plugin.json
CHANGED
|
@@ -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.
|
|
3
|
+
"version": "2026.9.6",
|
|
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.
|
|
21
|
+
"pluginApi": ">=2026.9.6"
|
|
22
22
|
},
|
|
23
23
|
"build": {
|
|
24
|
-
"openclawVersion": "2026.9.
|
|
24
|
+
"openclawVersion": "2026.9.6",
|
|
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.
|
|
43
|
+
"openclaw": ">=2026.9.6"
|
|
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 };
|