2026-01-04 21:58:59 -05:00
// Provider definitions
2026-03-30 00:28:07 -04:00
// Free Providers (kiro first, iflow last)
2026-02-06 23:17:06 -05:00
export const FREE _PROVIDERS = {
2026-03-30 00:28:07 -04:00
kiro : { id : "kiro" , alias : "kr" , name : "Kiro AI" , icon : "psychology_alt" , color : "#FF6B35" } ,
2026-04-17 00:33:36 -04:00
qwen : { id : "qwen" , alias : "qw" , name : "Qwen Code" , icon : "psychology" , color : "#10B981" , deprecated : true , deprecationNotice : "Qwen OAuth free tier was discontinued by Alibaba on 2026-04-15. New connections will not work." } ,
2026-04-13 01:04:57 -04:00
"gemini-cli" : { id : "gemini-cli" , alias : "gc" , name : "Gemini CLI" , icon : "terminal" , color : "#4285F4" , deprecated : true , deprecationNotice : "Gemini CLI is designed exclusively for Gemini CLI. Using it with other tools (OpenClaw, Claude, Codex...) may result in account restrictions or bans." } ,
2026-03-30 00:28:07 -04:00
// gitlab: { id: "gitlab", alias: "gl", name: "GitLab Duo", icon: "code", color: "#FC6D26" },
// codebuddy: { id: "codebuddy", alias: "cb", name: "CodeBuddy", icon: "smart_toy", color: "#006EFF" },
2026-03-31 04:41:52 -04:00
// qoder: { id: "qoder", alias: "qd", name: "Qoder AI", icon: "water_drop", color: "#EC4899" },
2026-03-30 00:28:07 -04:00
iflow : { id : "iflow" , alias : "if" , name : "iFlow AI" , icon : "water_drop" , color : "#6366F1" } ,
2026-04-22 03:16:21 -04:00
opencode : { id : "opencode" , alias : "oc" , name : "OpenCode Free" , icon : "terminal" , color : "#E87040" , textIcon : "OC" , noAuth : true , passthroughModels : true , modelsFetcher : { url : "https://opencode.ai/zen/v1/models" , type : "opencode-free" } } ,
2026-03-30 00:28:07 -04:00
} ;
// Free Tier Providers (has free access but may require account/API key)
export const FREE _TIER _PROVIDERS = {
2026-04-14 23:45:46 -04:00
openrouter : { id : "openrouter" , alias : "openrouter" , name : "OpenRouter" , icon : "router" , color : "#F97316" , textIcon : "OR" , website : "https://openrouter.ai" , notice : { text : "Free tier: 27+ free models, no credit card needed, 200 req/day. After $10 credit: 1,000 req/day." , apiKeyUrl : "https://openrouter.ai/settings/keys" } , modelsFetcher : { url : "https://openrouter.ai/api/v1/models" , type : "openrouter-free" } , passthroughModels : true , serviceKinds : [ "llm" , "embedding" , "tts" , "imageToText" ] } ,
2026-03-30 00:28:07 -04:00
nvidia : { id : "nvidia" , alias : "nvidia" , name : "NVIDIA NIM" , icon : "developer_board" , color : "#76B900" , textIcon : "NV" , website : "https://developer.nvidia.com/nim" , notice : { text : "Free access for NVIDIA Developer Program members (prototyping & testing)." , apiKeyUrl : "https://build.nvidia.com/settings/api-keys" } } ,
2026-03-31 04:41:52 -04:00
ollama : { id : "ollama" , alias : "ollama" , name : "Ollama Cloud" , icon : "cloud" , color : "#ffffffff" , textIcon : "OL" , website : "https://ollama.com" , notice : { text : "Free tier: light usage, 1 cloud model at a time (limits reset every 5h & 7d). Pro $20/mo · Max $100/mo." , apiKeyUrl : "https://ollama.com/settings/keys" } } ,
2026-03-30 00:28:07 -04:00
vertex : { id : "vertex" , alias : "vx" , name : "Vertex AI" , icon : "cloud" , color : "#4285F4" , textIcon : "VX" , website : "https://cloud.google.com/vertex-ai" , notice : { text : "New Google Cloud accounts get $300 free credits. Requires GCP project + Service Account with Vertex AI API enabled." , apiKeyUrl : "https://console.cloud.google.com/iam-admin/serviceaccounts" } } ,
2026-04-14 23:45:46 -04:00
gemini : { id : "gemini" , alias : "gemini" , name : "Gemini" , icon : "diamond" , color : "#4285F4" , textIcon : "GE" , website : "https://ai.google.dev" , serviceKinds : [ "llm" , "embedding" , "image" , "imageToText" , "webSearch" ] } ,
2026-02-06 23:17:06 -05:00
} ;
2026-04-13 01:04:57 -04:00
// Thinking config definitions
// options: list of selectable modes ("auto" = no override from server)
// defaultMode: fallback when user hasn't configured
// extended: claude-style thinking (thinking.type + budget_tokens) — used by most providers
// effort: openai-style reasoning_effort — only openai + codex
export const THINKING _CONFIG = {
extended : {
options : [ "auto" , "on" , "off" ] ,
defaultMode : "auto" ,
defaultBudgetTokens : 10000
} ,
effort : {
options : [ "auto" , "none" , "low" , "medium" , "high" ] ,
defaultMode : "auto"
}
} ;
2026-01-04 21:58:59 -05:00
// OAuth Providers
export const OAUTH _PROVIDERS = {
claude : { id : "claude" , alias : "cc" , name : "Claude Code" , icon : "smart_toy" , color : "#D97757" } ,
2026-04-13 01:04:57 -04:00
antigravity : { id : "antigravity" , alias : "ag" , name : "Antigravity" , icon : "rocket_launch" , color : "#F59E0B" , deprecated : true , deprecationNotice : "AG is designed exclusively for Antigravity IDE. Using it with other tools (OpenClaw, Claude, Codex...) may result in account restrictions or bans." } ,
2026-04-25 05:22:30 -04:00
codex : { id : "codex" , alias : "cx" , name : "OpenAI Codex" , icon : "code" , color : "#3B82F6" , thinkingConfig : THINKING _CONFIG . effort , serviceKinds : [ "llm" , "image" ] , kindNotice : { image : "Requires a ChatGPT Plus (or higher) account. Free accounts are not supported for image generation." } } ,
2026-01-04 21:58:59 -05:00
github : { id : "github" , alias : "gh" , name : "GitHub Copilot" , icon : "code" , color : "#333333" } ,
2026-02-04 00:07:29 -05:00
cursor : { id : "cursor" , alias : "cu" , name : "Cursor IDE" , icon : "edit_note" , color : "#00D4AA" } ,
2026-03-11 23:48:11 -04:00
// "kimi-coding": { id: "kimi-coding", alias: "kmc", name: "Kimi Coding", icon: "psychology", color: "#1E40AF", textIcon: "KC" },
2026-03-01 06:40:55 -05:00
kilocode : { id : "kilocode" , alias : "kc" , name : "Kilo Code" , icon : "code" , color : "#FF6B35" , textIcon : "KC" } ,
cline : { id : "cline" , alias : "cl" , name : "Cline" , icon : "smart_toy" , color : "#5B9BD5" , textIcon : "CL" } ,
2026-03-30 00:28:07 -04:00
// opencode: { id: "opencode", alias: "oc", name: "OpenCode", icon: "terminal", color: "#E87040", textIcon: "OC" },
2026-01-04 21:58:59 -05:00
} ;
export const APIKEY _PROVIDERS = {
2026-02-20 05:05:46 -05:00
glm : { id : "glm" , alias : "glm" , name : "GLM Coding" , icon : "code" , color : "#2563EB" , textIcon : "GL" , website : "https://open.bigmodel.cn" } ,
2026-02-24 22:34:52 -05:00
"glm-cn" : { id : "glm-cn" , alias : "glm-cn" , name : "GLM (China)" , icon : "code" , color : "#DC2626" , textIcon : "GC" , website : "https://open.bigmodel.cn" } ,
2026-04-14 23:45:46 -04:00
kimi : { id : "kimi" , alias : "kimi" , name : "Kimi" , icon : "psychology" , color : "#1E3A8A" , textIcon : "KM" , website : "https://kimi.moonshot.cn" , serviceKinds : [ "llm" , "webSearch" ] } ,
minimax : { id : "minimax" , alias : "minimax" , name : "Minimax Coding" , icon : "memory" , color : "#7C3AED" , textIcon : "MM" , website : "https://www.minimaxi.com" , serviceKinds : [ "llm" , "image" , "imageToText" , "webSearch" ] } ,
2026-02-20 05:05:46 -05:00
"minimax-cn" : { id : "minimax-cn" , alias : "minimax-cn" , name : "Minimax (China)" , icon : "memory" , color : "#DC2626" , textIcon : "MC" , website : "https://www.minimaxi.com" } ,
2026-03-01 21:31:16 -05:00
alicode : { id : "alicode" , alias : "alicode" , name : "Alibaba" , icon : "cloud" , color : "#FF6A00" , textIcon : "ALi" } ,
2026-03-06 22:08:55 -05:00
"alicode-intl" : { id : "alicode-intl" , alias : "alicode-intl" , name : "Alibaba Intl" , icon : "cloud" , color : "#FF6A00" , textIcon : "ALi" } ,
2026-04-23 22:28:50 -04:00
"volcengine-ark" : { id : "volcengine-ark" , alias : "ark" , name : "Volcengine Ark" , icon : "cloud" , color : "#1677FF" , textIcon : "ARK" , website : "https://ark.cn-beijing.volces.com" } ,
2026-04-25 06:00:39 -04:00
byteplus : { id : "byteplus" , alias : "bpm" , name : "BytePlus ModelArk" , icon : "cloud" , color : "#2563EB" , textIcon : "BP" , website : "https://console.byteplus.com/ark" , serviceKinds : [ "llm" ] } ,
2026-04-14 23:45:46 -04:00
openai : { id : "openai" , alias : "openai" , name : "OpenAI" , icon : "auto_awesome" , color : "#10A37F" , textIcon : "OA" , website : "https://platform.openai.com" , serviceKinds : [ "llm" , "embedding" , "tts" , "image" , "imageToText" , "webSearch" ] , thinkingConfig : THINKING _CONFIG . effort } ,
anthropic : { id : "anthropic" , alias : "anthropic" , name : "Anthropic" , icon : "smart_toy" , color : "#D97757" , textIcon : "AN" , website : "https://console.anthropic.com" , serviceKinds : [ "llm" , "imageToText" ] } ,
2026-04-22 03:16:21 -04:00
"opencode-go" : { id : "opencode-go" , alias : "ocg" , name : "OpenCode Go" , icon : "terminal" , color : "#E87040" , textIcon : "OC" , website : "https://opencode.ai/auth" , notice : { text : "OpenCode Go subscription: $5/mo (then $10/mo). Access to Kimi, GLM, Qwen, MiMo, MiniMax models." , apiKeyUrl : "https://opencode.ai/auth" } } ,
2026-04-23 23:04:59 -04:00
azure : { id : "azure" , alias : "azure" , name : "Azure OpenAI" , icon : "cloud" , color : "#0078D4" , textIcon : "AZ" , website : "https://azure.microsoft.com/en-us/products/ai-services/openai-service" , hasProviderSpecificData : true } ,
2026-04-07 00:35:25 -04:00
2026-02-20 05:05:46 -05:00
deepseek : { id : "deepseek" , alias : "ds" , name : "DeepSeek" , icon : "bolt" , color : "#4D6BFE" , textIcon : "DS" , website : "https://deepseek.com" } ,
2026-04-14 23:45:46 -04:00
groq : { id : "groq" , alias : "groq" , name : "Groq" , icon : "speed" , color : "#F55036" , textIcon : "GQ" , website : "https://groq.com" , serviceKinds : [ "llm" , "imageToText" ] } ,
xai : { id : "xai" , alias : "xai" , name : "xAI (Grok)" , icon : "auto_awesome" , color : "#1DA1F2" , textIcon : "XA" , website : "https://x.ai" , serviceKinds : [ "llm" , "imageToText" , "webSearch" ] } ,
mistral : { id : "mistral" , alias : "mistral" , name : "Mistral" , icon : "air" , color : "#FF7000" , textIcon : "MI" , website : "https://mistral.ai" , serviceKinds : [ "llm" , "imageToText" ] } ,
perplexity : { id : "perplexity" , alias : "pplx" , name : "Perplexity" , icon : "search" , color : "#20808D" , textIcon : "PP" , website : "https://www.perplexity.ai" , serviceKinds : [ "llm" , "webSearch" ] } ,
2026-02-20 05:05:46 -05:00
together : { id : "together" , alias : "together" , name : "Together AI" , icon : "group_work" , color : "#0F6FFF" , textIcon : "TG" , website : "https://www.together.ai" } ,
fireworks : { id : "fireworks" , alias : "fireworks" , name : "Fireworks AI" , icon : "local_fire_department" , color : "#7B2EF2" , textIcon : "FW" , website : "https://fireworks.ai" } ,
cerebras : { id : "cerebras" , alias : "cerebras" , name : "Cerebras" , icon : "memory" , color : "#FF4F00" , textIcon : "CB" , website : "https://www.cerebras.ai" } ,
cohere : { id : "cohere" , alias : "cohere" , name : "Cohere" , icon : "hub" , color : "#39594D" , textIcon : "CO" , website : "https://cohere.com" } ,
nebius : { id : "nebius" , alias : "nebius" , name : "Nebius AI" , icon : "cloud" , color : "#6C5CE7" , textIcon : "NB" , website : "https://nebius.com" } ,
siliconflow : { id : "siliconflow" , alias : "siliconflow" , name : "SiliconFlow" , icon : "cloud_queue" , color : "#5B6EF5" , textIcon : "SF" , website : "https://cloud.siliconflow.com" } ,
hyperbolic : { id : "hyperbolic" , alias : "hyp" , name : "Hyperbolic" , icon : "bolt" , color : "#00D4FF" , textIcon : "HY" , website : "https://hyperbolic.xyz" } ,
2026-04-14 23:45:46 -04:00
deepgram : { id : "deepgram" , alias : "dg" , name : "Deepgram" , icon : "mic" , color : "#13EF93" , textIcon : "DG" , website : "https://deepgram.com" , serviceKinds : [ "stt" , "imageToText" ] } ,
2026-04-04 04:07:07 -04:00
assemblyai : { id : "assemblyai" , alias : "aai" , name : "AssemblyAI" , icon : "record_voice_over" , color : "#0062FF" , textIcon : "AA" , website : "https://assemblyai.com" , serviceKinds : [ "stt" ] } ,
nanobanana : { id : "nanobanana" , alias : "nb" , name : "NanoBanana" , icon : "image" , color : "#FFD700" , textIcon : "NB" , website : "https://nanobananaapi.ai" , serviceKinds : [ "image" ] } ,
elevenlabs : { id : "elevenlabs" , alias : "el" , name : "ElevenLabs" , icon : "record_voice_over" , color : "#6C47FF" , textIcon : "EL" , website : "https://elevenlabs.io" , serviceKinds : [ "tts" ] } ,
2026-04-09 23:17:53 -04:00
cartesia : { id : "cartesia" , alias : "cartesia" , name : "Cartesia" , icon : "spatial_audio" , color : "#FF4F8B" , textIcon : "CA" , website : "https://cartesia.ai" , serviceKinds : [ "tts" ] , hidden : true } ,
playht : { id : "playht" , alias : "playht" , name : "PlayHT" , icon : "play_circle" , color : "#00B4D8" , textIcon : "PH" , website : "https://play.ht" , serviceKinds : [ "tts" ] , hidden : true } ,
"local-device" : { id : "local-device" , alias : "local-device" , name : "Local Device" , icon : "speaker" , color : "#64748B" , textIcon : "LD" , serviceKinds : [ "tts" ] , noAuth : true } ,
"google-tts" : { id : "google-tts" , alias : "google-tts" , name : "Google TTS" , icon : "record_voice_over" , color : "#4285F4" , textIcon : "GT" , serviceKinds : [ "tts" ] , noAuth : true } ,
"edge-tts" : { id : "edge-tts" , alias : "edge-tts" , name : "Edge TTS" , icon : "record_voice_over" , color : "#0078D4" , textIcon : "ET" , serviceKinds : [ "tts" ] , noAuth : true } ,
2026-04-04 04:07:07 -04:00
sdwebui : { id : "sdwebui" , alias : "sdwebui" , name : "SD WebUI" , icon : "brush" , color : "#FF7043" , textIcon : "SD" , website : "https://github.com/AUTOMATIC1111/stable-diffusion-webui" , serviceKinds : [ "image" ] } ,
comfyui : { id : "comfyui" , alias : "comfyui" , name : "ComfyUI" , icon : "account_tree" , color : "#4CAF50" , textIcon : "CF" , website : "https://github.com/comfyanonymous/ComfyUI" , serviceKinds : [ "image" ] } ,
2026-04-14 23:45:46 -04:00
huggingface : { id : "huggingface" , alias : "hf" , name : "HuggingFace" , icon : "face" , color : "#FFD21E" , textIcon : "HF" , website : "https://huggingface.co" , serviceKinds : [ "image" , "imageToText" , "tts" ] , hiddenKinds : [ "tts" ] } ,
2026-04-17 01:06:00 -04:00
blackbox : { id : "blackbox" , alias : "bb" , name : "Blackbox AI" , icon : "smart_toy" , color : "#5B5FEF" , textIcon : "BB" , website : "https://blackbox.ai" , serviceKinds : [ "llm" ] } ,
2026-03-12 04:24:02 -04:00
chutes : { id : "chutes" , alias : "ch" , name : "Chutes AI" , icon : "water_drop" , color : "#ffffffff" , textIcon : "CH" , website : "https://chutes.ai" } ,
2026-03-12 23:22:59 -04:00
"ollama-local" : { id : "ollama-local" , alias : "ollama-local" , name : "Ollama Local" , icon : "cloud" , color : "#ffffffff" , textIcon : "OL" , website : "https://ollama.com" } ,
feat: Add Google Cloud Vertex AI provider support (vertex, vertex-partner)
Co-authored-by: Quan <quanle96@outlook.com>
PR: https://github.com/decolua/9router/pull/298
Thanks to @kwanLeeFrmVi for the original implementation. Here is a summary
of changes made during review integration:
- Replaced google-auth-library with jose (already a project dependency)
for SA JSON -> OAuth2 Bearer token minting (RS256 JWT assertion flow)
- Moved auth logic (parseSaJson, refreshVertexToken, token cache) from
executor into open-sse/services/tokenRefresh.js to match project pattern
- Fixed executor to use proxyAwareFetch instead of raw fetch (proxy support)
- Simplified buildUrl: use global aiplatform.googleapis.com endpoint for
both vertex (Gemini) and vertex-partner; removed region/modelFamily fields
- Added auto-detection of GCP project_id from raw API key via probe request
(vertex-partner only, cached per key)
- Added vertex/vertex-partner cases to /api/providers/validate/route.js
- Updated model lists based on live testing:
- vertex: gemini-3.1-pro-preview, gemini-3.1-flash-lite-preview,
gemini-3-flash-preview, gemini-2.5-flash (removed gemini-2.5-pro: 404)
- vertex-partner: deepseek-v3.2, qwen3-next-80b (instruct+thinking),
glm-5 (removed Mistral/Llama: not enabled in test project)
- gemini provider: added gemini-3.1-pro-preview, gemini-3.1-flash-lite-preview
- Removed bun.lock (project uses npm/package-lock.json)
- Removed region and modelFamily UI fields (global endpoint, auto-detect)
- Kiro token auto-refresh on AccessDeniedException (from commit 2)
Made-with: Cursor
2026-03-14 00:37:23 -04:00
"vertex-partner" : { id : "vertex-partner" , alias : "vxp" , name : "Vertex Partner" , icon : "cloud" , color : "#34A853" , textIcon : "VP" , website : "https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-partner-models" } ,
2026-04-14 23:45:46 -04:00
tavily : { id : "tavily" , alias : "tavily" , name : "Tavily" , icon : "search" , color : "#5B21B6" , textIcon : "TV" , website : "https://tavily.com" , serviceKinds : [ "webSearch" ] } ,
"brave-search" : { id : "brave-search" , alias : "brave" , name : "Brave Search" , icon : "travel_explore" , color : "#FB542B" , textIcon : "BR" , website : "https://brave.com/search/api" , serviceKinds : [ "webSearch" ] } ,
serper : { id : "serper" , alias : "serper" , name : "Serper" , icon : "search" , color : "#4F46E5" , textIcon : "SP" , website : "https://serper.dev" , serviceKinds : [ "webSearch" ] } ,
exa : { id : "exa" , alias : "exa" , name : "Exa" , icon : "manage_search" , color : "#2563EB" , textIcon : "EX" , website : "https://exa.ai" , serviceKinds : [ "webSearch" ] } ,
searxng : { id : "searxng" , alias : "searxng" , name : "SearXNG" , icon : "saved_search" , color : "#3B82F6" , textIcon : "SX" , website : "https://docs.searxng.org" , serviceKinds : [ "webSearch" ] , noAuth : true } ,
firecrawl : { id : "firecrawl" , alias : "firecrawl" , name : "Firecrawl" , icon : "local_fire_department" , color : "#F59E0B" , textIcon : "FC" , website : "https://firecrawl.dev" , serviceKinds : [ "webFetch" ] } ,
2026-01-04 21:58:59 -05:00
} ;
2026-04-22 00:58:53 -04:00
// Web Cookie Providers (use browser session cookie instead of API key)
export const WEB _COOKIE _PROVIDERS = {
"grok-web" : { id : "grok-web" , alias : "gw" , name : "Grok Web (Subscription)" , icon : "auto_awesome" , color : "#1DA1F2" , textIcon : "GW" , website : "https://grok.com" , authType : "cookie" , authHint : "Paste your sso= cookie value from grok.com" , passthroughModels : true , serviceKinds : [ "llm" ] } ,
"perplexity-web" : { id : "perplexity-web" , alias : "pw" , name : "Perplexity Web (Pro/Max)" , icon : "search" , color : "#20808D" , textIcon : "PW" , website : "https://www.perplexity.ai" , authType : "cookie" , authHint : "Paste your __Secure-next-auth.session-token cookie value from perplexity.ai" , serviceKinds : [ "llm" ] } ,
} ;
2026-04-04 04:07:07 -04:00
// Media provider kinds — each kind maps to a route and endpoint config
export const MEDIA _PROVIDER _KINDS = [
2026-04-14 23:45:46 -04:00
{ id : "embedding" , label : "Embedding" , icon : "data_array" , endpoint : { method : "POST" , path : "/v1/embeddings" } } ,
{ id : "image" , label : "Text to Image" , icon : "brush" , endpoint : { method : "POST" , path : "/v1/images/generations" } } ,
{ id : "imageToText" , label : "Image to Text" , icon : "image_search" , endpoint : { method : "POST" , path : "/v1/images/understanding" } } ,
{ id : "tts" , label : "Text To Speech" , icon : "record_voice_over" , endpoint : { method : "POST" , path : "/v1/audio/speech" } } ,
{ id : "stt" , label : "STT" , icon : "mic" , endpoint : { method : "POST" , path : "/v1/audio/transcriptions" } } ,
{ id : "webSearch" , label : "Web Search" , icon : "travel_explore" , endpoint : { method : "POST" , path : "/v1/search" } } ,
{ id : "webFetch" , label : "Web Fetch" , icon : "language" , endpoint : { method : "POST" , path : "/v1/web/fetch" } } ,
{ id : "video" , label : "Video" , icon : "movie" , endpoint : { method : "POST" , path : "/v1/video/generations" } } ,
{ id : "music" , label : "Music" , icon : "music_note" , endpoint : { method : "POST" , path : "/v1/audio/music" } } ,
2026-04-04 04:07:07 -04:00
] ;
2026-02-02 07:45:12 -05:00
export const OPENAI _COMPATIBLE _PREFIX = "openai-compatible-" ;
2026-02-03 03:11:41 -05:00
export const ANTHROPIC _COMPATIBLE _PREFIX = "anthropic-compatible-" ;
2026-04-25 05:22:30 -04:00
export const CUSTOM _EMBEDDING _PREFIX = "custom-embedding-" ;
2026-02-02 07:45:12 -05:00
export function isOpenAICompatibleProvider ( providerId ) {
return typeof providerId === "string" && providerId . startsWith ( OPENAI _COMPATIBLE _PREFIX ) ;
}
2026-02-03 03:11:41 -05:00
export function isAnthropicCompatibleProvider ( providerId ) {
return typeof providerId === "string" && providerId . startsWith ( ANTHROPIC _COMPATIBLE _PREFIX ) ;
}
2026-04-25 05:22:30 -04:00
export function isCustomEmbeddingProvider ( providerId ) {
return typeof providerId === "string" && providerId . startsWith ( CUSTOM _EMBEDDING _PREFIX ) ;
}
2026-01-04 21:58:59 -05:00
// All providers (combined)
2026-04-22 00:58:53 -04:00
export const AI _PROVIDERS = { ... FREE _PROVIDERS , ... FREE _TIER _PROVIDERS , ... OAUTH _PROVIDERS , ... APIKEY _PROVIDERS , ... WEB _COOKIE _PROVIDERS } ;
2026-01-04 21:58:59 -05:00
// Auth methods
export const AUTH _METHODS = {
oauth : { id : "oauth" , name : "OAuth" , icon : "lock" } ,
apikey : { id : "apikey" , name : "API Key" , icon : "key" } ,
2026-04-22 00:58:53 -04:00
cookie : { id : "cookie" , name : "Browser Cookie" , icon : "cookie" } ,
2026-01-04 21:58:59 -05:00
} ;
// Helper: Get provider by alias
export function getProviderByAlias ( alias ) {
for ( const provider of Object . values ( AI _PROVIDERS ) ) {
if ( provider . alias === alias || provider . id === alias ) {
return provider ;
}
}
return null ;
}
// Helper: Get provider ID from alias
export function resolveProviderId ( aliasOrId ) {
const provider = getProviderByAlias ( aliasOrId ) ;
return provider ? . id || aliasOrId ;
}
// Helper: Get alias from provider ID
export function getProviderAlias ( providerId ) {
const provider = AI _PROVIDERS [ providerId ] ;
return provider ? . alias || providerId ;
}
// Alias to ID mapping (for quick lookup)
export const ALIAS _TO _ID = Object . values ( AI _PROVIDERS ) . reduce ( ( acc , p ) => {
acc [ p . alias ] = p . id ;
return acc ;
} , { } ) ;
// ID to Alias mapping
export const ID _TO _ALIAS = Object . values ( AI _PROVIDERS ) . reduce ( ( acc , p ) => {
acc [ p . id ] = p . alias ;
return acc ;
} , { } ) ;
2026-02-05 06:38:50 -05:00
2026-04-04 04:07:07 -04:00
// Helper: Get providers by service kind (e.g. "tts", "embedding", "image")
// Providers without serviceKinds default to ["llm"]
export function getProvidersByKind ( kind ) {
return Object . values ( AI _PROVIDERS ) . filter ( ( p ) => {
const kinds = p . serviceKinds ? ? [ "llm" ] ;
2026-04-09 23:17:53 -04:00
if ( ! kinds . includes ( kind ) ) return false ;
if ( p . hidden ) return false ; // globally hidden
if ( p . hiddenKinds ? . includes ( kind ) ) return false ; // hidden for specific kind
return true ;
2026-04-04 04:07:07 -04:00
} ) ;
}
2026-02-05 06:38:50 -05:00
// Providers that support usage/quota API
2026-03-11 23:48:11 -04:00
export const USAGE _SUPPORTED _PROVIDERS = [
"claude" ,
"antigravity" ,
"kiro" ,
"github" ,
"codex" ,
"kimi-coding" ,
2026-04-21 23:32:28 -04:00
"ollama" ,
2026-03-11 23:48:11 -04:00
] ;