mirror of
https://github.com/Nezumi-2711/9router.git
synced 2026-09-22 13:38:31 +00:00
refactor(open-sse): dedup format default in PROVIDERS via resolver (C1)
Wrap PROVIDERS in defineProviders() that appends format:"openai" when omitted, removing 72 repeated `format:"openai"` lines. Output stays byte-for-byte identical (verified by tests/__baseline__/verify-providers.mjs deep-equal against snapshot). No runtime fields added; consumers unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -0,0 +1,536 @@
|
||||
{
|
||||
"claude": {
|
||||
"baseUrl": "https://api.anthropic.com/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"
|
||||
},
|
||||
"clientId": "9d1c250a-e61b-44d9-88ed-5944d1962f5e",
|
||||
"tokenUrl": "https://api.anthropic.com/v1/oauth/token"
|
||||
},
|
||||
"gemini": {
|
||||
"baseUrl": "https://generativelanguage.googleapis.com/v1beta/models",
|
||||
"format": "gemini",
|
||||
"clientId": "681255809395-oo8ft2oprdrnp9e3aqf6av3hmdib135j.apps.googleusercontent.com",
|
||||
"clientSecret": "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"
|
||||
},
|
||||
"gemini-cli": {
|
||||
"baseUrl": "https://cloudcode-pa.googleapis.com/v1internal",
|
||||
"format": "gemini-cli",
|
||||
"clientId": "681255809395-oo8ft2oprdrnp9e3aqf6av3hmdib135j.apps.googleusercontent.com",
|
||||
"clientSecret": "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"
|
||||
},
|
||||
"codex": {
|
||||
"baseUrl": "https://chatgpt.com/backend-api/codex/responses",
|
||||
"format": "openai-responses",
|
||||
"headers": {
|
||||
"originator": "codex_cli_rs",
|
||||
"User-Agent": "codex_cli_rs/0.136.0"
|
||||
},
|
||||
"clientId": "app_EMoamEEZ73f0CkXaXp7hrann",
|
||||
"tokenUrl": "https://auth.openai.com/oauth/token"
|
||||
},
|
||||
"qwen": {
|
||||
"baseUrl": "https://portal.qwen.ai/v1/chat/completions",
|
||||
"format": "openai",
|
||||
"clientId": "f0304373b74a44d2b584a3fb70ca9e56",
|
||||
"tokenUrl": "https://chat.qwen.ai/api/v1/oauth2/token",
|
||||
"authUrl": "https://chat.qwen.ai/api/v1/oauth2/device/code"
|
||||
},
|
||||
"iflow": {
|
||||
"baseUrl": "https://apis.iflow.cn/v1/chat/completions",
|
||||
"format": "openai",
|
||||
"headers": {
|
||||
"User-Agent": "iFlow-Cli"
|
||||
},
|
||||
"clientId": "10009311001",
|
||||
"clientSecret": "4Z3YjXycVsQvyGF1etiNlIBB4RsqSDtW",
|
||||
"tokenUrl": "https://iflow.cn/oauth/token",
|
||||
"authUrl": "https://iflow.cn/oauth"
|
||||
},
|
||||
"qoder": {
|
||||
"baseUrl": "https://api3.qoder.sh/algo/api/v2/service/pro/sse/agent_chat_generation",
|
||||
"format": "openai",
|
||||
"headers": {},
|
||||
"timeoutMs": 120000,
|
||||
"stallTimeoutMs": 120000
|
||||
},
|
||||
"antigravity": {
|
||||
"baseUrls": [
|
||||
"https://daily-cloudcode-pa.googleapis.com",
|
||||
"https://daily-cloudcode-pa.sandbox.googleapis.com"
|
||||
],
|
||||
"format": "antigravity",
|
||||
"headers": {
|
||||
"User-Agent": "antigravity/1.107.0 darwin/arm64"
|
||||
},
|
||||
"clientId": "1071006060591-tmhssin2h21lcre235vtolojh4g403ep.apps.googleusercontent.com",
|
||||
"clientSecret": "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"
|
||||
},
|
||||
"openrouter": {
|
||||
"baseUrl": "https://openrouter.ai/api/v1/chat/completions",
|
||||
"format": "openai",
|
||||
"headers": {
|
||||
"HTTP-Referer": "https://endpoint-proxy.local",
|
||||
"X-Title": "Endpoint Proxy"
|
||||
}
|
||||
},
|
||||
"openai": {
|
||||
"baseUrl": "https://api.openai.com/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"vercel-ai-gateway": {
|
||||
"baseUrl": "https://ai-gateway.vercel.sh/v1/chat/completions",
|
||||
"format": "openai",
|
||||
"retry": {
|
||||
"429": 2
|
||||
}
|
||||
},
|
||||
"glm": {
|
||||
"baseUrl": "https://api.z.ai/api/anthropic/v1/messages",
|
||||
"format": "claude",
|
||||
"headers": {
|
||||
"Anthropic-Version": "2023-06-01",
|
||||
"Anthropic-Beta": "claude-code-20250219,interleaved-thinking-2025-05-14"
|
||||
}
|
||||
},
|
||||
"glm-cn": {
|
||||
"baseUrl": "https://open.bigmodel.cn/api/coding/paas/v4/chat/completions",
|
||||
"format": "openai",
|
||||
"headers": {}
|
||||
},
|
||||
"kimi": {
|
||||
"baseUrl": "https://api.kimi.com/coding/v1/messages",
|
||||
"format": "claude",
|
||||
"headers": {
|
||||
"Anthropic-Version": "2023-06-01",
|
||||
"Anthropic-Beta": "claude-code-20250219,interleaved-thinking-2025-05-14"
|
||||
}
|
||||
},
|
||||
"minimax": {
|
||||
"baseUrl": "https://api.minimax.io/anthropic/v1/messages",
|
||||
"format": "claude",
|
||||
"headers": {
|
||||
"Anthropic-Version": "2023-06-01",
|
||||
"Anthropic-Beta": "claude-code-20250219,interleaved-thinking-2025-05-14"
|
||||
}
|
||||
},
|
||||
"minimax-cn": {
|
||||
"baseUrl": "https://api.minimaxi.com/anthropic/v1/messages",
|
||||
"format": "claude",
|
||||
"headers": {
|
||||
"Anthropic-Version": "2023-06-01",
|
||||
"Anthropic-Beta": "claude-code-20250219,interleaved-thinking-2025-05-14"
|
||||
}
|
||||
},
|
||||
"alicode": {
|
||||
"baseUrl": "https://coding.dashscope.aliyuncs.com/v1/chat/completions",
|
||||
"format": "openai",
|
||||
"headers": {}
|
||||
},
|
||||
"alicode-intl": {
|
||||
"baseUrl": "https://coding-intl.dashscope.aliyuncs.com/v1/chat/completions",
|
||||
"format": "openai",
|
||||
"headers": {}
|
||||
},
|
||||
"volcengine-ark": {
|
||||
"baseUrl": "https://ark.cn-beijing.volces.com/api/coding/v3/chat/completions",
|
||||
"format": "openai",
|
||||
"headers": {}
|
||||
},
|
||||
"byteplus": {
|
||||
"baseUrl": "https://ark.ap-southeast.bytepluses.com/api/coding/v3/chat/completions",
|
||||
"format": "openai",
|
||||
"headers": {}
|
||||
},
|
||||
"github": {
|
||||
"baseUrl": "https://api.githubcopilot.com/chat/completions",
|
||||
"responsesUrl": "https://api.githubcopilot.com/responses",
|
||||
"format": "openai",
|
||||
"headers": {
|
||||
"copilot-integration-id": "vscode-chat",
|
||||
"editor-version": "vscode/1.110.0",
|
||||
"editor-plugin-version": "copilot-chat/0.38.0",
|
||||
"user-agent": "GitHubCopilotChat/0.38.0",
|
||||
"openai-intent": "conversation-panel",
|
||||
"x-github-api-version": "2025-04-01",
|
||||
"x-vscode-user-agent-library-version": "electron-fetch",
|
||||
"X-Initiator": "user",
|
||||
"Accept": "application/json",
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
"clientId": "Iv1.b507a08c87ecfe98"
|
||||
},
|
||||
"kiro": {
|
||||
"baseUrl": "https://runtime.us-east-1.kiro.dev/generateAssistantResponse",
|
||||
"baseUrls": [
|
||||
"https://runtime.us-east-1.kiro.dev/generateAssistantResponse",
|
||||
"https://codewhisperer.us-east-1.amazonaws.com/generateAssistantResponse",
|
||||
"https://q.us-east-1.amazonaws.com/generateAssistantResponse"
|
||||
],
|
||||
"format": "kiro",
|
||||
"retry": {
|
||||
"429": 0
|
||||
},
|
||||
"headers": {
|
||||
"Content-Type": "application/json",
|
||||
"Accept": "application/vnd.amazon.eventstream",
|
||||
"X-Amz-Target": "AmazonCodeWhispererStreamingService.GenerateAssistantResponse",
|
||||
"User-Agent": "AWS-SDK-JS/3.0.0 kiro-ide/1.0.0",
|
||||
"X-Amz-User-Agent": "aws-sdk-js/3.0.0 kiro-ide/1.0.0"
|
||||
},
|
||||
"tokenUrl": "https://prod.us-east-1.auth.desktop.kiro.dev/refreshToken",
|
||||
"authUrl": "https://prod.us-east-1.auth.desktop.kiro.dev"
|
||||
},
|
||||
"cursor": {
|
||||
"baseUrl": "https://api2.cursor.sh",
|
||||
"chatPath": "/aiserver.v1.ChatService/StreamUnifiedChatWithTools",
|
||||
"format": "cursor",
|
||||
"headers": {
|
||||
"connect-accept-encoding": "gzip",
|
||||
"connect-protocol-version": "1",
|
||||
"Content-Type": "application/connect+proto",
|
||||
"User-Agent": "connect-es/1.6.1"
|
||||
},
|
||||
"clientVersion": "3.1.0"
|
||||
},
|
||||
"kimi-coding": {
|
||||
"baseUrl": "https://api.kimi.com/coding/v1/messages",
|
||||
"format": "claude",
|
||||
"headers": {
|
||||
"Anthropic-Version": "2023-06-01",
|
||||
"Anthropic-Beta": "claude-code-20250219,interleaved-thinking-2025-05-14"
|
||||
},
|
||||
"clientId": "17e5f671-d194-4dfb-9706-5516cb48c098",
|
||||
"tokenUrl": "https://auth.kimi.com/api/oauth/token",
|
||||
"refreshUrl": "https://auth.kimi.com/api/oauth/token"
|
||||
},
|
||||
"kilocode": {
|
||||
"baseUrl": "https://api.kilo.ai/api/openrouter/chat/completions",
|
||||
"format": "openai",
|
||||
"headers": {}
|
||||
},
|
||||
"opencode": {
|
||||
"baseUrl": "https://opencode.ai",
|
||||
"format": "openai",
|
||||
"headers": {
|
||||
"x-opencode-client": "desktop"
|
||||
},
|
||||
"noAuth": true
|
||||
},
|
||||
"cline": {
|
||||
"baseUrl": "https://api.cline.bot/api/v1/chat/completions",
|
||||
"format": "openai",
|
||||
"headers": {
|
||||
"HTTP-Referer": "https://cline.bot",
|
||||
"X-Title": "Cline"
|
||||
},
|
||||
"tokenUrl": "https://api.cline.bot/api/v1/auth/token",
|
||||
"refreshUrl": "https://api.cline.bot/api/v1/auth/refresh"
|
||||
},
|
||||
"nvidia": {
|
||||
"baseUrl": "https://integrate.api.nvidia.com/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"anthropic": {
|
||||
"baseUrl": "https://api.anthropic.com/v1/messages",
|
||||
"format": "claude",
|
||||
"headers": {
|
||||
"Anthropic-Version": "2023-06-01",
|
||||
"Anthropic-Beta": "claude-code-20250219,interleaved-thinking-2025-05-14"
|
||||
}
|
||||
},
|
||||
"deepseek": {
|
||||
"baseUrl": "https://api.deepseek.com/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"commandcode": {
|
||||
"baseUrl": "https://api.commandcode.ai/alpha/generate",
|
||||
"format": "commandcode",
|
||||
"headers": {
|
||||
"x-command-code-version": "0.25.7",
|
||||
"x-cli-environment": "cli"
|
||||
}
|
||||
},
|
||||
"groq": {
|
||||
"baseUrl": "https://api.groq.com/openai/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"xai": {
|
||||
"baseUrl": "https://api.x.ai/v1/chat/completions",
|
||||
"responsesUrl": "https://api.x.ai/v1/responses",
|
||||
"format": "openai",
|
||||
"clientId": "b1a00492-073a-47ea-816f-4c329264a828",
|
||||
"tokenUrl": "https://auth.x.ai/oauth2/token",
|
||||
"refreshUrl": "https://auth.x.ai/oauth2/token"
|
||||
},
|
||||
"mistral": {
|
||||
"baseUrl": "https://api.mistral.ai/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"perplexity": {
|
||||
"baseUrl": "https://api.perplexity.ai/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"together": {
|
||||
"baseUrl": "https://api.together.xyz/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"fireworks": {
|
||||
"baseUrl": "https://api.fireworks.ai/inference/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"cerebras": {
|
||||
"baseUrl": "https://api.cerebras.ai/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"cohere": {
|
||||
"baseUrl": "https://api.cohere.ai/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"nebius": {
|
||||
"baseUrl": "https://api.studio.nebius.ai/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"siliconflow": {
|
||||
"baseUrl": "https://api.siliconflow.com/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"hyperbolic": {
|
||||
"baseUrl": "https://api.hyperbolic.xyz/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"deepgram": {
|
||||
"baseUrl": "https://api.deepgram.com/v1/listen",
|
||||
"format": "openai"
|
||||
},
|
||||
"assemblyai": {
|
||||
"baseUrl": "https://api.assemblyai.com/v1/audio/transcriptions",
|
||||
"format": "openai"
|
||||
},
|
||||
"nanobanana": {
|
||||
"baseUrl": "https://api.nanobananaapi.ai/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"chutes": {
|
||||
"baseUrl": "https://llm.chutes.ai/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"ollama": {
|
||||
"baseUrl": "https://ollama.com/api/chat",
|
||||
"format": "ollama"
|
||||
},
|
||||
"ollama-local": {
|
||||
"baseUrl": "http://localhost:11434/api/chat",
|
||||
"format": "ollama"
|
||||
},
|
||||
"vertex": {
|
||||
"baseUrl": "https://aiplatform.googleapis.com",
|
||||
"format": "vertex"
|
||||
},
|
||||
"vertex-partner": {
|
||||
"baseUrl": "https://aiplatform.googleapis.com",
|
||||
"format": "openai"
|
||||
},
|
||||
"gitlab": {
|
||||
"baseUrl": "https://gitlab.com/api/v4/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"codebuddy": {
|
||||
"baseUrl": "https://copilot.tencent.com/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"opencode-go": {
|
||||
"baseUrl": "https://opencode.ai/zen/go/v1/chat/completions",
|
||||
"format": "openai",
|
||||
"headers": {}
|
||||
},
|
||||
"grok-web": {
|
||||
"baseUrl": "https://grok.com/rest/app-chat/conversations/new",
|
||||
"format": "grok-web",
|
||||
"authType": "cookie"
|
||||
},
|
||||
"perplexity-web": {
|
||||
"baseUrl": "https://www.perplexity.ai/rest/sse/perplexity_ask",
|
||||
"format": "perplexity-web",
|
||||
"authType": "cookie"
|
||||
},
|
||||
"azure": {
|
||||
"baseUrl": "",
|
||||
"format": "openai",
|
||||
"headers": {}
|
||||
},
|
||||
"cloudflare-ai": {
|
||||
"baseUrl": "https://api.cloudflare.com/client/v4/accounts/{accountId}/ai/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"xiaomi-mimo": {
|
||||
"baseUrl": "https://api.xiaomimimo.com/v1/chat/completions",
|
||||
"format": "openai"
|
||||
},
|
||||
"mimo-free": {
|
||||
"baseUrl": "https://api.xiaomimimo.com/api/free-ai/openai/chat",
|
||||
"format": "openai",
|
||||
"noAuth": true
|
||||
},
|
||||
"mmf": {
|
||||
"baseUrl": "https://api.xiaomimimo.com/api/free-ai/openai/chat",
|
||||
"format": "openai",
|
||||
"noAuth": true
|
||||
},
|
||||
"xiaomi-tokenplan": {
|
||||
"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"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// Snapshot current PROVIDERS output to JSON (run on OLD code before refactor).
|
||||
// Usage: node tests/__baseline__/snapshot-providers.mjs
|
||||
import { writeFileSync } from "node:fs";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { dirname, join } from "node:path";
|
||||
import { PROVIDERS } from "../../open-sse/config/providers.js";
|
||||
|
||||
const here = dirname(fileURLToPath(import.meta.url));
|
||||
const out = join(here, "providers-baseline.json");
|
||||
writeFileSync(out, JSON.stringify(PROVIDERS, null, 2));
|
||||
console.log(`Snapshot ${Object.keys(PROVIDERS).length} providers → ${out}`);
|
||||
@@ -0,0 +1,37 @@
|
||||
// Verify refactored PROVIDERS is byte-for-byte equal to baseline JSON.
|
||||
// Exit 1 + print precise per-provider/per-field diff on mismatch.
|
||||
import { readFileSync } from "node:fs";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { dirname, join } from "node:path";
|
||||
import { PROVIDERS } from "../../open-sse/config/providers.js";
|
||||
|
||||
const here = dirname(fileURLToPath(import.meta.url));
|
||||
const baseline = JSON.parse(readFileSync(join(here, "providers-baseline.json"), "utf8"));
|
||||
|
||||
// Normalize via JSON roundtrip so function/undefined are dropped identically.
|
||||
const current = JSON.parse(JSON.stringify(PROVIDERS));
|
||||
|
||||
const diffs = [];
|
||||
const allIds = new Set([...Object.keys(baseline), ...Object.keys(current)]);
|
||||
for (const id of allIds) {
|
||||
const a = baseline[id];
|
||||
const b = current[id];
|
||||
if (a === undefined) { diffs.push(`+ provider added: ${id}`); continue; }
|
||||
if (b === undefined) { diffs.push(`- provider removed: ${id}`); continue; }
|
||||
const sa = JSON.stringify(a);
|
||||
const sb = JSON.stringify(b);
|
||||
if (sa === sb) continue;
|
||||
const keys = new Set([...Object.keys(a), ...Object.keys(b)]);
|
||||
for (const k of keys) {
|
||||
const va = JSON.stringify(a[k]);
|
||||
const vb = JSON.stringify(b[k]);
|
||||
if (va !== vb) diffs.push(`~ ${id}.${k}: ${va} -> ${vb}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (diffs.length) {
|
||||
console.error(`❌ PROVIDERS mismatch (${diffs.length} field diffs):`);
|
||||
for (const d of diffs) console.error(" " + d);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log(`✅ PROVIDERS byte-for-byte equal (${Object.keys(current).length} providers).`);
|
||||
Reference in New Issue
Block a user