SPB Git forge

spb/polyllm

Public
15commits 1branches 0releases
2.2 MBsize
maindefault branch
13 days agolast push
TypeScript 97.4% SQL 1% JavaScript 0.9% CSS 0.6%
4.9 KB · 113 lines typescript
Raw Blame History
1import type { ProviderId } from "@/lib/ai/core/types";23/** Client-safe provider metadata (mirrors PROVIDER_META without importing adapters). */4export const PROVIDERS: Record<ProviderId, { name: string; shortName: string; keyDocsUrl: string; keyPrefixHint: string; colorVar: string; description: string; consoleUrl: string; keyHelp: string }> = {5  openai: {6    name: "OpenAI",7    shortName: "OpenAI",8    keyDocsUrl: "https://platform.openai.com/api-keys",9    keyPrefixHint: "sk-…",10    colorVar: "var(--p-openai)",11    description: "GPT-6, GPT-5.x, o-series reasoning models — via the Responses API.",12    consoleUrl: "https://platform.openai.com",13    keyHelp: "Create a project key at platform.openai.com → API keys. Keys look like sk-proj-….",14  },15  anthropic: {16    name: "Anthropic",17    shortName: "Anthropic",18    keyDocsUrl: "https://platform.claude.com/settings/keys",19    keyPrefixHint: "sk-ant-…",20    colorVar: "var(--p-anthropic)",21    description: "Claude Fable, Opus, Sonnet and Haiku — adaptive thinking, 1M context.",22    consoleUrl: "https://platform.claude.com",23    keyHelp: "Create a key in the Claude Console → Settings → API keys. Keys look like sk-ant-api03-….",24  },25  gemini: {26    name: "Google Gemini",27    shortName: "Gemini",28    keyDocsUrl: "https://aistudio.google.com/apikey",29    keyPrefixHint: "AIza… or AQ.…",30    colorVar: "var(--p-gemini)",31    description: "Gemini 3.x Flash and Pro, 2.5 family — Gemini Developer API.",32    consoleUrl: "https://aistudio.google.com",33    keyHelp: "Create a key in Google AI Studio → Get API key. Both AIza… and AQ.… keys work.",34  },35  xai: {36    name: "xAI",37    shortName: "xAI",38    keyDocsUrl: "https://console.x.ai",39    keyPrefixHint: "xai-…",40    colorVar: "var(--p-xai)",41    description: "Grok 4.x reasoning and non-reasoning models with live web search.",42    consoleUrl: "https://console.x.ai",43    keyHelp: "Create a key in the xAI Console → API Keys. Keys look like xai-….",44  },45  mistral: {46    name: "Mistral AI",47    shortName: "Mistral",48    keyDocsUrl: "https://console.mistral.ai/api-keys",49    keyPrefixHint: "32 characters",50    colorVar: "var(--p-mistral)",51    description: "Mistral Large / Medium / Small, Ministral, Magistral reasoning, Codestral — La Plateforme.",52    consoleUrl: "https://console.mistral.ai",53    keyHelp: "Create a key in La Plateforme → API Keys (console.mistral.ai). Keys are 32 alphanumeric characters.",54  },55  deepseek: {56    name: "DeepSeek",57    shortName: "DeepSeek",58    keyDocsUrl: "https://platform.deepseek.com/api_keys",59    keyPrefixHint: "sk-…",60    colorVar: "var(--p-deepseek)",61    description: "DeepSeek V4 Flash / Pro — thinking mode, context caching, very low prices.",62    consoleUrl: "https://platform.deepseek.com",63    keyHelp: "Create a key at platform.deepseek.com → API keys. Keys look like sk-….",64  },65  kimi: {66    name: "Kimi (Moonshot AI)",67    shortName: "Kimi",68    keyDocsUrl: "https://platform.moonshot.ai/console/api-keys",69    keyPrefixHint: "sk-…",70    colorVar: "var(--p-kimi)",71    description: "Kimi K2.6 / K2.7 Code / K3 — long context, thinking, web search (api.moonshot.ai).",72    consoleUrl: "https://platform.moonshot.ai",73    keyHelp: "Create a key in the Moonshot AI international console (platform.moonshot.ai). Keys look like sk-….",74  },75  openrouter: {76    name: "OpenRouter",77    shortName: "OpenRouter",78    keyDocsUrl: "https://openrouter.ai/settings/keys",79    keyPrefixHint: "sk-or-v1-…",80    colorVar: "var(--p-openrouter)",81    description: "Hundreds of models from every vendor behind one key, with live pricing and routing.",82    consoleUrl: "https://openrouter.ai",83    keyHelp: "Create a key at openrouter.ai → Settings → Keys. Keys look like sk-or-v1-….",84  },85  cerebras: {86    name: "Cerebras",87    shortName: "Cerebras",88    keyDocsUrl: "https://cloud.cerebras.ai/",89    keyPrefixHint: "csk-…",90    colorVar: "var(--p-cerebras)",91    description: "Ultra-fast inference for open models (GPT-OSS, Qwen, Gemma) on wafer-scale hardware.",92    consoleUrl: "https://cloud.cerebras.ai",93    keyHelp: "Create a key in Cerebras Cloud → API Keys. Keys look like csk-….",94  },95  custom: {96    name: "Custom endpoints",97    shortName: "Custom",98    keyDocsUrl: "/app/settings/endpoints",99    keyPrefixHint: "",100    colorVar: "var(--p-custom)",101    description: "Your own OpenAI-compatible servers — Ollama, LM Studio, vLLM, llama.cpp, MLX.",102    consoleUrl: "/app/settings/endpoints",103    keyHelp: "Configured per endpoint in Settings → Endpoints (base URL, optional key, headers).",104  },105};106107/** Providers connected with one API key, in display order. `custom` is managed in Settings → Endpoints. */108export const PROVIDER_ORDER: ProviderId[] = ["openai", "anthropic", "gemini", "xai", "mistral", "deepseek", "kimi", "openrouter", "cerebras"];109110export function providerName(p: string | null | undefined): string {111  return p && p in PROVIDERS ? PROVIDERS[p as ProviderId].shortName : p ?? "—";112}113