Add xiaomi token plan provider

This commit is contained in:
decolua
2026-05-15 10:29:25 +07:00
parent beb4599090
commit d26db17f5f
7 changed files with 34 additions and 3 deletions
+10
View File
@@ -527,6 +527,16 @@ export const PROVIDER_MODELS = {
{ id: "mimo-v2-omni", name: "MiMo V2 Omni" },
{ id: "mimo-v2-flash", name: "MiMo V2 Flash" },
],
"xiaomi-tokenplan": [
{ id: "mimo-v2.5-pro", name: "MiMo V2.5 Pro" },
{ id: "mimo-v2.5", name: "MiMo V2.5" },
{ id: "mimo-v2-pro", name: "MiMo V2 Pro" },
{ id: "mimo-v2-omni", name: "MiMo V2 Omni" },
{ id: "mimo-v2-tts", name: "MiMo V2 TTS" },
{ id: "mimo-v2.5-tts", name: "MiMo V2.5 TTS" },
{ id: "mimo-v2.5-tts-voiceclone", name: "MiMo V2.5 TTS Voice Clone" },
{ id: "mimo-v2.5-tts-voicedesign", name: "MiMo V2.5 TTS Voice Design" },
],
hyperbolic: [
{ id: "Qwen/QwQ-32B", name: "QwQ 32B" },
{ id: "deepseek-ai/DeepSeek-R1", name: "DeepSeek R1" },
+4
View File
@@ -387,6 +387,10 @@ export const PROVIDERS = {
baseUrl: "https://api.xiaomimimo.com/v1/chat/completions",
format: "openai"
},
"xiaomi-tokenplan": {
baseUrl: "https://token-plan-sgp.xiaomimimo.com/v1/chat/completions",
format: "openai"
},
// === Free-tier providers (synced from OmniRoute) ===
// Claude-format with Claude CLI header spoofing (auth: x-api-key)
agentrouter: { baseUrl: "https://agentrouter.org/v1/messages", format: "claude", headers: { ...CLAUDE_CLI_SPOOF_HEADERS } },
+2
View File
@@ -67,6 +67,8 @@ const ALIAS_TO_PROVIDER_ID = {
"perplexity-web": "perplexity-web",
mimo: "xiaomi-mimo",
"xiaomi-mimo": "xiaomi-mimo",
xmtp: "xiaomi-tokenplan",
"xiaomi-tokenplan": "xiaomi-tokenplan",
cf: "cloudflare-ai",
"cloudflare-ai": "cloudflare-ai",
// Image/video providers
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

+3 -1
View File
@@ -353,6 +353,7 @@ export async function POST(request) {
case "nanobanana":
case "chutes":
case "xiaomi-mimo":
case "xiaomi-tokenplan":
case "nvidia": {
const endpoints = {
deepseek: "https://api.deepseek.com/models",
@@ -373,7 +374,8 @@ export async function POST(request) {
nanobanana: "https://api.nanobananaapi.ai/v1/models",
chutes: "https://llm.chutes.ai/v1/models",
nvidia: "https://integrate.api.nvidia.com/v1/models",
"xiaomi-mimo": "https://api.xiaomimimo.com/v1/models"
"xiaomi-mimo": "https://api.xiaomimimo.com/v1/models",
"xiaomi-tokenplan": "https://token-plan-sgp.xiaomimimo.com/v1/models"
};
const headers = {};
if (apiKey) headers["Authorization"] = `Bearer ${apiKey}`;
File diff suppressed because one or more lines are too long
+14 -2
View File
@@ -1,8 +1,20 @@
// Re-export from open-sse with localDb integration
import { getModelAliases, getComboByName, getProviderNodes } from "@/lib/localDb";
import { parseModel, resolveModelAliasFromMap, getModelInfoCore } from "open-sse/services/model.js";
import { parseModel as parseModelCore, resolveModelAliasFromMap, getModelInfoCore } from "open-sse/services/model.js";
export { parseModel };
// Local provider alias overrides (HMR-friendly, applied on top of open-sse map)
const LOCAL_PROVIDER_ALIASES = {
xmtp: "xiaomi-tokenplan",
"xiaomi-tokenplan": "xiaomi-tokenplan",
};
export function parseModel(modelStr) {
const parsed = parseModelCore(modelStr);
if (parsed?.providerAlias && LOCAL_PROVIDER_ALIASES[parsed.providerAlias]) {
return { ...parsed, provider: LOCAL_PROVIDER_ALIASES[parsed.providerAlias] };
}
return parsed;
}
/**
* Resolve model alias from localDb