wyxrouter 0.4.71
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/CHANGELOG.md +222 -0
- package/LICENSE +21 -0
- package/README.md +96 -0
- package/README.zh-CN.md +1311 -0
- package/assets/pixel-router-2d.png +0 -0
- package/cli/LICENSE +42 -0
- package/cli/README.md +125 -0
- package/cli/app/package.json +58 -0
- package/cli/cli.js +806 -0
- package/cli/package.json +48 -0
- package/i18n/README.ja-JP.md +1209 -0
- package/i18n/README.ru.md +1311 -0
- package/i18n/README.vi.md +1310 -0
- package/i18n/README.zh-CN.md +1306 -0
- package/images/9router.png +0 -0
- package/jsconfig.json +12 -0
- package/next.config.mjs +71 -0
- package/open-sse/config/appConstants.js +203 -0
- package/open-sse/config/codexInstructions.js +119 -0
- package/open-sse/config/constants.js +4 -0
- package/open-sse/config/defaultThinkingSignature.js +12 -0
- package/open-sse/config/errorConfig.js +85 -0
- package/open-sse/config/googleTtsLanguages.js +62 -0
- package/open-sse/config/kiroConstants.js +322 -0
- package/open-sse/config/models.js +13 -0
- package/open-sse/config/ollamaModels.js +19 -0
- package/open-sse/config/providerModels.js +944 -0
- package/open-sse/config/providers.js +458 -0
- package/open-sse/config/runtimeConfig.js +72 -0
- package/open-sse/config/ttsModels.js +129 -0
- package/open-sse/executors/antigravity.js +504 -0
- package/open-sse/executors/azure.js +57 -0
- package/open-sse/executors/base.js +185 -0
- package/open-sse/executors/codex.js +469 -0
- package/open-sse/executors/commandcode.js +88 -0
- package/open-sse/executors/cursor.js +795 -0
- package/open-sse/executors/default.js +497 -0
- package/open-sse/executors/gemini-cli.js +89 -0
- package/open-sse/executors/github.js +379 -0
- package/open-sse/executors/grok-web.js +345 -0
- package/open-sse/executors/iflow.js +108 -0
- package/open-sse/executors/index.js +75 -0
- package/open-sse/executors/kiro.js +508 -0
- package/open-sse/executors/ollama-local.js +14 -0
- package/open-sse/executors/opencode-go.js +41 -0
- package/open-sse/executors/opencode.js +32 -0
- package/open-sse/executors/perplexity-web.js +507 -0
- package/open-sse/executors/qoder.js +450 -0
- package/open-sse/executors/qwen.js +129 -0
- package/open-sse/executors/vertex.js +131 -0
- package/open-sse/executors/xiaomi-tokenplan.js +19 -0
- package/open-sse/handlers/chatCore/nonStreamingHandler.js +230 -0
- package/open-sse/handlers/chatCore/requestDetail.js +102 -0
- package/open-sse/handlers/chatCore/sseToJsonHandler.js +231 -0
- package/open-sse/handlers/chatCore/streamingHandler.js +103 -0
- package/open-sse/handlers/chatCore.js +287 -0
- package/open-sse/handlers/embeddingProviders/_base.js +4 -0
- package/open-sse/handlers/embeddingProviders/gemini.js +54 -0
- package/open-sse/handlers/embeddingProviders/index.js +23 -0
- package/open-sse/handlers/embeddingProviders/openai.js +39 -0
- package/open-sse/handlers/embeddingProviders/openaiCompatNode.js +13 -0
- package/open-sse/handlers/embeddingsCore.js +126 -0
- package/open-sse/handlers/fetch/index.js +237 -0
- package/open-sse/handlers/imageGenerationCore.js +189 -0
- package/open-sse/handlers/imageProviders/_base.js +31 -0
- package/open-sse/handlers/imageProviders/blackForestLabs.js +43 -0
- package/open-sse/handlers/imageProviders/cloudflareAi.js +178 -0
- package/open-sse/handlers/imageProviders/codex.js +198 -0
- package/open-sse/handlers/imageProviders/comfyui.js +8 -0
- package/open-sse/handlers/imageProviders/falAi.js +41 -0
- package/open-sse/handlers/imageProviders/gemini.js +25 -0
- package/open-sse/handlers/imageProviders/huggingface.js +22 -0
- package/open-sse/handlers/imageProviders/index.js +40 -0
- package/open-sse/handlers/imageProviders/nanobanana.js +58 -0
- package/open-sse/handlers/imageProviders/openai.js +40 -0
- package/open-sse/handlers/imageProviders/runwayml.js +47 -0
- package/open-sse/handlers/imageProviders/sdwebui.js +17 -0
- package/open-sse/handlers/imageProviders/stabilityAi.js +34 -0
- package/open-sse/handlers/responsesHandler.js +103 -0
- package/open-sse/handlers/search/callers.js +371 -0
- package/open-sse/handlers/search/chatSearch.js +409 -0
- package/open-sse/handlers/search/index.js +201 -0
- package/open-sse/handlers/search/normalizers.js +223 -0
- package/open-sse/handlers/sttCore.js +194 -0
- package/open-sse/handlers/ttsCore.js +74 -0
- package/open-sse/handlers/ttsProviders/_base.js +39 -0
- package/open-sse/handlers/ttsProviders/edgeTts.js +89 -0
- package/open-sse/handlers/ttsProviders/elevenlabs.js +48 -0
- package/open-sse/handlers/ttsProviders/gemini.js +117 -0
- package/open-sse/handlers/ttsProviders/genericFormats.js +169 -0
- package/open-sse/handlers/ttsProviders/googleTts.js +54 -0
- package/open-sse/handlers/ttsProviders/index.js +50 -0
- package/open-sse/handlers/ttsProviders/localDevice.js +87 -0
- package/open-sse/handlers/ttsProviders/minimax.js +59 -0
- package/open-sse/handlers/ttsProviders/openai.js +30 -0
- package/open-sse/handlers/ttsProviders/openrouter.js +70 -0
- package/open-sse/index.js +82 -0
- package/open-sse/rtk/applyFilter.js +15 -0
- package/open-sse/rtk/autodetect.js +111 -0
- package/open-sse/rtk/caveman.js +100 -0
- package/open-sse/rtk/cavemanPrompts.js +78 -0
- package/open-sse/rtk/constants.js +55 -0
- package/open-sse/rtk/filters/buildOutput.js +127 -0
- package/open-sse/rtk/filters/dedupLog.js +44 -0
- package/open-sse/rtk/filters/find.js +49 -0
- package/open-sse/rtk/filters/gitDiff.js +92 -0
- package/open-sse/rtk/filters/gitStatus.js +117 -0
- package/open-sse/rtk/filters/grep.js +48 -0
- package/open-sse/rtk/filters/ls.js +79 -0
- package/open-sse/rtk/filters/readNumbered.js +27 -0
- package/open-sse/rtk/filters/searchList.js +52 -0
- package/open-sse/rtk/filters/smartTruncate.js +15 -0
- package/open-sse/rtk/filters/tree.js +32 -0
- package/open-sse/rtk/index.js +155 -0
- package/open-sse/rtk/registry.js +38 -0
- package/open-sse/services/accountFallback.js +238 -0
- package/open-sse/services/combo.js +198 -0
- package/open-sse/services/compact.js +71 -0
- package/open-sse/services/kiroModels.js +332 -0
- package/open-sse/services/model.js +261 -0
- package/open-sse/services/oauthCredentialManager.js +151 -0
- package/open-sse/services/projectId.js +306 -0
- package/open-sse/services/provider.js +356 -0
- package/open-sse/services/qoderModels.js +214 -0
- package/open-sse/services/tokenRefresh.js +939 -0
- package/open-sse/services/usage.js +1496 -0
- package/open-sse/transformer/responsesTransformer.js +439 -0
- package/open-sse/transformer/streamToJsonConverter.js +103 -0
- package/open-sse/translator/formats.js +36 -0
- package/open-sse/translator/helpers/claudeHelper.js +216 -0
- package/open-sse/translator/helpers/geminiHelper.js +372 -0
- package/open-sse/translator/helpers/imageHelper.js +34 -0
- package/open-sse/translator/helpers/maxTokensHelper.js +27 -0
- package/open-sse/translator/helpers/openaiHelper.js +130 -0
- package/open-sse/translator/helpers/responsesApiHelper.js +139 -0
- package/open-sse/translator/helpers/toolCallHelper.js +148 -0
- package/open-sse/translator/index.js +251 -0
- package/open-sse/translator/request/antigravity-to-openai.js +229 -0
- package/open-sse/translator/request/claude-to-openai.js +232 -0
- package/open-sse/translator/request/gemini-to-openai.js +147 -0
- package/open-sse/translator/request/openai-responses.js +318 -0
- package/open-sse/translator/request/openai-to-claude.js +401 -0
- package/open-sse/translator/request/openai-to-commandcode.js +170 -0
- package/open-sse/translator/request/openai-to-cursor.js +183 -0
- package/open-sse/translator/request/openai-to-gemini.js +470 -0
- package/open-sse/translator/request/openai-to-kiro.js +629 -0
- package/open-sse/translator/request/openai-to-kiro.old.js +278 -0
- package/open-sse/translator/request/openai-to-ollama.js +192 -0
- package/open-sse/translator/request/openai-to-vertex.js +42 -0
- package/open-sse/translator/response/claude-to-openai.js +206 -0
- package/open-sse/translator/response/commandcode-to-openai.js +197 -0
- package/open-sse/translator/response/cursor-to-openai.js +30 -0
- package/open-sse/translator/response/gemini-to-openai.js +245 -0
- package/open-sse/translator/response/kiro-to-openai.js +195 -0
- package/open-sse/translator/response/ollama-to-openai.js +152 -0
- package/open-sse/translator/response/openai-responses.js +590 -0
- package/open-sse/translator/response/openai-to-antigravity.js +122 -0
- package/open-sse/translator/response/openai-to-claude.js +266 -0
- package/open-sse/utils/bypassHandler.js +298 -0
- package/open-sse/utils/claudeCloaking.js +155 -0
- package/open-sse/utils/claudeHeaderCache.js +70 -0
- package/open-sse/utils/clientDetector.js +63 -0
- package/open-sse/utils/cursorChecksum.js +149 -0
- package/open-sse/utils/cursorProtobuf.js +904 -0
- package/open-sse/utils/debugLog.js +14 -0
- package/open-sse/utils/error.js +147 -0
- package/open-sse/utils/ollamaTransform.js +85 -0
- package/open-sse/utils/proxyFetch.js +368 -0
- package/open-sse/utils/reasoningContentInjector.js +79 -0
- package/open-sse/utils/requestLogger.js +260 -0
- package/open-sse/utils/responsesStreamHelpers.js +49 -0
- package/open-sse/utils/sessionManager.js +82 -0
- package/open-sse/utils/stream.js +462 -0
- package/open-sse/utils/streamHandler.js +250 -0
- package/open-sse/utils/streamHelpers.js +122 -0
- package/open-sse/utils/toolDeduper.js +49 -0
- package/open-sse/utils/usageTracking.js +347 -0
- package/package.json +100 -0
- package/postcss.config.mjs +12 -0
- package/public/favicon.svg +11 -0
- package/public/file.svg +1 -0
- package/public/globe.svg +1 -0
- package/public/i18n/literals/ar.json +195 -0
- package/public/i18n/literals/bn.json +195 -0
- package/public/i18n/literals/cs.json +195 -0
- package/public/i18n/literals/da.json +195 -0
- package/public/i18n/literals/de.json +195 -0
- package/public/i18n/literals/el.json +195 -0
- package/public/i18n/literals/es.json +195 -0
- package/public/i18n/literals/fi.json +195 -0
- package/public/i18n/literals/fr.json +195 -0
- package/public/i18n/literals/he.json +195 -0
- package/public/i18n/literals/hi.json +195 -0
- package/public/i18n/literals/hu.json +195 -0
- package/public/i18n/literals/id.json +195 -0
- package/public/i18n/literals/it.json +195 -0
- package/public/i18n/literals/ja.json +195 -0
- package/public/i18n/literals/ko.json +195 -0
- package/public/i18n/literals/nl.json +195 -0
- package/public/i18n/literals/no.json +195 -0
- package/public/i18n/literals/pl.json +195 -0
- package/public/i18n/literals/pt-BR.json +195 -0
- package/public/i18n/literals/pt-PT.json +195 -0
- package/public/i18n/literals/ro.json +195 -0
- package/public/i18n/literals/ru.json +195 -0
- package/public/i18n/literals/sv.json +195 -0
- package/public/i18n/literals/th.json +195 -0
- package/public/i18n/literals/tl.json +195 -0
- package/public/i18n/literals/tr.json +195 -0
- package/public/i18n/literals/uk.json +195 -0
- package/public/i18n/literals/ur.json +195 -0
- package/public/i18n/literals/vi.json +195 -0
- package/public/i18n/literals/zh-CN.json +772 -0
- package/public/i18n/literals/zh-TW.json +195 -0
- package/public/icons/discord.svg +4 -0
- package/public/icons/icon-192.svg +4 -0
- package/public/icons/icon-512.svg +4 -0
- package/public/next.svg +1 -0
- package/public/providers/alicode-intl.png +0 -0
- package/public/providers/alicode.png +0 -0
- package/public/providers/amp.png +0 -0
- package/public/providers/anthropic-m.png +0 -0
- package/public/providers/anthropic.png +0 -0
- package/public/providers/antigravity.png +0 -0
- package/public/providers/assemblyai.png +0 -0
- package/public/providers/aws-polly.png +0 -0
- package/public/providers/azure.png +0 -0
- package/public/providers/black-forest-labs.png +0 -0
- package/public/providers/blackbox.png +0 -0
- package/public/providers/brave-search.png +0 -0
- package/public/providers/byteplus.png +0 -0
- package/public/providers/cartesia.png +0 -0
- package/public/providers/cerebras.png +0 -0
- package/public/providers/chutes.png +0 -0
- package/public/providers/claude.png +0 -0
- package/public/providers/cline.png +0 -0
- package/public/providers/cloudflare-ai.png +0 -0
- package/public/providers/codebuddy.svg +37 -0
- package/public/providers/codex.png +0 -0
- package/public/providers/cohere.png +0 -0
- package/public/providers/comfyui.png +0 -0
- package/public/providers/commandcode.png +0 -0
- package/public/providers/continue.png +0 -0
- package/public/providers/copilot.png +0 -0
- package/public/providers/coqui.png +0 -0
- package/public/providers/cursor.png +0 -0
- package/public/providers/deepgram.png +0 -0
- package/public/providers/deepseek-tui.png +0 -0
- package/public/providers/deepseek.png +0 -0
- package/public/providers/droid.png +0 -0
- package/public/providers/edge-tts.png +0 -0
- package/public/providers/elevenlabs.png +0 -0
- package/public/providers/exa.png +0 -0
- package/public/providers/fal-ai.png +0 -0
- package/public/providers/firecrawl.png +0 -0
- package/public/providers/fireworks.png +0 -0
- package/public/providers/gemini-cli.png +0 -0
- package/public/providers/gemini.png +0 -0
- package/public/providers/github.png +0 -0
- package/public/providers/glm-cn.png +0 -0
- package/public/providers/glm.png +0 -0
- package/public/providers/google-pse.png +0 -0
- package/public/providers/google-tts.png +0 -0
- package/public/providers/grok-web.png +0 -0
- package/public/providers/groq.png +0 -0
- package/public/providers/hermes.png +0 -0
- package/public/providers/huggingface.png +0 -0
- package/public/providers/hyperbolic.png +0 -0
- package/public/providers/iflow.png +0 -0
- package/public/providers/inworld.png +0 -0
- package/public/providers/jcode.png +0 -0
- package/public/providers/jina-ai.png +0 -0
- package/public/providers/jina-reader.png +0 -0
- package/public/providers/kilocode.png +0 -0
- package/public/providers/kimi-coding.png +0 -0
- package/public/providers/kimi.png +0 -0
- package/public/providers/kiro.png +0 -0
- package/public/providers/linkup.png +0 -0
- package/public/providers/local-device.png +0 -0
- package/public/providers/minimax-cn.png +0 -0
- package/public/providers/minimax.png +0 -0
- package/public/providers/mistral.png +0 -0
- package/public/providers/nanobanana.png +0 -0
- package/public/providers/nebius.png +0 -0
- package/public/providers/nvidia.png +0 -0
- package/public/providers/oai-cc.png +0 -0
- package/public/providers/oai-r.png +0 -0
- package/public/providers/ollama-local.png +0 -0
- package/public/providers/ollama.png +0 -0
- package/public/providers/openai.png +0 -0
- package/public/providers/openclaw.png +0 -0
- package/public/providers/opencode-go.png +0 -0
- package/public/providers/opencode.png +0 -0
- package/public/providers/openrouter.png +0 -0
- package/public/providers/perplexity-web.png +0 -0
- package/public/providers/perplexity.png +0 -0
- package/public/providers/playht.png +0 -0
- package/public/providers/qoder.png +0 -0
- package/public/providers/qwen.png +0 -0
- package/public/providers/recraft.png +0 -0
- package/public/providers/roo.png +0 -0
- package/public/providers/runwayml.png +0 -0
- package/public/providers/sdwebui.png +0 -0
- package/public/providers/searchapi.png +0 -0
- package/public/providers/searxng.png +0 -0
- package/public/providers/serper.png +0 -0
- package/public/providers/siliconflow.png +0 -0
- package/public/providers/stability-ai.png +0 -0
- package/public/providers/tavily.png +0 -0
- package/public/providers/together.png +0 -0
- package/public/providers/topaz.png +0 -0
- package/public/providers/tortoise.png +0 -0
- package/public/providers/vertex-partner.png +0 -0
- package/public/providers/vertex.png +0 -0
- package/public/providers/volcengine-ark.png +0 -0
- package/public/providers/voyage-ai.png +0 -0
- package/public/providers/xai.png +0 -0
- package/public/providers/xiaomi-mimo.png +0 -0
- package/public/providers/xiaomi-tokenplan.png +0 -0
- package/public/providers/youcom.png +0 -0
- package/public/sw.js +22 -0
- package/public/vercel.svg +1 -0
- package/public/window.svg +1 -0
- package/scripts/compact-request-details.mjs +71 -0
- package/scripts/import-codex-gptjson.mjs +342 -0
- package/scripts/start-standalone.mjs +25 -0
- package/scripts/translate-readme.js +201 -0
- package/src/app/(dashboard)/dashboard/automation/page.js +294 -0
- package/src/app/(dashboard)/dashboard/basic-chat/BasicChatPageClient.js +967 -0
- package/src/app/(dashboard)/dashboard/basic-chat/page.js +5 -0
- package/src/app/(dashboard)/dashboard/cli-tools/CLIToolsPageClient.js +66 -0
- package/src/app/(dashboard)/dashboard/cli-tools/[toolId]/ToolDetailClient.js +173 -0
- package/src/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +11 -0
- package/src/app/(dashboard)/dashboard/cli-tools/components/AntigravityToolCard.js +481 -0
- package/src/app/(dashboard)/dashboard/cli-tools/components/ApiKeySelect.js +66 -0
- package/src/app/(dashboard)/dashboard/cli-tools/components/BaseUrlSelect.js +174 -0
- package/src/app/(dashboard)/dashboard/cli-tools/components/ClaudeToolCard.js +390 -0
- package/src/app/(dashboard)/dashboard/cli-tools/components/ClineToolCard.js +301 -0
- package/src/app/(dashboard)/dashboard/cli-tools/components/CodexToolCard.js +458 -0
- package/src/app/(dashboard)/dashboard/cli-tools/components/CopilotToolCard.js +323 -0
- package/src/app/(dashboard)/dashboard/cli-tools/components/CoworkToolCard.js +640 -0
- package/src/app/(dashboard)/dashboard/cli-tools/components/DeepSeekTuiToolCard.js +338 -0
- package/src/app/(dashboard)/dashboard/cli-tools/components/DefaultToolCard.js +271 -0
- package/src/app/(dashboard)/dashboard/cli-tools/components/DroidToolCard.js +410 -0
- package/src/app/(dashboard)/dashboard/cli-tools/components/EndpointPresetControl.js +128 -0
- package/src/app/(dashboard)/dashboard/cli-tools/components/HermesToolCard.js +317 -0
- package/src/app/(dashboard)/dashboard/cli-tools/components/JcodeToolCard.js +380 -0
- package/src/app/(dashboard)/dashboard/cli-tools/components/KiloToolCard.js +275 -0
- package/src/app/(dashboard)/dashboard/cli-tools/components/MitmLinkCard.js +40 -0
- package/src/app/(dashboard)/dashboard/cli-tools/components/MitmServerCard.js +329 -0
- package/src/app/(dashboard)/dashboard/cli-tools/components/MitmToolCard.js +318 -0
- package/src/app/(dashboard)/dashboard/cli-tools/components/OpenClawToolCard.js +388 -0
- package/src/app/(dashboard)/dashboard/cli-tools/components/OpenCodeToolCard.js +500 -0
- package/src/app/(dashboard)/dashboard/cli-tools/components/ToolSummaryCard.js +39 -0
- package/src/app/(dashboard)/dashboard/cli-tools/components/cliEndpointMatch.js +13 -0
- package/src/app/(dashboard)/dashboard/cli-tools/components/index.js +19 -0
- package/src/app/(dashboard)/dashboard/cli-tools/page.js +7 -0
- package/src/app/(dashboard)/dashboard/combos/page.js +612 -0
- package/src/app/(dashboard)/dashboard/console-log/ConsoleLogClient.js +91 -0
- package/src/app/(dashboard)/dashboard/console-log/page.js +8 -0
- package/src/app/(dashboard)/dashboard/endpoint/EndpointPageClient.js +1555 -0
- package/src/app/(dashboard)/dashboard/endpoint/page.js +7 -0
- package/src/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +1903 -0
- package/src/app/(dashboard)/dashboard/media-providers/[kind]/page.js +289 -0
- package/src/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +410 -0
- package/src/app/(dashboard)/dashboard/media-providers/web/page.js +209 -0
- package/src/app/(dashboard)/dashboard/mitm/MitmPageClient.js +117 -0
- package/src/app/(dashboard)/dashboard/mitm/page.js +5 -0
- package/src/app/(dashboard)/dashboard/page.js +7 -0
- package/src/app/(dashboard)/dashboard/profile/page.js +1140 -0
- package/src/app/(dashboard)/dashboard/providers/[id]/AddApiKeyModal.js +389 -0
- package/src/app/(dashboard)/dashboard/providers/[id]/AddCustomModelModal.js +125 -0
- package/src/app/(dashboard)/dashboard/providers/[id]/CompatibleModelsSection.js +250 -0
- package/src/app/(dashboard)/dashboard/providers/[id]/ConnectionRow.js +299 -0
- package/src/app/(dashboard)/dashboard/providers/[id]/CooldownTimer.js +42 -0
- package/src/app/(dashboard)/dashboard/providers/[id]/EditCompatibleNodeModal.js +161 -0
- package/src/app/(dashboard)/dashboard/providers/[id]/ModelRow.js +95 -0
- package/src/app/(dashboard)/dashboard/providers/[id]/PassthroughModelsSection.js +183 -0
- package/src/app/(dashboard)/dashboard/providers/[id]/page.js +2053 -0
- package/src/app/(dashboard)/dashboard/providers/[id]/page.new.js +1724 -0
- package/src/app/(dashboard)/dashboard/providers/components/ConnectionsCard.js +497 -0
- package/src/app/(dashboard)/dashboard/providers/components/ModelAvailabilityBadge.js +185 -0
- package/src/app/(dashboard)/dashboard/providers/components/ModelsCard.js +294 -0
- package/src/app/(dashboard)/dashboard/providers/new/page.js +220 -0
- package/src/app/(dashboard)/dashboard/providers/page.js +1365 -0
- package/src/app/(dashboard)/dashboard/proxy-pools/page.js +1092 -0
- package/src/app/(dashboard)/dashboard/quota/page.js +11 -0
- package/src/app/(dashboard)/dashboard/skills/page.js +112 -0
- package/src/app/(dashboard)/dashboard/translator/page.js +303 -0
- package/src/app/(dashboard)/dashboard/usage/components/OverviewCards.js +35 -0
- package/src/app/(dashboard)/dashboard/usage/components/ProviderLimits/ProviderLimitCard.js +185 -0
- package/src/app/(dashboard)/dashboard/usage/components/ProviderLimits/QuotaProgressBar.js +127 -0
- package/src/app/(dashboard)/dashboard/usage/components/ProviderLimits/QuotaTable.js +259 -0
- package/src/app/(dashboard)/dashboard/usage/components/ProviderLimits/index.js +1394 -0
- package/src/app/(dashboard)/dashboard/usage/components/ProviderLimits/utils.js +244 -0
- package/src/app/(dashboard)/dashboard/usage/components/ProviderTopology.js +327 -0
- package/src/app/(dashboard)/dashboard/usage/components/RequestDetailsTab.js +433 -0
- package/src/app/(dashboard)/dashboard/usage/components/UsageChart.js +141 -0
- package/src/app/(dashboard)/dashboard/usage/components/UsageTable.js +247 -0
- package/src/app/(dashboard)/dashboard/usage/page.js +75 -0
- package/src/app/(dashboard)/layout.js +6 -0
- package/src/app/api/auth/login/route.js +76 -0
- package/src/app/api/auth/logout/route.js +12 -0
- package/src/app/api/auth/oidc/callback/route.js +87 -0
- package/src/app/api/auth/oidc/start/route.js +52 -0
- package/src/app/api/auth/oidc/test/route.js +84 -0
- package/src/app/api/auth/status/route.js +45 -0
- package/src/app/api/cli-tools/all-statuses/route.js +46 -0
- package/src/app/api/cli-tools/antigravity-mitm/alias/route.js +53 -0
- package/src/app/api/cli-tools/antigravity-mitm/route.js +202 -0
- package/src/app/api/cli-tools/claude-settings/route.js +203 -0
- package/src/app/api/cli-tools/cline-settings/route.js +133 -0
- package/src/app/api/cli-tools/codex-gateway/accounts/route.js +16 -0
- package/src/app/api/cli-tools/codex-settings/route.js +239 -0
- package/src/app/api/cli-tools/copilot-settings/route.js +148 -0
- package/src/app/api/cli-tools/cowork-mcp-registry/route.js +77 -0
- package/src/app/api/cli-tools/cowork-mcp-tools/route.js +95 -0
- package/src/app/api/cli-tools/cowork-settings/route.js +412 -0
- package/src/app/api/cli-tools/deepseek-tui-settings/route.js +164 -0
- package/src/app/api/cli-tools/droid-settings/route.js +213 -0
- package/src/app/api/cli-tools/hermes-settings/route.js +175 -0
- package/src/app/api/cli-tools/jcode-settings/route.js +216 -0
- package/src/app/api/cli-tools/kilo-settings/route.js +131 -0
- package/src/app/api/cli-tools/openclaw-settings/route.js +292 -0
- package/src/app/api/cli-tools/opencode-settings/route.js +259 -0
- package/src/app/api/combos/[id]/route.js +81 -0
- package/src/app/api/combos/route.js +48 -0
- package/src/app/api/health/route.js +15 -0
- package/src/app/api/init/route.js +4 -0
- package/src/app/api/keys/[id]/route.js +58 -0
- package/src/app/api/keys/route.js +42 -0
- package/src/app/api/locale/route.js +30 -0
- package/src/app/api/mcp/[plugin]/message/route.js +21 -0
- package/src/app/api/mcp/[plugin]/sse/route.js +37 -0
- package/src/app/api/media-providers/tts/deepgram/voices/route.js +65 -0
- package/src/app/api/media-providers/tts/elevenlabs/voices/route.js +71 -0
- package/src/app/api/media-providers/tts/inworld/voices/route.js +61 -0
- package/src/app/api/media-providers/tts/minimax/voices/route.js +113 -0
- package/src/app/api/media-providers/tts/voices/route.js +99 -0
- package/src/app/api/models/alias/route.js +53 -0
- package/src/app/api/models/availability/route.js +103 -0
- package/src/app/api/models/custom/route.js +48 -0
- package/src/app/api/models/disabled/route.js +50 -0
- package/src/app/api/models/route.js +64 -0
- package/src/app/api/models/test/ping.js +191 -0
- package/src/app/api/models/test/route.js +14 -0
- package/src/app/api/oauth/[provider]/[action]/route.js +343 -0
- package/src/app/api/oauth/codebuddy/bulk-import/[jobId]/cancel/route.js +19 -0
- package/src/app/api/oauth/codebuddy/bulk-import/[jobId]/manual/[workerId]/route.js +30 -0
- package/src/app/api/oauth/codebuddy/bulk-import/[jobId]/route.js +23 -0
- package/src/app/api/oauth/codebuddy/bulk-import/latest/route.js +25 -0
- package/src/app/api/oauth/codebuddy/bulk-import/route.js +49 -0
- package/src/app/api/oauth/codebuddy/quota-cookie/route.js +133 -0
- package/src/app/api/oauth/codex/import-token/route.js +96 -0
- package/src/app/api/oauth/cursor/auto-import/route.js +258 -0
- package/src/app/api/oauth/cursor/import/route.js +100 -0
- package/src/app/api/oauth/gitlab/pat/route.js +62 -0
- package/src/app/api/oauth/iflow/cookie/route.js +137 -0
- package/src/app/api/oauth/kiro/auto-import/route.js +85 -0
- package/src/app/api/oauth/kiro/bulk-import/[jobId]/cancel/route.js +18 -0
- package/src/app/api/oauth/kiro/bulk-import/[jobId]/manual/[workerId]/route.js +29 -0
- package/src/app/api/oauth/kiro/bulk-import/[jobId]/route.js +22 -0
- package/src/app/api/oauth/kiro/bulk-import/latest/route.js +25 -0
- package/src/app/api/oauth/kiro/bulk-import/route.js +49 -0
- package/src/app/api/oauth/kiro/import/route.js +110 -0
- package/src/app/api/oauth/kiro/social-authorize/route.js +27 -0
- package/src/app/api/oauth/kiro/social-exchange/route.js +41 -0
- package/src/app/api/pricing/route.js +134 -0
- package/src/app/api/provider-nodes/[id]/route.js +101 -0
- package/src/app/api/provider-nodes/route.js +104 -0
- package/src/app/api/provider-nodes/validate/route.js +201 -0
- package/src/app/api/providers/[id]/models/route.js +526 -0
- package/src/app/api/providers/[id]/route.js +189 -0
- package/src/app/api/providers/[id]/test/route.js +23 -0
- package/src/app/api/providers/[id]/test/testUtils.js +714 -0
- package/src/app/api/providers/[id]/test-models/route.js +66 -0
- package/src/app/api/providers/client/route.js +126 -0
- package/src/app/api/providers/kilo/free-models/route.js +55 -0
- package/src/app/api/providers/route.js +206 -0
- package/src/app/api/providers/suggested-models/filters.js +20 -0
- package/src/app/api/providers/suggested-models/route.js +32 -0
- package/src/app/api/providers/test-batch/route.js +131 -0
- package/src/app/api/providers/validate/route.js +637 -0
- package/src/app/api/proxy-pools/[id]/route.js +123 -0
- package/src/app/api/proxy-pools/[id]/test/route.js +70 -0
- package/src/app/api/proxy-pools/cloudflare-deploy/route.js +145 -0
- package/src/app/api/proxy-pools/deno-deploy/route.js +175 -0
- package/src/app/api/proxy-pools/route.js +93 -0
- package/src/app/api/proxy-pools/vercel-deploy/route.js +142 -0
- package/src/app/api/settings/database/route.js +36 -0
- package/src/app/api/settings/proxy-test/route.js +23 -0
- package/src/app/api/settings/require-login/route.js +15 -0
- package/src/app/api/settings/route.js +100 -0
- package/src/app/api/shutdown/route.js +24 -0
- package/src/app/api/tags/route.js +18 -0
- package/src/app/api/translator/console-logs/route.js +24 -0
- package/src/app/api/translator/console-logs/stream/route.js +79 -0
- package/src/app/api/translator/load/route.js +45 -0
- package/src/app/api/translator/save/route.js +44 -0
- package/src/app/api/translator/send/route.js +94 -0
- package/src/app/api/translator/translate/route.js +90 -0
- package/src/app/api/tunnel/disable/route.js +12 -0
- package/src/app/api/tunnel/enable/route.js +16 -0
- package/src/app/api/tunnel/status/route.js +13 -0
- package/src/app/api/tunnel/tailscale-check/route.js +50 -0
- package/src/app/api/tunnel/tailscale-disable/route.js +12 -0
- package/src/app/api/tunnel/tailscale-enable/route.js +12 -0
- package/src/app/api/tunnel/tailscale-install/route.js +72 -0
- package/src/app/api/usage/[connectionId]/route.js +188 -0
- package/src/app/api/usage/chart/route.js +21 -0
- package/src/app/api/usage/history/route.js +12 -0
- package/src/app/api/usage/logs/route.js +12 -0
- package/src/app/api/usage/providers/route.js +42 -0
- package/src/app/api/usage/request-details/route.js +57 -0
- package/src/app/api/usage/request-logs/route.js +13 -0
- package/src/app/api/usage/stats/route.js +23 -0
- package/src/app/api/usage/stream/route.js +79 -0
- package/src/app/api/v1/api/chat/route.js +37 -0
- package/src/app/api/v1/audio/speech/route.js +16 -0
- package/src/app/api/v1/audio/transcriptions/route.js +19 -0
- package/src/app/api/v1/audio/voices/route.js +68 -0
- package/src/app/api/v1/chat/completions/route.js +35 -0
- package/src/app/api/v1/embeddings/route.js +21 -0
- package/src/app/api/v1/images/generations/route.js +16 -0
- package/src/app/api/v1/messages/count_tokens/route.js +52 -0
- package/src/app/api/v1/messages/route.js +36 -0
- package/src/app/api/v1/models/[kind]/route.js +55 -0
- package/src/app/api/v1/models/info/route.js +110 -0
- package/src/app/api/v1/models/route.js +451 -0
- package/src/app/api/v1/responses/compact/route.js +37 -0
- package/src/app/api/v1/responses/route.js +30 -0
- package/src/app/api/v1/route.js +1 -0
- package/src/app/api/v1/search/route.js +21 -0
- package/src/app/api/v1/web/fetch/route.js +21 -0
- package/src/app/api/v1beta/models/[...path]/route.js +328 -0
- package/src/app/api/v1beta/models/route.js +44 -0
- package/src/app/api/version/route.js +45 -0
- package/src/app/api/version/shutdown/route.js +15 -0
- package/src/app/api/version/update/route.js +21 -0
- package/src/app/callback/page.js +148 -0
- package/src/app/dashboard/settings/pricing/page.js +173 -0
- package/src/app/favicon.ico +0 -0
- package/src/app/globals.css +496 -0
- package/src/app/landing/components/AnimatedBackground.js +57 -0
- package/src/app/landing/components/Features.js +133 -0
- package/src/app/landing/components/FlowAnimation.js +175 -0
- package/src/app/landing/components/Footer.js +61 -0
- package/src/app/landing/components/GetStarted.js +97 -0
- package/src/app/landing/components/HeroSection.js +47 -0
- package/src/app/landing/components/HowItWorks.js +66 -0
- package/src/app/landing/components/Navigation.js +72 -0
- package/src/app/landing/page.js +106 -0
- package/src/app/layout.js +49 -0
- package/src/app/login/page.js +197 -0
- package/src/app/manifest.js +30 -0
- package/src/app/page.js +5 -0
- package/src/dashboardGuard.js +242 -0
- package/src/i18n/RuntimeI18nProvider.js +27 -0
- package/src/i18n/config.js +146 -0
- package/src/i18n/runtime.js +162 -0
- package/src/lib/appUpdater.js +200 -0
- package/src/lib/auth/dashboardSession.js +68 -0
- package/src/lib/auth/loginLimiter.js +52 -0
- package/src/lib/auth/oidc.js +234 -0
- package/src/lib/consoleLogBuffer.js +79 -0
- package/src/lib/dataDir.js +29 -0
- package/src/lib/db/adapters/betterSqliteAdapter.js +55 -0
- package/src/lib/db/adapters/bunSqliteAdapter.js +63 -0
- package/src/lib/db/adapters/nodeSqliteAdapter.js +84 -0
- package/src/lib/db/adapters/sqljsAdapter.js +115 -0
- package/src/lib/db/backup.js +35 -0
- package/src/lib/db/driver.js +85 -0
- package/src/lib/db/helpers/jsonCol.js +9 -0
- package/src/lib/db/helpers/kvStore.js +39 -0
- package/src/lib/db/helpers/metaStore.js +22 -0
- package/src/lib/db/index.js +171 -0
- package/src/lib/db/migrate.js +286 -0
- package/src/lib/db/migrations/001-initial.js +14 -0
- package/src/lib/db/migrations/index.js +10 -0
- package/src/lib/db/paths.js +18 -0
- package/src/lib/db/repos/aliasRepo.js +62 -0
- package/src/lib/db/repos/apiKeysRepo.js +75 -0
- package/src/lib/db/repos/combosRepo.js +73 -0
- package/src/lib/db/repos/connectionsRepo.js +226 -0
- package/src/lib/db/repos/disabledModelsRepo.js +56 -0
- package/src/lib/db/repos/nodesRepo.js +95 -0
- package/src/lib/db/repos/pricingRepo.js +108 -0
- package/src/lib/db/repos/proxyPoolsRepo.js +103 -0
- package/src/lib/db/repos/requestDetailsRepo.js +259 -0
- package/src/lib/db/repos/settingsRepo.js +104 -0
- package/src/lib/db/repos/usageRepo.js +731 -0
- package/src/lib/db/schema.js +157 -0
- package/src/lib/db/version.js +21 -0
- package/src/lib/disabledModelsDb.js +4 -0
- package/src/lib/localDb.js +21 -0
- package/src/lib/mcp/stdioSseBridge.js +198 -0
- package/src/lib/mitmAliasCache.js +46 -0
- package/src/lib/network/connectionProxy.js +160 -0
- package/src/lib/network/initOutboundProxy.js +25 -0
- package/src/lib/network/outboundProxy.js +68 -0
- package/src/lib/network/proxyTest.js +91 -0
- package/src/lib/oauth/constants/oauth.js +284 -0
- package/src/lib/oauth/constants/xai.js +61 -0
- package/src/lib/oauth/providers.js +1506 -0
- package/src/lib/oauth/services/antigravity.js +321 -0
- package/src/lib/oauth/services/claude.js +136 -0
- package/src/lib/oauth/services/codebuddyBulkImportManager.js +454 -0
- package/src/lib/oauth/services/codex.js +144 -0
- package/src/lib/oauth/services/cursor.js +179 -0
- package/src/lib/oauth/services/gemini.js +240 -0
- package/src/lib/oauth/services/github.js +225 -0
- package/src/lib/oauth/services/iflow.js +202 -0
- package/src/lib/oauth/services/index.js +17 -0
- package/src/lib/oauth/services/kiro.js +334 -0
- package/src/lib/oauth/services/kiroBulkImportManager.js +778 -0
- package/src/lib/oauth/services/kiroConnections.js +93 -0
- package/src/lib/oauth/services/kiroGoogleAutomation.js +1136 -0
- package/src/lib/oauth/services/oauth.js +157 -0
- package/src/lib/oauth/services/openai.js +123 -0
- package/src/lib/oauth/services/qoder.js +216 -0
- package/src/lib/oauth/services/qwen.js +170 -0
- package/src/lib/oauth/services/xai.js +238 -0
- package/src/lib/oauth/utils/banner.js +63 -0
- package/src/lib/oauth/utils/pkce.js +39 -0
- package/src/lib/oauth/utils/server.js +415 -0
- package/src/lib/oauth/utils/ui.js +48 -0
- package/src/lib/providerNormalization.js +45 -0
- package/src/lib/qoder/constants.js +64 -0
- package/src/lib/qoder/cosy.js +175 -0
- package/src/lib/qoder/encoding.js +55 -0
- package/src/lib/requestDetailsDb.js +4 -0
- package/src/lib/tunnel/cloudflare/cloudflared.js +449 -0
- package/src/lib/tunnel/cloudflare/config.js +9 -0
- package/src/lib/tunnel/cloudflare/healthCheck.js +29 -0
- package/src/lib/tunnel/cloudflare/manager.js +151 -0
- package/src/lib/tunnel/cloudflare/pid.js +23 -0
- package/src/lib/tunnel/index.js +48 -0
- package/src/lib/tunnel/shared/dnsResolver.js +17 -0
- package/src/lib/tunnel/shared/internetCheck.js +26 -0
- package/src/lib/tunnel/shared/state.js +41 -0
- package/src/lib/tunnel/shared/watchdogConfig.js +8 -0
- package/src/lib/tunnel/tailscale/config.js +7 -0
- package/src/lib/tunnel/tailscale/healthCheck.js +29 -0
- package/src/lib/tunnel/tailscale/manager.js +129 -0
- package/src/lib/tunnel/tailscale/tailscale.js +790 -0
- package/src/lib/updater/updater.js +235 -0
- package/src/lib/usage/fetcher.js +208 -0
- package/src/lib/usageDb.js +7 -0
- package/src/mitm/antigravityIdeVersion.js +50 -0
- package/src/mitm/cert/generate.js +32 -0
- package/src/mitm/cert/install.js +269 -0
- package/src/mitm/cert/rootCA.js +173 -0
- package/src/mitm/config.js +87 -0
- package/src/mitm/dbReader.js +22 -0
- package/src/mitm/dns/dnsConfig.js +266 -0
- package/src/mitm/handlers/antigravity.js +33 -0
- package/src/mitm/handlers/base.js +226 -0
- package/src/mitm/handlers/copilot.js +35 -0
- package/src/mitm/handlers/cursor.js +15 -0
- package/src/mitm/handlers/kiro.js +526 -0
- package/src/mitm/logger.js +106 -0
- package/src/mitm/manager.js +851 -0
- package/src/mitm/paths.js +32 -0
- package/src/mitm/server.js +435 -0
- package/src/mitm/winElevated.js +81 -0
- package/src/models/index.js +38 -0
- package/src/proxy.js +5 -0
- package/src/shared/components/AddCustomEmbeddingModal.js +183 -0
- package/src/shared/components/Avatar.js +88 -0
- package/src/shared/components/Badge.js +54 -0
- package/src/shared/components/BulkAccountAutomationModal.js +508 -0
- package/src/shared/components/Button.js +56 -0
- package/src/shared/components/Card.js +116 -0
- package/src/shared/components/ChangelogModal.js +97 -0
- package/src/shared/components/CodeBuddyQuotaCookieModal.js +109 -0
- package/src/shared/components/ComboFormModal.js +176 -0
- package/src/shared/components/CursorAuthModal.js +212 -0
- package/src/shared/components/DonateModal.js +136 -0
- package/src/shared/components/Drawer.js +82 -0
- package/src/shared/components/EditConnectionModal.js +286 -0
- package/src/shared/components/Footer.js +132 -0
- package/src/shared/components/GitLabAuthModal.js +194 -0
- package/src/shared/components/Header.js +380 -0
- package/src/shared/components/HeaderLanguage.js +46 -0
- package/src/shared/components/HeaderMenu.js +126 -0
- package/src/shared/components/IFlowCookieModal.js +132 -0
- package/src/shared/components/Input.js +65 -0
- package/src/shared/components/KiroAuthModal.js +1171 -0
- package/src/shared/components/KiroOAuthWrapper.js +149 -0
- package/src/shared/components/KiroSocialOAuthModal.js +205 -0
- package/src/shared/components/LanguageSwitcher.js +190 -0
- package/src/shared/components/Loading.js +75 -0
- package/src/shared/components/ManualConfigModal.js +44 -0
- package/src/shared/components/McpMarketplaceModal.js +255 -0
- package/src/shared/components/Modal.js +146 -0
- package/src/shared/components/ModelSelectModal.js +537 -0
- package/src/shared/components/NineRemoteButton.js +23 -0
- package/src/shared/components/NineRemotePromoModal.js +99 -0
- package/src/shared/components/NoAuthProxyCard.js +86 -0
- package/src/shared/components/OAuthModal.js +682 -0
- package/src/shared/components/Pagination.js +150 -0
- package/src/shared/components/PricingModal.js +208 -0
- package/src/shared/components/ProviderIcon.js +63 -0
- package/src/shared/components/ProviderInfoCard.js +82 -0
- package/src/shared/components/RequestLogger.js +121 -0
- package/src/shared/components/SegmentedControl.js +48 -0
- package/src/shared/components/Select.js +67 -0
- package/src/shared/components/Sidebar.js +441 -0
- package/src/shared/components/ThemeProvider.js +15 -0
- package/src/shared/components/ThemeToggle.js +42 -0
- package/src/shared/components/Toggle.js +69 -0
- package/src/shared/components/Tooltip.js +25 -0
- package/src/shared/components/UsageStats.js +505 -0
- package/src/shared/components/index.js +46 -0
- package/src/shared/components/layouts/AuthLayout.js +29 -0
- package/src/shared/components/layouts/DashboardLayout.js +104 -0
- package/src/shared/components/layouts/index.js +4 -0
- package/src/shared/constants/cliTools.js +397 -0
- package/src/shared/constants/colors.js +77 -0
- package/src/shared/constants/config.js +99 -0
- package/src/shared/constants/coworkPlugins.js +75 -0
- package/src/shared/constants/index.js +4 -0
- package/src/shared/constants/locales.js +36 -0
- package/src/shared/constants/mitmToolHosts.js +12 -0
- package/src/shared/constants/models.js +38 -0
- package/src/shared/constants/pricing.js +303 -0
- package/src/shared/constants/providers.js +289 -0
- package/src/shared/constants/skills.js +78 -0
- package/src/shared/constants/ttsProviders.js +138 -0
- package/src/shared/hooks/index.js +2 -0
- package/src/shared/hooks/useCopyToClipboard.js +43 -0
- package/src/shared/hooks/useTheme.js +60 -0
- package/src/shared/services/bootstrap.js +12 -0
- package/src/shared/services/initializeApp.js +268 -0
- package/src/shared/utils/api.js +93 -0
- package/src/shared/utils/apiKey.js +98 -0
- package/src/shared/utils/clineAuth.js +37 -0
- package/src/shared/utils/cn.js +11 -0
- package/src/shared/utils/connectionStatus.js +162 -0
- package/src/shared/utils/index.js +40 -0
- package/src/shared/utils/machine.js +6 -0
- package/src/shared/utils/machineId.js +66 -0
- package/src/shared/utils/providerModelsFetcher.js +30 -0
- package/src/sse/handlers/chat.js +261 -0
- package/src/sse/handlers/embeddings.js +141 -0
- package/src/sse/handlers/fetch.js +213 -0
- package/src/sse/handlers/imageGeneration.js +142 -0
- package/src/sse/handlers/search.js +206 -0
- package/src/sse/handlers/stt.js +88 -0
- package/src/sse/handlers/tts.js +114 -0
- package/src/sse/services/auth.js +346 -0
- package/src/sse/services/codexGateway.js +215 -0
- package/src/sse/services/model.js +99 -0
- package/src/sse/services/tokenRefresh.js +319 -0
- package/src/sse/utils/logger.js +75 -0
- package/src/store/headerSearchStore.js +19 -0
- package/src/store/index.js +6 -0
- package/src/store/notificationStore.js +45 -0
- package/src/store/providerStore.js +55 -0
- package/src/store/settingsStore.js +51 -0
- package/src/store/themeStore.js +54 -0
- package/src/store/userStore.js +20 -0
- package/start.sh +4 -0
|
@@ -0,0 +1,458 @@
|
|
|
1
|
+
import { platform, arch } from "os";
|
|
2
|
+
|
|
3
|
+
// === OS/Arch helpers ===
|
|
4
|
+
function mapStainlessOs() {
|
|
5
|
+
switch (platform()) {
|
|
6
|
+
case "darwin": return "MacOS";
|
|
7
|
+
case "win32": return "Windows";
|
|
8
|
+
case "linux": return "Linux";
|
|
9
|
+
case "freebsd": return "FreeBSD";
|
|
10
|
+
default: return `Other::${platform()}`;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function mapStainlessArch() {
|
|
15
|
+
switch (arch()) {
|
|
16
|
+
case "x64": return "x64";
|
|
17
|
+
case "arm64": return "arm64";
|
|
18
|
+
case "ia32": return "x86";
|
|
19
|
+
default: return `other::${arch()}`;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Shared Claude-compatible API headers (reused across claude-format providers)
|
|
24
|
+
const CLAUDE_API_HEADERS = {
|
|
25
|
+
"Anthropic-Version": "2023-06-01",
|
|
26
|
+
"Anthropic-Beta": "claude-code-20250219,interleaved-thinking-2025-05-14"
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// Full Claude CLI fingerprint — required by providers that gate on client identity (e.g. agentrouter)
|
|
30
|
+
const CLAUDE_CLI_SPOOF_HEADERS = {
|
|
31
|
+
"Anthropic-Version": "2023-06-01",
|
|
32
|
+
"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",
|
|
33
|
+
"Anthropic-Dangerous-Direct-Browser-Access": "true",
|
|
34
|
+
"User-Agent": "claude-cli/2.1.92 (external, sdk-cli)",
|
|
35
|
+
"X-App": "cli",
|
|
36
|
+
"X-Stainless-Helper-Method": "stream",
|
|
37
|
+
"X-Stainless-Retry-Count": "0",
|
|
38
|
+
"X-Stainless-Runtime-Version": "v24.14.0",
|
|
39
|
+
"X-Stainless-Package-Version": "0.80.0",
|
|
40
|
+
"X-Stainless-Runtime": "node",
|
|
41
|
+
"X-Stainless-Lang": "js",
|
|
42
|
+
"X-Stainless-Arch": mapStainlessArch(),
|
|
43
|
+
"X-Stainless-Os": mapStainlessOs(),
|
|
44
|
+
"X-Stainless-Timeout": "600"
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// Shared baseUrls
|
|
48
|
+
const KIMI_CODING_BASE_URL = "https://api.kimi.com/coding/v1/messages";
|
|
49
|
+
|
|
50
|
+
export const PROVIDERS = {
|
|
51
|
+
claude: {
|
|
52
|
+
baseUrl: "https://api.anthropic.com/v1/messages",
|
|
53
|
+
format: "claude",
|
|
54
|
+
headers: { ...CLAUDE_CLI_SPOOF_HEADERS },
|
|
55
|
+
clientId: "9d1c250a-e61b-44d9-88ed-5944d1962f5e",
|
|
56
|
+
tokenUrl: "https://api.anthropic.com/v1/oauth/token"
|
|
57
|
+
},
|
|
58
|
+
gemini: {
|
|
59
|
+
baseUrl: "https://generativelanguage.googleapis.com/v1beta/models",
|
|
60
|
+
format: "gemini",
|
|
61
|
+
clientId: "681255809395-oo8ft2oprdrnp9e3aqf6av3hmdib135j.apps.googleusercontent.com",
|
|
62
|
+
clientSecret: "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"
|
|
63
|
+
},
|
|
64
|
+
"gemini-cli": {
|
|
65
|
+
baseUrl: "https://cloudcode-pa.googleapis.com/v1internal",
|
|
66
|
+
format: "gemini-cli",
|
|
67
|
+
clientId: "681255809395-oo8ft2oprdrnp9e3aqf6av3hmdib135j.apps.googleusercontent.com",
|
|
68
|
+
clientSecret: "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"
|
|
69
|
+
},
|
|
70
|
+
codex: {
|
|
71
|
+
baseUrl: "https://chatgpt.com/backend-api/codex/responses",
|
|
72
|
+
format: "openai-responses",
|
|
73
|
+
headers: {
|
|
74
|
+
"originator": "codex_cli_rs",
|
|
75
|
+
"User-Agent": "codex_cli_rs/0.136.0"
|
|
76
|
+
},
|
|
77
|
+
clientId: "app_EMoamEEZ73f0CkXaXp7hrann",
|
|
78
|
+
tokenUrl: "https://auth.openai.com/oauth/token"
|
|
79
|
+
},
|
|
80
|
+
qwen: {
|
|
81
|
+
baseUrl: "https://portal.qwen.ai/v1/chat/completions",
|
|
82
|
+
format: "openai",
|
|
83
|
+
clientId: "f0304373b74a44d2b584a3fb70ca9e56",
|
|
84
|
+
tokenUrl: "https://chat.qwen.ai/api/v1/oauth2/token",
|
|
85
|
+
authUrl: "https://chat.qwen.ai/api/v1/oauth2/device/code"
|
|
86
|
+
},
|
|
87
|
+
iflow: {
|
|
88
|
+
baseUrl: "https://apis.iflow.cn/v1/chat/completions",
|
|
89
|
+
format: "openai",
|
|
90
|
+
headers: { "User-Agent": "iFlow-Cli" },
|
|
91
|
+
clientId: "10009311001",
|
|
92
|
+
clientSecret: "4Z3YjXycVsQvyGF1etiNlIBB4RsqSDtW",
|
|
93
|
+
tokenUrl: "https://iflow.cn/oauth/token",
|
|
94
|
+
authUrl: "https://iflow.cn/oauth"
|
|
95
|
+
},
|
|
96
|
+
qoder: {
|
|
97
|
+
// The qoder executor builds the full URL itself (it has to append
|
|
98
|
+
// ?Encode=1 + sigPath query params and bypass any provider-level URL
|
|
99
|
+
// rewriting). baseUrl is kept for compatibility with introspection
|
|
100
|
+
// helpers but the executor ignores it.
|
|
101
|
+
baseUrl: "https://api3.qoder.sh/algo/api/v2/service/pro/sse/agent_chat_generation",
|
|
102
|
+
format: "openai",
|
|
103
|
+
headers: {},
|
|
104
|
+
},
|
|
105
|
+
antigravity: {
|
|
106
|
+
baseUrls: [
|
|
107
|
+
"https://daily-cloudcode-pa.googleapis.com",
|
|
108
|
+
"https://daily-cloudcode-pa.sandbox.googleapis.com",
|
|
109
|
+
],
|
|
110
|
+
format: "antigravity",
|
|
111
|
+
headers: { "User-Agent": `antigravity/1.107.0 ${platform()}/${arch()}` },
|
|
112
|
+
clientId: "1071006060591-tmhssin2h21lcre235vtolojh4g403ep.apps.googleusercontent.com",
|
|
113
|
+
clientSecret: "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"
|
|
114
|
+
},
|
|
115
|
+
openrouter: {
|
|
116
|
+
baseUrl: "https://openrouter.ai/api/v1/chat/completions",
|
|
117
|
+
format: "openai",
|
|
118
|
+
headers: {
|
|
119
|
+
"HTTP-Referer": "https://endpoint-proxy.local",
|
|
120
|
+
"X-Title": "Endpoint Proxy"
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
openai: {
|
|
124
|
+
baseUrl: "https://api.openai.com/v1/chat/completions",
|
|
125
|
+
format: "openai"
|
|
126
|
+
},
|
|
127
|
+
"vercel-ai-gateway": {
|
|
128
|
+
baseUrl: "https://ai-gateway.vercel.sh/v1/chat/completions",
|
|
129
|
+
format: "openai"
|
|
130
|
+
},
|
|
131
|
+
glm: {
|
|
132
|
+
baseUrl: "https://api.z.ai/api/anthropic/v1/messages",
|
|
133
|
+
format: "claude",
|
|
134
|
+
headers: { ...CLAUDE_API_HEADERS }
|
|
135
|
+
},
|
|
136
|
+
"glm-cn": {
|
|
137
|
+
baseUrl: "https://open.bigmodel.cn/api/coding/paas/v4/chat/completions",
|
|
138
|
+
format: "openai",
|
|
139
|
+
headers: {}
|
|
140
|
+
},
|
|
141
|
+
kimi: {
|
|
142
|
+
baseUrl: KIMI_CODING_BASE_URL,
|
|
143
|
+
format: "claude",
|
|
144
|
+
headers: { ...CLAUDE_API_HEADERS }
|
|
145
|
+
},
|
|
146
|
+
minimax: {
|
|
147
|
+
baseUrl: "https://api.minimax.io/anthropic/v1/messages",
|
|
148
|
+
format: "claude",
|
|
149
|
+
headers: { ...CLAUDE_API_HEADERS }
|
|
150
|
+
},
|
|
151
|
+
"minimax-cn": {
|
|
152
|
+
baseUrl: "https://api.minimaxi.com/anthropic/v1/messages",
|
|
153
|
+
format: "claude",
|
|
154
|
+
headers: { ...CLAUDE_API_HEADERS }
|
|
155
|
+
},
|
|
156
|
+
alicode: {
|
|
157
|
+
baseUrl: "https://coding.dashscope.aliyuncs.com/v1/chat/completions",
|
|
158
|
+
format: "openai",
|
|
159
|
+
headers: {}
|
|
160
|
+
},
|
|
161
|
+
"alicode-intl": {
|
|
162
|
+
baseUrl: "https://coding-intl.dashscope.aliyuncs.com/v1/chat/completions",
|
|
163
|
+
format: "openai",
|
|
164
|
+
headers: {}
|
|
165
|
+
},
|
|
166
|
+
"volcengine-ark": {
|
|
167
|
+
baseUrl: "https://ark.cn-beijing.volces.com/api/coding/v3/chat/completions",
|
|
168
|
+
format: "openai",
|
|
169
|
+
headers: {}
|
|
170
|
+
},
|
|
171
|
+
byteplus: {
|
|
172
|
+
baseUrl: "https://ark.ap-southeast.bytepluses.com/api/coding/v3/chat/completions",
|
|
173
|
+
format: "openai",
|
|
174
|
+
headers: {}
|
|
175
|
+
},
|
|
176
|
+
github: {
|
|
177
|
+
baseUrl: "https://api.githubcopilot.com/chat/completions",
|
|
178
|
+
responsesUrl: "https://api.githubcopilot.com/responses",
|
|
179
|
+
format: "openai",
|
|
180
|
+
headers: {
|
|
181
|
+
"copilot-integration-id": "vscode-chat",
|
|
182
|
+
"editor-version": "vscode/1.110.0",
|
|
183
|
+
"editor-plugin-version": "copilot-chat/0.38.0",
|
|
184
|
+
"user-agent": "GitHubCopilotChat/0.38.0",
|
|
185
|
+
"openai-intent": "conversation-panel",
|
|
186
|
+
"x-github-api-version": "2025-04-01",
|
|
187
|
+
"x-vscode-user-agent-library-version": "electron-fetch",
|
|
188
|
+
"X-Initiator": "user",
|
|
189
|
+
"Accept": "application/json",
|
|
190
|
+
"Content-Type": "application/json"
|
|
191
|
+
},
|
|
192
|
+
clientId: "Iv1.b507a08c87ecfe98"
|
|
193
|
+
},
|
|
194
|
+
kiro: {
|
|
195
|
+
baseUrl: "https://codewhisperer.us-east-1.amazonaws.com/generateAssistantResponse",
|
|
196
|
+
format: "kiro",
|
|
197
|
+
retry: { 429: 2 },
|
|
198
|
+
headers: {
|
|
199
|
+
"Content-Type": "application/json",
|
|
200
|
+
"Accept": "application/vnd.amazon.eventstream",
|
|
201
|
+
"X-Amz-Target": "AmazonCodeWhispererStreamingService.GenerateAssistantResponse",
|
|
202
|
+
"User-Agent": "AWS-SDK-JS/3.0.0 kiro-ide/1.0.0",
|
|
203
|
+
"X-Amz-User-Agent": "aws-sdk-js/3.0.0 kiro-ide/1.0.0"
|
|
204
|
+
},
|
|
205
|
+
tokenUrl: "https://prod.us-east-1.auth.desktop.kiro.dev/refreshToken",
|
|
206
|
+
authUrl: "https://prod.us-east-1.auth.desktop.kiro.dev"
|
|
207
|
+
},
|
|
208
|
+
cursor: {
|
|
209
|
+
baseUrl: "https://api2.cursor.sh",
|
|
210
|
+
chatPath: "/aiserver.v1.ChatService/StreamUnifiedChatWithTools",
|
|
211
|
+
format: "cursor",
|
|
212
|
+
headers: {
|
|
213
|
+
"connect-accept-encoding": "gzip",
|
|
214
|
+
"connect-protocol-version": "1",
|
|
215
|
+
"Content-Type": "application/connect+proto",
|
|
216
|
+
"User-Agent": "connect-es/1.6.1"
|
|
217
|
+
},
|
|
218
|
+
clientVersion: "3.1.0"
|
|
219
|
+
},
|
|
220
|
+
"kimi-coding": {
|
|
221
|
+
baseUrl: KIMI_CODING_BASE_URL,
|
|
222
|
+
format: "claude",
|
|
223
|
+
headers: { ...CLAUDE_API_HEADERS },
|
|
224
|
+
clientId: "17e5f671-d194-4dfb-9706-5516cb48c098",
|
|
225
|
+
tokenUrl: "https://auth.kimi.com/api/oauth/token",
|
|
226
|
+
refreshUrl: "https://auth.kimi.com/api/oauth/token"
|
|
227
|
+
},
|
|
228
|
+
kilocode: {
|
|
229
|
+
baseUrl: "https://api.kilo.ai/api/openrouter/chat/completions",
|
|
230
|
+
format: "openai",
|
|
231
|
+
headers: {}
|
|
232
|
+
},
|
|
233
|
+
opencode: {
|
|
234
|
+
baseUrl: "http://localhost:4096/v1/chat/completions",
|
|
235
|
+
format: "openai",
|
|
236
|
+
headers: {}
|
|
237
|
+
},
|
|
238
|
+
cline: {
|
|
239
|
+
baseUrl: "https://api.cline.bot/api/v1/chat/completions",
|
|
240
|
+
format: "openai",
|
|
241
|
+
headers: {
|
|
242
|
+
"HTTP-Referer": "https://cline.bot",
|
|
243
|
+
"X-Title": "Cline"
|
|
244
|
+
},
|
|
245
|
+
tokenUrl: "https://api.cline.bot/api/v1/auth/token",
|
|
246
|
+
refreshUrl: "https://api.cline.bot/api/v1/auth/refresh"
|
|
247
|
+
},
|
|
248
|
+
nvidia: {
|
|
249
|
+
baseUrl: "https://integrate.api.nvidia.com/v1/chat/completions",
|
|
250
|
+
format: "openai"
|
|
251
|
+
},
|
|
252
|
+
anthropic: {
|
|
253
|
+
baseUrl: "https://api.anthropic.com/v1/messages",
|
|
254
|
+
format: "claude",
|
|
255
|
+
headers: { ...CLAUDE_API_HEADERS }
|
|
256
|
+
},
|
|
257
|
+
deepseek: {
|
|
258
|
+
baseUrl: "https://api.deepseek.com/chat/completions",
|
|
259
|
+
format: "openai"
|
|
260
|
+
},
|
|
261
|
+
commandcode: {
|
|
262
|
+
baseUrl: "https://api.commandcode.ai/alpha/generate",
|
|
263
|
+
format: "commandcode",
|
|
264
|
+
headers: {
|
|
265
|
+
"x-command-code-version": "0.25.7",
|
|
266
|
+
"x-cli-environment": "cli"
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
groq: {
|
|
270
|
+
baseUrl: "https://api.groq.com/openai/v1/chat/completions",
|
|
271
|
+
format: "openai"
|
|
272
|
+
},
|
|
273
|
+
xai: {
|
|
274
|
+
baseUrl: "https://api.x.ai/v1/chat/completions",
|
|
275
|
+
responsesUrl: "https://api.x.ai/v1/responses",
|
|
276
|
+
format: "openai",
|
|
277
|
+
clientId: "b1a00492-073a-47ea-816f-4c329264a828",
|
|
278
|
+
tokenUrl: "https://auth.x.ai/oauth2/token",
|
|
279
|
+
refreshUrl: "https://auth.x.ai/oauth2/token"
|
|
280
|
+
},
|
|
281
|
+
mistral: {
|
|
282
|
+
baseUrl: "https://api.mistral.ai/v1/chat/completions",
|
|
283
|
+
format: "openai"
|
|
284
|
+
},
|
|
285
|
+
perplexity: {
|
|
286
|
+
baseUrl: "https://api.perplexity.ai/chat/completions",
|
|
287
|
+
format: "openai"
|
|
288
|
+
},
|
|
289
|
+
together: {
|
|
290
|
+
baseUrl: "https://api.together.xyz/v1/chat/completions",
|
|
291
|
+
format: "openai"
|
|
292
|
+
},
|
|
293
|
+
fireworks: {
|
|
294
|
+
baseUrl: "https://api.fireworks.ai/inference/v1/chat/completions",
|
|
295
|
+
format: "openai"
|
|
296
|
+
},
|
|
297
|
+
cerebras: {
|
|
298
|
+
baseUrl: "https://api.cerebras.ai/v1/chat/completions",
|
|
299
|
+
format: "openai"
|
|
300
|
+
},
|
|
301
|
+
cohere: {
|
|
302
|
+
baseUrl: "https://api.cohere.ai/v1/chat/completions",
|
|
303
|
+
format: "openai"
|
|
304
|
+
},
|
|
305
|
+
nebius: {
|
|
306
|
+
baseUrl: "https://api.studio.nebius.ai/v1/chat/completions",
|
|
307
|
+
format: "openai"
|
|
308
|
+
},
|
|
309
|
+
siliconflow: {
|
|
310
|
+
baseUrl: "https://api.siliconflow.cn/v1/chat/completions",
|
|
311
|
+
format: "openai"
|
|
312
|
+
},
|
|
313
|
+
hyperbolic: {
|
|
314
|
+
baseUrl: "https://api.hyperbolic.xyz/v1/chat/completions",
|
|
315
|
+
format: "openai"
|
|
316
|
+
},
|
|
317
|
+
deepgram: {
|
|
318
|
+
baseUrl: "https://api.deepgram.com/v1/listen",
|
|
319
|
+
format: "openai"
|
|
320
|
+
},
|
|
321
|
+
assemblyai: {
|
|
322
|
+
baseUrl: "https://api.assemblyai.com/v1/audio/transcriptions",
|
|
323
|
+
format: "openai"
|
|
324
|
+
},
|
|
325
|
+
nanobanana: {
|
|
326
|
+
baseUrl: "https://api.nanobananaapi.ai/v1/chat/completions",
|
|
327
|
+
format: "openai"
|
|
328
|
+
},
|
|
329
|
+
chutes: {
|
|
330
|
+
baseUrl: "https://llm.chutes.ai/v1/chat/completions",
|
|
331
|
+
format: "openai"
|
|
332
|
+
},
|
|
333
|
+
ollama: {
|
|
334
|
+
baseUrl: "https://ollama.com/api/chat",
|
|
335
|
+
format: "ollama"
|
|
336
|
+
},
|
|
337
|
+
"ollama-local": {
|
|
338
|
+
baseUrl: "http://localhost:11434/api/chat",
|
|
339
|
+
format: "ollama"
|
|
340
|
+
},
|
|
341
|
+
// Vertex AI - Gemini models via Service Account JSON
|
|
342
|
+
// baseUrl is not used; VertexExecutor.buildUrl() constructs it dynamically
|
|
343
|
+
vertex: {
|
|
344
|
+
baseUrl: "https://aiplatform.googleapis.com",
|
|
345
|
+
format: "vertex"
|
|
346
|
+
},
|
|
347
|
+
// Vertex AI - Partner models (Claude, Llama, Mistral, GLM) via SA JSON
|
|
348
|
+
// Uses OpenAI-compatible global endpoint (or rawPredict for Anthropic)
|
|
349
|
+
"vertex-partner": {
|
|
350
|
+
baseUrl: "https://aiplatform.googleapis.com",
|
|
351
|
+
format: "openai"
|
|
352
|
+
},
|
|
353
|
+
// GitLab Duo - OpenAI-compatible chat endpoint
|
|
354
|
+
gitlab: {
|
|
355
|
+
baseUrl: "https://gitlab.com/api/v4/chat/completions",
|
|
356
|
+
format: "openai",
|
|
357
|
+
},
|
|
358
|
+
// CodeBuddy (Tencent) - external CodeBuddy Code endpoint
|
|
359
|
+
codebuddy: {
|
|
360
|
+
baseUrl: "https://www.codebuddy.ai/v2/chat/completions",
|
|
361
|
+
format: "openai",
|
|
362
|
+
refreshUrl: "https://www.codebuddy.ai/v2/plugin/auth/token/refresh",
|
|
363
|
+
},
|
|
364
|
+
opencode: {
|
|
365
|
+
baseUrl: "https://opencode.ai",
|
|
366
|
+
format: "openai",
|
|
367
|
+
headers: { "x-opencode-client": "desktop" },
|
|
368
|
+
noAuth: true
|
|
369
|
+
},
|
|
370
|
+
"opencode-go": {
|
|
371
|
+
baseUrl: "https://opencode.ai/zen/go/v1/chat/completions",
|
|
372
|
+
format: "openai",
|
|
373
|
+
headers: {}
|
|
374
|
+
},
|
|
375
|
+
"grok-web": {
|
|
376
|
+
baseUrl: "https://grok.com/rest/app-chat/conversations/new",
|
|
377
|
+
format: "grok-web",
|
|
378
|
+
authType: "cookie"
|
|
379
|
+
},
|
|
380
|
+
"perplexity-web": {
|
|
381
|
+
baseUrl: "https://www.perplexity.ai/rest/sse/perplexity_ask",
|
|
382
|
+
format: "perplexity-web",
|
|
383
|
+
authType: "cookie"
|
|
384
|
+
},
|
|
385
|
+
azure: {
|
|
386
|
+
baseUrl: "",
|
|
387
|
+
format: "openai",
|
|
388
|
+
headers: {}
|
|
389
|
+
},
|
|
390
|
+
// Cloudflare Workers AI - {accountId} resolved from credentials.providerSpecificData.accountId
|
|
391
|
+
"cloudflare-ai": {
|
|
392
|
+
baseUrl: "https://api.cloudflare.com/client/v4/accounts/{accountId}/ai/v1/chat/completions",
|
|
393
|
+
format: "openai"
|
|
394
|
+
},
|
|
395
|
+
"xiaomi-mimo": {
|
|
396
|
+
baseUrl: "https://api.xiaomimimo.com/v1/chat/completions",
|
|
397
|
+
format: "openai"
|
|
398
|
+
},
|
|
399
|
+
"xiaomi-tokenplan": {
|
|
400
|
+
baseUrl: "https://token-plan-sgp.xiaomimimo.com/v1/chat/completions",
|
|
401
|
+
format: "openai"
|
|
402
|
+
},
|
|
403
|
+
// Region map for Xiaomi MiMo Token Plan (keys are cluster-specific)
|
|
404
|
+
// Used by resolveXiaomiTokenplanBaseUrl below
|
|
405
|
+
// === Free-tier providers (synced from OmniRoute) ===
|
|
406
|
+
// Claude-format with Claude CLI header spoofing (auth: x-api-key)
|
|
407
|
+
agentrouter: { baseUrl: "https://agentrouter.org/v1/messages", format: "claude", headers: { ...CLAUDE_CLI_SPOOF_HEADERS } },
|
|
408
|
+
// OpenAI-compatible (auth: bearer)
|
|
409
|
+
aimlapi: { baseUrl: "https://api.aimlapi.com/v1/chat/completions", format: "openai" },
|
|
410
|
+
novita: { baseUrl: "https://api.novita.ai/v3/openai/chat/completions", format: "openai" },
|
|
411
|
+
modal: { baseUrl: "https://api.modal.com/v1/chat/completions", format: "openai" },
|
|
412
|
+
reka: { baseUrl: "https://api.reka.ai/v1/chat/completions", format: "openai" },
|
|
413
|
+
nlpcloud: { baseUrl: "https://api.nlpcloud.io/v1/gpu/chatbot", format: "openai" },
|
|
414
|
+
bazaarlink: { baseUrl: "https://bazaarlink.ai/api/v1/chat/completions", format: "openai" },
|
|
415
|
+
completions: { baseUrl: "https://completions.me/api/v1/chat/completions", format: "openai" },
|
|
416
|
+
// enally uses X-API-Key header (not bearer); handled in validate route
|
|
417
|
+
enally: { baseUrl: "https://ai.enally.in/v1/chat/completions", format: "openai", authHeader: "x-api-key" },
|
|
418
|
+
freetheai: { baseUrl: "https://api.freetheai.xyz/v1/chat/completions", format: "openai" },
|
|
419
|
+
llm7: { baseUrl: "https://api.llm7.io/v1/chat/completions", format: "openai" },
|
|
420
|
+
lepton: { baseUrl: "https://api.lepton.ai/api/v1/chat/completions", format: "openai" },
|
|
421
|
+
kluster: { baseUrl: "https://api.kluster.ai/v1/chat/completions", format: "openai" },
|
|
422
|
+
ai21: { baseUrl: "https://api.ai21.com/studio/v1/chat/completions", format: "openai" },
|
|
423
|
+
"inference-net": { baseUrl: "https://api.inference.net/v1/chat/completions", format: "openai" },
|
|
424
|
+
predibase: { baseUrl: "https://serving.app.predibase.com/v1/chat/completions", format: "openai" },
|
|
425
|
+
bytez: { baseUrl: "https://api.bytez.com/models/v2", format: "openai" },
|
|
426
|
+
morph: { baseUrl: "https://api.morphllm.com/v1/chat/completions", format: "openai" },
|
|
427
|
+
longcat: { baseUrl: "https://api.longcat.chat/openai/v1/chat/completions", format: "openai" },
|
|
428
|
+
puter: { baseUrl: "https://api.puter.com/puterai/openai/v1/chat/completions", format: "openai" },
|
|
429
|
+
uncloseai: { baseUrl: "https://hermes.ai.unturf.com/v1/chat/completions", format: "openai", noAuth: true },
|
|
430
|
+
scaleway: { baseUrl: "https://api.scaleway.ai/v1/chat/completions", format: "openai" },
|
|
431
|
+
deepinfra: { baseUrl: "https://api.deepinfra.com/v1/openai/chat/completions", format: "openai" },
|
|
432
|
+
sambanova: { baseUrl: "https://api.sambanova.ai/v1/chat/completions", format: "openai" },
|
|
433
|
+
nscale: { baseUrl: "https://inference.api.nscale.com/v1/chat/completions", format: "openai" },
|
|
434
|
+
baseten: { baseUrl: "https://inference.baseten.co/v1/chat/completions", format: "openai" },
|
|
435
|
+
publicai: { baseUrl: "https://api.publicai.co/v1/chat/completions", format: "openai" },
|
|
436
|
+
"nous-research": { baseUrl: "https://inference-api.nousresearch.com/v1/chat/completions", format: "openai" },
|
|
437
|
+
glhf: { baseUrl: "https://glhf.chat/api/openai/v1/chat/completions", format: "openai" },
|
|
438
|
+
blackbox: { baseUrl: "https://api.blackbox.ai/chat/completions", format: "openai" },
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
export const OLLAMA_LOCAL_DEFAULT_HOST = "http://localhost:11434";
|
|
442
|
+
|
|
443
|
+
export function resolveOllamaLocalHost(credentials) {
|
|
444
|
+
const raw = credentials?.providerSpecificData?.baseUrl?.trim();
|
|
445
|
+
return (raw || OLLAMA_LOCAL_DEFAULT_HOST).replace(/\/$/, "");
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
export const XIAOMI_TOKENPLAN_REGIONS = {
|
|
449
|
+
sgp: "https://token-plan-sgp.xiaomimimo.com/v1",
|
|
450
|
+
cn: "https://token-plan-cn.xiaomimimo.com/v1",
|
|
451
|
+
ams: "https://token-plan-ams.xiaomimimo.com/v1"
|
|
452
|
+
};
|
|
453
|
+
export const XIAOMI_TOKENPLAN_DEFAULT_REGION = "sgp";
|
|
454
|
+
|
|
455
|
+
export function resolveXiaomiTokenplanBaseUrl(credentials) {
|
|
456
|
+
const region = credentials?.providerSpecificData?.region;
|
|
457
|
+
return XIAOMI_TOKENPLAN_REGIONS[region] || XIAOMI_TOKENPLAN_REGIONS[XIAOMI_TOKENPLAN_DEFAULT_REGION];
|
|
458
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// HTTP status codes
|
|
2
|
+
export const HTTP_STATUS = {
|
|
3
|
+
BAD_REQUEST: 400,
|
|
4
|
+
UNAUTHORIZED: 401,
|
|
5
|
+
PAYMENT_REQUIRED: 402,
|
|
6
|
+
FORBIDDEN: 403,
|
|
7
|
+
NOT_FOUND: 404,
|
|
8
|
+
NOT_ACCEPTABLE: 406,
|
|
9
|
+
REQUEST_TIMEOUT: 408,
|
|
10
|
+
RATE_LIMITED: 429,
|
|
11
|
+
SERVER_ERROR: 500,
|
|
12
|
+
BAD_GATEWAY: 502,
|
|
13
|
+
SERVICE_UNAVAILABLE: 503,
|
|
14
|
+
GATEWAY_TIMEOUT: 504
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// Re-export error config (backward compat)
|
|
18
|
+
export { ERROR_TYPES, DEFAULT_ERROR_MESSAGES, BACKOFF_CONFIG, COOLDOWN_MS } from "./errorConfig.js";
|
|
19
|
+
|
|
20
|
+
// Cache TTLs (seconds)
|
|
21
|
+
export const CACHE_TTL = {
|
|
22
|
+
userInfo: 300, // 5 minutes
|
|
23
|
+
modelAlias: 3600 // 1 hour
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// Memory management config
|
|
27
|
+
export const MEMORY_CONFIG = {
|
|
28
|
+
sessionTtlMs: 2 * 60 * 60 * 1000,
|
|
29
|
+
sessionCleanupIntervalMs: 30 * 60 * 1000,
|
|
30
|
+
dnsCacheTtlMs: 5 * 60 * 1000,
|
|
31
|
+
proxyDispatchersMaxSize: 20,
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// Stream stall timeout: abort if no chunk received within this duration
|
|
35
|
+
export const STREAM_STALL_TIMEOUT_MS = 60 * 1000;
|
|
36
|
+
|
|
37
|
+
// Fetch connect timeout: abort if upstream doesn't return response headers within this duration
|
|
38
|
+
export const FETCH_CONNECT_TIMEOUT_MS = 60 * 1000;
|
|
39
|
+
|
|
40
|
+
// Default token limits
|
|
41
|
+
export const DEFAULT_MAX_TOKENS = 64000;
|
|
42
|
+
export const DEFAULT_MIN_TOKENS = 32000;
|
|
43
|
+
|
|
44
|
+
// Retry config for 429 responses (legacy - kept for backward compatibility)
|
|
45
|
+
export const RETRY_CONFIG = {
|
|
46
|
+
maxAttempts: 2,
|
|
47
|
+
delayMs: 2000
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
// Default retry config by status code: { attempts, delayMs }
|
|
51
|
+
// Backward compat: if value is a number, treated as attempts with RETRY_CONFIG.delayMs
|
|
52
|
+
export const DEFAULT_RETRY_CONFIG = {
|
|
53
|
+
429: { attempts: 0, delayMs: 0 },
|
|
54
|
+
502: { attempts: 3, delayMs: 3000 },
|
|
55
|
+
503: { attempts: 3, delayMs: 2000 },
|
|
56
|
+
504: { attempts: 2, delayMs: 3000 }
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
// Normalize a retry entry to { attempts, delayMs }
|
|
60
|
+
export function resolveRetryEntry(entry) {
|
|
61
|
+
if (entry == null) return { attempts: 0, delayMs: RETRY_CONFIG.delayMs };
|
|
62
|
+
if (typeof entry === "number") return { attempts: entry, delayMs: RETRY_CONFIG.delayMs };
|
|
63
|
+
return {
|
|
64
|
+
attempts: entry.attempts || 0,
|
|
65
|
+
delayMs: entry.delayMs != null ? entry.delayMs : RETRY_CONFIG.delayMs
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Requests containing these texts will bypass provider
|
|
70
|
+
export const SKIP_PATTERNS = [
|
|
71
|
+
"Please write a 5-10 word title for the following conversation:"
|
|
72
|
+
];
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { GOOGLE_TTS_LANGUAGES } from "./googleTtsLanguages.js";
|
|
2
|
+
|
|
3
|
+
// ── Voice definitions (DRY — reused across providers) ──────────────────────
|
|
4
|
+
const VOICES = {
|
|
5
|
+
alloy: { id: "alloy", name: "Alloy" },
|
|
6
|
+
ash: { id: "ash", name: "Ash" },
|
|
7
|
+
ballad: { id: "ballad", name: "Ballad" },
|
|
8
|
+
cedar: { id: "cedar", name: "Cedar" },
|
|
9
|
+
coral: { id: "coral", name: "Coral" },
|
|
10
|
+
echo: { id: "echo", name: "Echo" },
|
|
11
|
+
fable: { id: "fable", name: "Fable" },
|
|
12
|
+
marin: { id: "marin", name: "Marin" },
|
|
13
|
+
nova: { id: "nova", name: "Nova" },
|
|
14
|
+
onyx: { id: "onyx", name: "Onyx" },
|
|
15
|
+
sage: { id: "sage", name: "Sage" },
|
|
16
|
+
shimmer: { id: "shimmer", name: "Shimmer" },
|
|
17
|
+
verse: { id: "verse", name: "Verse" },
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const v = (...keys) => keys.map((k) => ({ ...VOICES[k], type: "tts" }));
|
|
21
|
+
|
|
22
|
+
// 9 voices for tts-1 / tts-1-hd
|
|
23
|
+
const VOICES_STANDARD = v("alloy", "ash", "coral", "echo", "fable", "nova", "onyx", "sage", "shimmer");
|
|
24
|
+
// 13 voices for gpt-4o-mini-tts
|
|
25
|
+
const VOICES_FULL = v("alloy", "ash", "ballad", "cedar", "coral", "echo", "fable", "marin", "nova", "onyx", "sage", "shimmer", "verse");
|
|
26
|
+
|
|
27
|
+
// Gemini prebuilt voices (30 voices, multi-language auto-detect)
|
|
28
|
+
const GEMINI_VOICES = [
|
|
29
|
+
"Zephyr", "Puck", "Charon", "Kore", "Fenrir", "Leda", "Orus", "Aoede",
|
|
30
|
+
"Callirrhoe", "Autonoe", "Enceladus", "Iapetus", "Umbriel", "Algieba",
|
|
31
|
+
"Despina", "Erinome", "Algenib", "Rasalgethi", "Laomedeia", "Achernar",
|
|
32
|
+
"Alnilam", "Schedar", "Gacrux", "Pulcherrima", "Achird", "Zubenelgenubi",
|
|
33
|
+
"Vindemiatrix", "Sadachbia", "Sadaltager", "Sulafat",
|
|
34
|
+
].map((id) => ({ id, name: id, type: "tts" }));
|
|
35
|
+
|
|
36
|
+
// ── TTS Config (config-driven, single source of truth) ─────────────────────
|
|
37
|
+
export const TTS_MODELS_CONFIG = {
|
|
38
|
+
openai: {
|
|
39
|
+
models: [
|
|
40
|
+
{ id: "gpt-4o-mini-tts", name: "GPT-4o Mini TTS", type: "tts" },
|
|
41
|
+
{ id: "tts-1-hd", name: "TTS-1 HD", type: "tts" },
|
|
42
|
+
{ id: "tts-1", name: "TTS-1", type: "tts" },
|
|
43
|
+
],
|
|
44
|
+
voices: {
|
|
45
|
+
"gpt-4o-mini-tts": VOICES_FULL,
|
|
46
|
+
"tts-1": VOICES_STANDARD,
|
|
47
|
+
"tts-1-hd": VOICES_STANDARD,
|
|
48
|
+
},
|
|
49
|
+
// Flat voice list (all unique voices) for backward compat
|
|
50
|
+
allVoices: VOICES_FULL,
|
|
51
|
+
},
|
|
52
|
+
openrouter: {
|
|
53
|
+
models: [
|
|
54
|
+
{ id: "openai/gpt-4o-mini-tts", name: "GPT-4o Mini TTS", type: "tts" },
|
|
55
|
+
{ id: "openai/tts-1-hd", name: "TTS-1 HD", type: "tts" },
|
|
56
|
+
{ id: "openai/tts-1", name: "TTS-1", type: "tts" },
|
|
57
|
+
],
|
|
58
|
+
voices: {
|
|
59
|
+
"openai/gpt-4o-mini-tts": VOICES_FULL,
|
|
60
|
+
"openai/tts-1": VOICES_STANDARD,
|
|
61
|
+
"openai/tts-1-hd": VOICES_STANDARD,
|
|
62
|
+
},
|
|
63
|
+
allVoices: VOICES_FULL,
|
|
64
|
+
},
|
|
65
|
+
elevenlabs: {
|
|
66
|
+
models: [
|
|
67
|
+
{ id: "eleven_flash_v2_5", name: "Flash v2.5 (Fastest)", type: "tts" },
|
|
68
|
+
{ id: "eleven_turbo_v2_5", name: "Turbo v2.5 (Fast)", type: "tts" },
|
|
69
|
+
{ id: "eleven_multilingual_v2", name: "Multilingual v2 (Quality)", type: "tts" },
|
|
70
|
+
{ id: "eleven_monolingual_v1", name: "Monolingual v1 (English)", type: "tts" },
|
|
71
|
+
],
|
|
72
|
+
// voices come from API, not hardcoded
|
|
73
|
+
},
|
|
74
|
+
"edge-tts": {
|
|
75
|
+
defaults: [
|
|
76
|
+
{ id: "en-US-AriaNeural", name: "Aria (en-US)", type: "tts" },
|
|
77
|
+
{ id: "en-US-GuyNeural", name: "Guy (en-US)", type: "tts" },
|
|
78
|
+
{ id: "en-GB-SoniaNeural", name: "Sonia (en-GB)", type: "tts" },
|
|
79
|
+
{ id: "vi-VN-HoaiMyNeural", name: "Hoai My (vi-VN)", type: "tts" },
|
|
80
|
+
{ id: "vi-VN-NamMinhNeural", name: "Nam Minh (vi-VN)", type: "tts" },
|
|
81
|
+
{ id: "zh-CN-XiaoxiaoNeural", name: "Xiaoxiao (zh-CN)", type: "tts" },
|
|
82
|
+
{ id: "zh-CN-YunxiNeural", name: "Yunxi (zh-CN)", type: "tts" },
|
|
83
|
+
{ id: "fr-FR-DeniseNeural", name: "Denise (fr-FR)", type: "tts" },
|
|
84
|
+
{ id: "de-DE-KatjaNeural", name: "Katja (de-DE)", type: "tts" },
|
|
85
|
+
{ id: "ja-JP-NanamiNeural", name: "Nanami (ja-JP)", type: "tts" },
|
|
86
|
+
{ id: "ko-KR-SunHiNeural", name: "SunHi (ko-KR)", type: "tts" },
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
"local-device": {
|
|
90
|
+
defaults: [
|
|
91
|
+
{ id: "default", name: "System Default Voice", type: "tts" },
|
|
92
|
+
],
|
|
93
|
+
},
|
|
94
|
+
"google-tts": {
|
|
95
|
+
defaults: GOOGLE_TTS_LANGUAGES,
|
|
96
|
+
},
|
|
97
|
+
gemini: {
|
|
98
|
+
models: [
|
|
99
|
+
{ id: "gemini-2.5-flash-preview-tts", name: "Gemini 2.5 Flash TTS", type: "tts" },
|
|
100
|
+
{ id: "gemini-2.5-pro-preview-tts", name: "Gemini 2.5 Pro TTS", type: "tts" },
|
|
101
|
+
],
|
|
102
|
+
voices: {
|
|
103
|
+
"gemini-2.5-flash-preview-tts": GEMINI_VOICES,
|
|
104
|
+
"gemini-2.5-pro-preview-tts": GEMINI_VOICES,
|
|
105
|
+
},
|
|
106
|
+
allVoices: GEMINI_VOICES,
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
// ── Helper: get voices for a specific model ────────────────────────────────
|
|
111
|
+
export function getTtsVoicesForModel(provider, modelId) {
|
|
112
|
+
const cfg = TTS_MODELS_CONFIG[provider];
|
|
113
|
+
if (!cfg?.voices) return null;
|
|
114
|
+
return cfg.voices[modelId] || cfg.allVoices || null;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// ── Build flat entries for PROVIDER_MODELS backward compat ─────────────────
|
|
118
|
+
export function buildTtsProviderModels() {
|
|
119
|
+
const entries = {};
|
|
120
|
+
for (const [provider, cfg] of Object.entries(TTS_MODELS_CONFIG)) {
|
|
121
|
+
if (cfg.models) entries[`${provider}-tts-models`] = cfg.models;
|
|
122
|
+
if (cfg.allVoices) entries[`${provider}-tts-voices`] = cfg.allVoices;
|
|
123
|
+
if (cfg.defaults) entries[provider] = cfg.defaults;
|
|
124
|
+
}
|
|
125
|
+
// Keep openai-tts-voices key pointing to full voice list for backward compat
|
|
126
|
+
entries["openai-tts-voices"] = TTS_MODELS_CONFIG.openai.allVoices;
|
|
127
|
+
entries["openrouter-tts-voices"] = TTS_MODELS_CONFIG.openrouter.allVoices;
|
|
128
|
+
return entries;
|
|
129
|
+
}
|