feat: support xiaomi/mimo-v2-flash

This commit is contained in:
Vibe Kanban
2026-01-29 00:30:17 +08:00
committed by Peter Steinberger
parent cb4b3f74b5
commit 50d44d0bd9
19 changed files with 334 additions and 1 deletions

View File

@@ -96,6 +96,33 @@ function resolveMinimaxApiKey(): string | undefined {
return undefined;
}
function resolveXiaomiApiKey(): string | undefined {
const envDirect = process.env.XIAOMI_API_KEY?.trim();
if (envDirect) return envDirect;
const envResolved = resolveEnvApiKey("xiaomi");
if (envResolved?.apiKey) return envResolved.apiKey;
const cfg = loadConfig();
const key = getCustomProviderApiKey(cfg, "xiaomi");
if (key) return key;
const store = ensureAuthProfileStore();
const apiProfile = listProfilesForProvider(store, "xiaomi").find((id) => {
const cred = store.profiles[id];
return cred?.type === "api_key" || cred?.type === "token";
});
if (!apiProfile) return undefined;
const cred = store.profiles[apiProfile];
if (cred?.type === "api_key" && cred.key?.trim()) {
return cred.key.trim();
}
if (cred?.type === "token" && cred.token?.trim()) {
return cred.token.trim();
}
return undefined;
}
async function resolveOAuthToken(params: {
provider: UsageProviderId;
agentDir?: string;
@@ -199,6 +226,11 @@ export async function resolveProviderAuths(params: {
if (apiKey) auths.push({ provider, token: apiKey });
continue;
}
if (provider === "xiaomi") {
const apiKey = resolveXiaomiApiKey();
if (apiKey) auths.push({ provider, token: apiKey });
continue;
}
if (!oauthProviders.includes(provider)) continue;
const auth = await resolveOAuthToken({

View File

@@ -66,6 +66,12 @@ export async function loadProviderUsageSummary(
return await fetchCodexUsage(auth.token, auth.accountId, timeoutMs, fetchFn);
case "minimax":
return await fetchMinimaxUsage(auth.token, timeoutMs, fetchFn);
case "xiaomi":
return {
provider: "xiaomi",
displayName: PROVIDER_LABELS.xiaomi,
windows: [],
};
case "zai":
return await fetchZaiUsage(auth.token, timeoutMs, fetchFn);
default:

View File

@@ -10,6 +10,7 @@ export const PROVIDER_LABELS: Record<UsageProviderId, string> = {
"google-antigravity": "Antigravity",
minimax: "MiniMax",
"openai-codex": "Codex",
xiaomi: "Xiaomi",
zai: "z.ai",
};
@@ -20,6 +21,7 @@ export const usageProviders: UsageProviderId[] = [
"google-antigravity",
"minimax",
"openai-codex",
"xiaomi",
"zai",
];

View File

@@ -24,4 +24,5 @@ export type UsageProviderId =
| "google-antigravity"
| "minimax"
| "openai-codex"
| "xiaomi"
| "zai";