mirror of
https://github.com/Nezumi-2711/9router.git
synced 2026-09-22 13:38:31 +00:00
refactor(open-sse): registry consolidation + DRY media/oauth/adhoc cleanup
- Single-source registry: oauth clientId/tokenUrl, usage URLs, image/embed configs, search defaultModel, codex fixedPort, google token url derive. - Remove 29 unused OmniRoute providers (registry 100→71); media intact. - De-adhoc: codex literals → registry format/oauth flags; reasoningInject, image/embed openrouter headers + xai bodyFields config-driven. - Add REGISTRY_TEMPLATE.js + expand PROVIDER_DEFAULTS/schema JSDoc. - Baselines updated; PROVIDERS 62 + alias 90 byte-for-byte, golden snapshots. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -88,67 +88,18 @@
|
||||
"jina-ai": "jina-ai",
|
||||
"polly": "aws-polly",
|
||||
"aws-polly": "aws-polly",
|
||||
"agentrouter": "agentrouter",
|
||||
"aimlapi": "aimlapi",
|
||||
"aiml": "aimlapi",
|
||||
"novita": "novita",
|
||||
"modal": "modal",
|
||||
"mdl": "modal",
|
||||
"reka": "reka",
|
||||
"nlpcloud": "nlpcloud",
|
||||
"nlpc": "nlpcloud",
|
||||
"bazaarlink": "bazaarlink",
|
||||
"bzl": "bazaarlink",
|
||||
"completions": "completions",
|
||||
"cpl": "completions",
|
||||
"enally": "enally",
|
||||
"enly": "enally",
|
||||
"freetheai": "freetheai",
|
||||
"fta": "freetheai",
|
||||
"llm7": "llm7",
|
||||
"lepton": "lepton",
|
||||
"kluster": "kluster",
|
||||
"ai21": "ai21",
|
||||
"inference-net": "inference-net",
|
||||
"inet": "inference-net",
|
||||
"predibase": "predibase",
|
||||
"bytez": "bytez",
|
||||
"morph": "morph",
|
||||
"longcat": "longcat",
|
||||
"lc": "longcat",
|
||||
"puter": "puter",
|
||||
"pu": "puter",
|
||||
"uncloseai": "uncloseai",
|
||||
"unc": "uncloseai",
|
||||
"scaleway": "scaleway",
|
||||
"scw": "scaleway",
|
||||
"deepinfra": "deepinfra",
|
||||
"sambanova": "sambanova",
|
||||
"samba": "sambanova",
|
||||
"nscale": "nscale",
|
||||
"baseten": "baseten",
|
||||
"publicai": "publicai",
|
||||
"nous-research": "nous-research",
|
||||
"nous": "nous-research",
|
||||
"glhf": "glhf",
|
||||
"bb": "blackbox",
|
||||
"blackbox": "blackbox"
|
||||
},
|
||||
"idToAlias": {
|
||||
"agentrouter": "agentrouter",
|
||||
"ai21": "ai21",
|
||||
"aimlapi": "aimlapi",
|
||||
"alicode": "alicode",
|
||||
"alicode-intl": "alicode-intl",
|
||||
"anthropic": "anthropic",
|
||||
"antigravity": "ag",
|
||||
"assemblyai": "assemblyai",
|
||||
"azure": "azure",
|
||||
"baseten": "baseten",
|
||||
"bazaarlink": "bazaarlink",
|
||||
"blackbox": "blackbox",
|
||||
"byteplus": "byteplus",
|
||||
"bytez": "bytez",
|
||||
"cerebras": "cerebras",
|
||||
"chutes": "chutes",
|
||||
"claude": "cc",
|
||||
@@ -158,47 +109,31 @@
|
||||
"codex": "cx",
|
||||
"cohere": "cohere",
|
||||
"commandcode": "commandcode",
|
||||
"completions": "completions",
|
||||
"cursor": "cu",
|
||||
"deepgram": "deepgram",
|
||||
"deepinfra": "deepinfra",
|
||||
"deepseek": "deepseek",
|
||||
"enally": "enally",
|
||||
"fireworks": "fireworks",
|
||||
"freetheai": "freetheai",
|
||||
"gemini": "gemini",
|
||||
"gemini-cli": "gc",
|
||||
"github": "gh",
|
||||
"gitlab": "gitlab",
|
||||
"glhf": "glhf",
|
||||
"glm": "glm",
|
||||
"glm-cn": "glm-cn",
|
||||
"grok-web": "grok-web",
|
||||
"groq": "groq",
|
||||
"hyperbolic": "hyperbolic",
|
||||
"iflow": "if",
|
||||
"inference-net": "inference-net",
|
||||
"kilocode": "kc",
|
||||
"kimi": "kimi",
|
||||
"kimi-coding": "kmc",
|
||||
"kiro": "kr",
|
||||
"kluster": "kluster",
|
||||
"lepton": "lepton",
|
||||
"llm7": "llm7",
|
||||
"longcat": "longcat",
|
||||
"mimo-free": "mmf",
|
||||
"minimax": "minimax",
|
||||
"minimax-cn": "minimax-cn",
|
||||
"mistral": "mistral",
|
||||
"mmf": "mmf",
|
||||
"modal": "modal",
|
||||
"morph": "morph",
|
||||
"nanobanana": "nanobanana",
|
||||
"nebius": "nebius",
|
||||
"nlpcloud": "nlpcloud",
|
||||
"nous-research": "nous-research",
|
||||
"novita": "novita",
|
||||
"nscale": "nscale",
|
||||
"nvidia": "nvidia",
|
||||
"ollama": "ollama",
|
||||
"ollama-local": "ollama-local",
|
||||
@@ -208,17 +143,10 @@
|
||||
"openrouter": "openrouter",
|
||||
"perplexity": "perplexity",
|
||||
"perplexity-web": "perplexity-web",
|
||||
"predibase": "predibase",
|
||||
"publicai": "publicai",
|
||||
"puter": "puter",
|
||||
"qoder": "qd",
|
||||
"qwen": "qw",
|
||||
"reka": "reka",
|
||||
"sambanova": "sambanova",
|
||||
"scaleway": "scaleway",
|
||||
"siliconflow": "siliconflow",
|
||||
"together": "together",
|
||||
"uncloseai": "uncloseai",
|
||||
"vercel-ai-gateway": "vercel-ai-gateway",
|
||||
"vertex": "vertex",
|
||||
"vertex-partner": "vertex-partner",
|
||||
@@ -229,19 +157,13 @@
|
||||
},
|
||||
"modelKeys": [
|
||||
"ag",
|
||||
"agentrouter",
|
||||
"ai21",
|
||||
"aimlapi",
|
||||
"alicode",
|
||||
"alicode-intl",
|
||||
"anthropic",
|
||||
"assemblyai",
|
||||
"baseten",
|
||||
"bazaarlink",
|
||||
"black-forest-labs",
|
||||
"blackbox",
|
||||
"byteplus",
|
||||
"bytez",
|
||||
"cc",
|
||||
"cerebras",
|
||||
"cl",
|
||||
@@ -249,24 +171,19 @@
|
||||
"cohere",
|
||||
"comfyui",
|
||||
"commandcode",
|
||||
"completions",
|
||||
"cu",
|
||||
"cx",
|
||||
"deepgram",
|
||||
"deepinfra",
|
||||
"deepseek",
|
||||
"edge-tts",
|
||||
"elevenlabs-tts-models",
|
||||
"enally",
|
||||
"fal-ai",
|
||||
"fireworks",
|
||||
"freetheai",
|
||||
"gc",
|
||||
"gemini",
|
||||
"gemini-tts-models",
|
||||
"gemini-tts-voices",
|
||||
"gh",
|
||||
"glhf",
|
||||
"glm",
|
||||
"glm-cn",
|
||||
"google-tts",
|
||||
@@ -275,28 +192,17 @@
|
||||
"huggingface",
|
||||
"hyperbolic",
|
||||
"if",
|
||||
"inference-net",
|
||||
"kc",
|
||||
"kimi",
|
||||
"kluster",
|
||||
"kmc",
|
||||
"kr",
|
||||
"lepton",
|
||||
"llm7",
|
||||
"local-device",
|
||||
"longcat",
|
||||
"minimax",
|
||||
"minimax-cn",
|
||||
"mistral",
|
||||
"mmf",
|
||||
"modal",
|
||||
"morph",
|
||||
"nanobanana",
|
||||
"nebius",
|
||||
"nlpcloud",
|
||||
"nous-research",
|
||||
"novita",
|
||||
"nscale",
|
||||
"nvidia",
|
||||
"oc",
|
||||
"ollama",
|
||||
@@ -309,21 +215,14 @@
|
||||
"openrouter-tts-voices",
|
||||
"perplexity",
|
||||
"perplexity-web",
|
||||
"predibase",
|
||||
"publicai",
|
||||
"puter",
|
||||
"qd",
|
||||
"qw",
|
||||
"recraft",
|
||||
"reka",
|
||||
"runwayml",
|
||||
"sambanova",
|
||||
"scaleway",
|
||||
"sdwebui",
|
||||
"siliconflow",
|
||||
"stability-ai",
|
||||
"together",
|
||||
"uncloseai",
|
||||
"vertex",
|
||||
"vertex-partner",
|
||||
"volcengine-ark",
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -395,142 +395,8 @@
|
||||
"baseUrl": "https://token-plan-sgp.xiaomimimo.com/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"agentrouter": {
|
||||
"baseUrl": "https://agentrouter.org/v1/messages",
|
||||
"format": "claude",
|
||||
"headers": {
|
||||
"Anthropic-Version": "2023-06-01",
|
||||
"Anthropic-Beta": "claude-code-20250219,oauth-2025-04-20,interleaved-thinking-2025-05-14,context-management-2025-06-27,prompt-caching-scope-2026-01-05,advanced-tool-use-2025-11-20,effort-2025-11-24,structured-outputs-2025-12-15,fast-mode-2026-02-01,redact-thinking-2026-02-12,token-efficient-tools-2026-03-28",
|
||||
"Anthropic-Dangerous-Direct-Browser-Access": "true",
|
||||
"User-Agent": "claude-cli/2.1.92 (external, sdk-cli)",
|
||||
"X-App": "cli",
|
||||
"X-Stainless-Helper-Method": "stream",
|
||||
"X-Stainless-Retry-Count": "0",
|
||||
"X-Stainless-Runtime-Version": "v24.14.0",
|
||||
"X-Stainless-Package-Version": "0.80.0",
|
||||
"X-Stainless-Runtime": "node",
|
||||
"X-Stainless-Lang": "js",
|
||||
"X-Stainless-Arch": "arm64",
|
||||
"X-Stainless-Os": "MacOS",
|
||||
"X-Stainless-Timeout": "600"
|
||||
}
|
||||
},
|
||||
"aimlapi": {
|
||||
"baseUrl": "https://api.aimlapi.com/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"novita": {
|
||||
"baseUrl": "https://api.novita.ai/v3/openai/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"modal": {
|
||||
"baseUrl": "https://api.modal.com/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"reka": {
|
||||
"baseUrl": "https://api.reka.ai/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"nlpcloud": {
|
||||
"baseUrl": "https://api.nlpcloud.io/v1/gpu/chatbot",
|
||||
"format": "openai"
|
||||
},
|
||||
"bazaarlink": {
|
||||
"baseUrl": "https://bazaarlink.ai/api/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"completions": {
|
||||
"baseUrl": "https://completions.me/api/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"enally": {
|
||||
"baseUrl": "https://ai.enally.in/v1/chat/completions",
|
||||
"format": "openai",
|
||||
"authHeader": "x-api-key"
|
||||
},
|
||||
"freetheai": {
|
||||
"baseUrl": "https://api.freetheai.xyz/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"llm7": {
|
||||
"baseUrl": "https://api.llm7.io/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"lepton": {
|
||||
"baseUrl": "https://api.lepton.ai/api/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"kluster": {
|
||||
"baseUrl": "https://api.kluster.ai/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"ai21": {
|
||||
"baseUrl": "https://api.ai21.com/studio/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"inference-net": {
|
||||
"baseUrl": "https://api.inference.net/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"predibase": {
|
||||
"baseUrl": "https://serving.app.predibase.com/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"bytez": {
|
||||
"baseUrl": "https://api.bytez.com/models/v2",
|
||||
"format": "openai"
|
||||
},
|
||||
"morph": {
|
||||
"baseUrl": "https://api.morphllm.com/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"longcat": {
|
||||
"baseUrl": "https://api.longcat.chat/openai/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"puter": {
|
||||
"baseUrl": "https://api.puter.com/puterai/openai/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"uncloseai": {
|
||||
"baseUrl": "https://hermes.ai.unturf.com/v1/chat/completions",
|
||||
"format": "openai",
|
||||
"noAuth": true
|
||||
},
|
||||
"scaleway": {
|
||||
"baseUrl": "https://api.scaleway.ai/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"deepinfra": {
|
||||
"baseUrl": "https://api.deepinfra.com/v1/openai/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"sambanova": {
|
||||
"baseUrl": "https://api.sambanova.ai/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"nscale": {
|
||||
"baseUrl": "https://inference.api.nscale.com/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"baseten": {
|
||||
"baseUrl": "https://inference.baseten.co/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"publicai": {
|
||||
"baseUrl": "https://api.publicai.co/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"nous-research": {
|
||||
"baseUrl": "https://inference-api.nousresearch.com/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"glhf": {
|
||||
"baseUrl": "https://glhf.chat/api/openai/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"blackbox": {
|
||||
"baseUrl": "https://api.blackbox.ai/chat/completions",
|
||||
"format": "openai"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,11 +18,7 @@ const ALIAS_TOKENS = [
|
||||
"chutes","ark","volcengine-ark","byteplus","bpm","cursor","vx","vertex","vxp","vertex-partner",
|
||||
"gw","grok-web","pw","perplexity-web","mimo","xiaomi-mimo","xmtp","xiaomi-tokenplan","cf",
|
||||
"cloudflare-ai","fal","fal-ai","stability","stability-ai","bfl","black-forest-labs","recraft",
|
||||
"topaz","runway","runwayml","jina","jina-ai","polly","aws-polly","agentrouter","aimlapi","aiml",
|
||||
"novita","modal","mdl","reka","nlpcloud","nlpc","bazaarlink","bzl","completions","cpl","enally",
|
||||
"enly","freetheai","fta","llm7","lepton","kluster","ai21","inference-net","inet","predibase",
|
||||
"bytez","morph","longcat","lc","puter","pu","uncloseai","unc","scaleway","scw","deepinfra",
|
||||
"sambanova","samba","nscale","baseten","publicai","nous-research","nous","glhf","bb","blackbox",
|
||||
"topaz","runway","runwayml","jina","jina-ai","polly","aws-polly","bb","blackbox",
|
||||
];
|
||||
|
||||
// Sort idToAlias by key — runtime accesses by key, order is irrelevant (content-based)
|
||||
|
||||
@@ -9,12 +9,15 @@ const here = dirname(fileURLToPath(import.meta.url));
|
||||
const baseline = JSON.parse(readFileSync(join(here, "providers-baseline.json"), "utf8"));
|
||||
|
||||
// Fields intentionally added during refactor (verified by dedicated runtime tests, not byte-baseline).
|
||||
const ADDED_FIELDS = new Set(["forceStream", "urlSuffix"]);
|
||||
// authUrl: removed dead field (qwen/iflow) — no consumer reads config.authUrl (oauth block has authorize/deviceCode)
|
||||
const ADDED_FIELDS = new Set(["forceStream", "urlSuffix", "retry", "quirks", "auth", "validateUrl", "usage", "clientId", "clientSecret", "tokenUrl", "cliVersion", "apiClient", "copilot", "authorizeUrl", "authUrl", "regions", "defaultRegion", "reasoningInject"]);
|
||||
|
||||
// Normalize via JSON roundtrip so function/undefined are dropped identically; drop added fields.
|
||||
// Normalize via JSON roundtrip so function/undefined are dropped identically; drop added/removed fields.
|
||||
// ADDED_FIELDS are verified by dedicated runtime tests, so drop them from BOTH sides (added or intentionally removed).
|
||||
const current = JSON.parse(JSON.stringify(PROVIDERS));
|
||||
for (const id of Object.keys(current)) {
|
||||
for (const f of ADDED_FIELDS) delete current[id][f];
|
||||
for (const f of ADDED_FIELDS) {
|
||||
for (const id of Object.keys(current)) delete current[id][f];
|
||||
for (const id of Object.keys(baseline)) delete baseline[id][f];
|
||||
}
|
||||
|
||||
const diffs = [];
|
||||
|
||||
Reference in New Issue
Block a user