Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors
TypeScript a2aai-agentsai-gatewayanthropicclaudeclaude-codeclinecodexcopilotcursordeepseekfree-aigeminikimillm-gatewaymcpopenaiopenai-proxyqwentoken-saver
feat: global email privacy toggle with eye icon button
diegosouzapw8bacde026276
diff --git a/.env.example b/.env.exampleindex 5f83134ca5..ee027a72e3 100644--- a/.env.example+++ b/.env.example@@ -10,7 +10,7 @@ JWT_SECRET=API_KEY_SECRET=# Initial admin password — CHANGE THIS before first use!-INITIAL_PASSWORD=CHANGEME+INITIAL_PASSWORD=123456# DATA_DIR=/var/lib/omniroute# Storage (SQLite)diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 81cc69f560..9a1e5a17ed 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -4,6 +4,16 @@---+## [3.6.2] — 2026-04-11++### ✨ New Features++- **Global Email Privacy Toggle:** Added a persistent eye-icon toggle button across all dashboard pages (Providers, Usage Limits, Playground) that reveals or hides masked email addresses. Toggle state is stored in localStorage and synced globally via Zustand store+- **Documentation Refresh:** Updated README, ARCHITECTURE, FEATURES, and API_REFERENCE for v3.6.2 with accurate provider counts (60+), new executor list, and system API documentation+- **Uninstall Guide:** Created comprehensive `docs/UNINSTALL.md` covering clean uninstallation for all deployment methods (npm, Docker, Electron, source)++---+## [3.6.1] — 2026-04-10### ✨ New Featuresdiff --git a/README.md b/README.mdindex f6aab62173..8bda7e8307 100644--- a/README.md+++ b/README.md@@ -779,9 +779,9 @@ PORT=20128 DASHBOARD_PORT=20129 omnirouteWhen you no longer need OmniRoute, we provide two quick scripts for a clean removal:-| Command | Action |-| --- | --- |-| `npm run uninstall` | Removes the system app but **keeps your DB and configurations** in `~/.omniroute`. |+| Command | Action |+| ------------------------ | ----------------------------------------------------------------------------------- |+| `npm run uninstall` | Removes the system app but **keeps your DB and configurations** in `~/.omniroute`. || `npm run uninstall:full` | Removes the app AND permanently **erases all configurations, keys, and databases**. |> Note: To run these commands, navigate to the OmniRoute project folder (if you cloned it) and run them. Alternatively, if globally installed, you can simply run `npm uninstall -g omniroute`.@@ -1069,7 +1069,7 @@ volumes:| Image | Tag | Size | Description || ------------------------ | -------- | ------ | --------------------- || `diegosouzapw/omniroute` | `latest` | ~250MB | Latest stable release |-| `diegosouzapw/omniroute` | `1.0.3` | ~250MB | Current version |+| `diegosouzapw/omniroute` | `3.6.2` | ~250MB | Current version |---@@ -1316,17 +1316,22 @@ Then in `/dashboard/media` → **Transcription** tab: upload any audio or video## 💡 Key Features-OmniRoute v3.5 is built as an operational platform, not just a relay proxy.+OmniRoute v3.6 is built as an operational platform, not just a relay proxy.-### 🆕 New — v3.5.5 Highlights (Apr 2026)+### 🆕 New — v3.6.x Highlights (Apr 2026)-| Feature | What It Does |-| -------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |-| 🔗 **Context Relay Strategy** | New combo strategy that preserves session continuity via structured handoff summaries when accounts rotate mid-conversation |-| 🛡️ **Proxy Hardening** | Token health check, API key validation, and undici dispatcher all honor proxy config — no more bypass in restricted envs |-| ⚠️ **Node.js 24 Login Warning** | Login page proactively detects incompatible Node.js versions and shows a clear warning banner with instructions |-| 📎 **Gemini PDF Attachments** | PDF files attached in chat messages are now correctly routed to Gemini via `inline_data` and generic base64 detection |-| 🔒 **CodeQL Security Hardening** | Resolved SSRF, insecure randomness, polynomial ReDoS, and incomplete URL sanitization alerts |+| Feature | What It Does |+| --------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |+| 🗑️ **Uninstall / Full Uninstall** | `npm run uninstall` keeps data, `npm run uninstall:full` removes everything — clean removal scripts for all install methods |+| 🔧 **OAuth Env Repair** | One-click "Repair env" action for OAuth providers restores missing environment variables and fixes broken auth state |+| 🔒 **Graceful Electron Shutdown** | Electron `before-quit` now shuts down Next.js gracefully, preventing SQLite WAL database locks on desktop app close |+| 👁️ **Model Visibility Toggle** | Per-model visibility toggle (👁 icon) with search filter and active-count badge (`N/M active`) on provider pages |+| 📧 **Email Privacy Masking** | OAuth account emails masked in provider dashboard (`di*****@g****.com`), full address visible on hover |+| 🔗 **Context Relay Strategy** | Combo strategy that preserves session continuity via structured handoff summaries when accounts rotate mid-conversation |+| 🛡️ **Proxy Hardening** | Token health check, API key validation, and undici dispatcher all honor proxy config — no more bypass in restricted envs |+| ⚠️ **Node.js 24 Login Warning** | Login page proactively detects incompatible Node.js versions and shows a clear warning banner with instructions |+| 📎 **Gemini PDF Attachments** | PDF files attached in chat messages are now correctly routed to Gemini via `inline_data` and generic base64 detection |+| 🔒 **CodeQL Security Hardening** | Resolved SSRF, insecure randomness, polynomial ReDoS, and incomplete URL sanitization alerts |### 🆕 New — ClawRouter-Inspired Improvements (Mar 2026)@@ -2184,7 +2189,7 @@ Se não quiser criar credenciais próprias agora, ainda é possível usar o flux- **Runtime**: Node.js 18–22 LTS (⚠️ Node.js 24+ is **not supported** — `better-sqlite3` native binaries are incompatible)- **Language**: TypeScript 5.9 — **100% TypeScript** across `src/` and `open-sse/` (zero `any` in core modules since v2.0)- **Framework**: Next.js 16 + React 19 + Tailwind CSS 4-- **Database**: LowDB (JSON) + SQLite (domain state + proxy logs + MCP audit + routing decisions)+- **Database**: better-sqlite3 (SQLite) + LowDB (JSON legacy) — domain state, proxy logs, MCP audit, routing decisions, memory, skills- **Schemas**: Zod (MCP tool I/O validation, API contracts)- **Protocols**: MCP (stdio/HTTP) + A2A v0.3 (JSON-RPC 2.0 + SSE)- **Streaming**: Server-Sent Events (SSE)@@ -2202,22 +2207,24 @@ Se não quiser criar credenciais próprias agora, ainda é possível usar o flux## 📖 Documentation-| Document | Description |-| ----------------------------------------------- | --------------------------------------------------- |-| [User Guide](docs/USER_GUIDE.md) | Providers, combos, CLI integration, deployment |-| [API Reference](docs/API_REFERENCE.md) | All endpoints with examples |-| [MCP Server](open-sse/mcp-server/README.md) | 25 MCP tools, IDE configs, Python/TS/Go clients |-| [A2A Server](src/lib/a2a/README.md) | JSON-RPC 2.0 protocol, skills, streaming, task mgmt |-| [Auto-Combo Engine](docs/auto-combo.md) | 6-factor scoring, mode packs, self-healing |-| [Context Relay](docs/features/context-relay.md) | Session handoff strategy for account rotation |-| [Troubleshooting](docs/TROUBLESHOOTING.md) | Common problems and solutions |-| [Architecture](docs/ARCHITECTURE.md) | System architecture and internals |-| [Contributing](CONTRIBUTING.md) | Development setup and guidelines |-| [OpenAPI Spec](docs/openapi.yaml) | OpenAPI 3.0 specification |-| [Security Policy](SECURITY.md) | Vulnerability reporting and security practices |-| [VM Deployment](docs/VM_DEPLOYMENT_GUIDE.md) | Complete guide: VM + nginx + Cloudflare setup |-| [Features Gallery](docs/FEATURES.md) | Visual dashboard tour with screenshots |-| [Release Checklist](docs/RELEASE_CHECKLIST.md) | Pre-release validation steps |+| Document | Description |+| -------------------------------------------------------- | --------------------------------------------------- |+| [User Guide](docs/USER_GUIDE.md) | Providers, combos, CLI integration, deployment |+| [API Reference](docs/API_REFERENCE.md) | All endpoints with examples |+| [MCP Server](open-sse/mcp-server/README.md) | 25 MCP tools, IDE configs, Python/TS/Go clients |+| [A2A Server](src/lib/a2a/README.md) | JSON-RPC 2.0 protocol, skills, streaming, task mgmt |+| [Auto-Combo Engine](docs/auto-combo.md) | 6-factor scoring, mode packs, self-healing |+| [Context Relay](docs/features/context-relay.md) | Session handoff strategy for account rotation |+| [Troubleshooting](docs/TROUBLESHOOTING.md) | Common problems and solutions |+| [Architecture](docs/ARCHITECTURE.md) | System architecture and internals |+| [Codebase Documentation](docs/CODEBASE_DOCUMENTATION.md) | Beginner-friendly codebase walkthrough |+| [Uninstall Guide](docs/UNINSTALL.md) | Clean removal for all install methods |+| [Contributing](CONTRIBUTING.md) | Development setup and guidelines |+| [OpenAPI Spec](docs/openapi.yaml) | OpenAPI 3.0 specification |+| [Security Policy](SECURITY.md) | Vulnerability reporting and security practices |+| [VM Deployment](docs/VM_DEPLOYMENT_GUIDE.md) | Complete guide: VM + nginx + Cloudflare setup |+| [Features Gallery](docs/FEATURES.md) | Visual dashboard tour with screenshots |+| [Release Checklist](docs/RELEASE_CHECKLIST.md) | Pre-release validation steps |---diff --git a/docs/API_REFERENCE.md b/docs/API_REFERENCE.mdindex 62ef788305..376ceecacf 100644--- a/docs/API_REFERENCE.md+++ b/docs/API_REFERENCE.md@@ -320,15 +320,38 @@ These endpoints mirror Gemini's API format for clients that expect native Gemini### Internal / System APIs-| Endpoint | Method | Description |-| --------------- | ------ | ---------------------------------------------------- |-| `/api/init` | GET | Application initialization check (used on first run) |-| `/api/tags` | GET | Ollama-compatible model tags (for Ollama clients) |-| `/api/restart` | POST | Trigger graceful server restart |-| `/api/shutdown` | POST | Trigger graceful server shutdown |+| Endpoint | Method | Description |+| ------------------------ | ------ | ---------------------------------------------------- |+| `/api/init` | GET | Application initialization check (used on first run) |+| `/api/tags` | GET | Ollama-compatible model tags (for Ollama clients) |+| `/api/restart` | POST | Trigger graceful server restart |+| `/api/shutdown` | POST | Trigger graceful server shutdown |+| `/api/system/env/repair` | POST | Repair OAuth provider environment variables |+| `/api/system-info` | GET | Generate system diagnostics report |> **Note:** These endpoints are used internally by the system or for Ollama client compatibility. They are not typically called by end users.+### OAuth Environment Repair _(v3.6.1+)_++```bash+POST /api/system/env/repair+Content-Type: application/json++{+ "provider": "claude-code"+}+```++Repairs missing or corrupted OAuth environment variables for a specific provider. Returns:++```json+{+ "success": true,+ "repaired": ["CLAUDE_CODE_OAUTH_CLIENT_ID", "CLAUDE_CODE_OAUTH_CLIENT_SECRET"],+ "backupPath": "/home/user/.omniroute/backups/env-repair-2026-04-11.bak"+}+```+---## Audio Transcriptiondiff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.mdindex 05dbce91d9..ad579d7bc3 100644--- a/docs/ARCHITECTURE.md+++ b/docs/ARCHITECTURE.md@@ -2,7 +2,7 @@🌐 **Languages:** 🇺🇸 [English](ARCHITECTURE.md) | 🇧🇷 [Português (Brasil)](i18n/pt-BR/ARCHITECTURE.md) | 🇪🇸 [Español](i18n/es/ARCHITECTURE.md) | 🇫🇷 [Français](i18n/fr/ARCHITECTURE.md) | 🇮🇹 [Italiano](i18n/it/ARCHITECTURE.md) | 🇷🇺 [Русский](i18n/ru/ARCHITECTURE.md) | 🇨🇳 [中文 (简体)](i18n/zh-CN/ARCHITECTURE.md) | 🇩🇪 [Deutsch](i18n/de/ARCHITECTURE.md) | 🇮🇳 [हिन्दी](i18n/in/ARCHITECTURE.md) | 🇹🇭 [ไทย](i18n/th/ARCHITECTURE.md) | 🇺🇦 [Українська](i18n/uk-UA/ARCHITECTURE.md) | 🇸🇦 [العربية](i18n/ar/ARCHITECTURE.md) | 🇯🇵 [日本語](i18n/ja/ARCHITECTURE.md) | 🇻🇳 [Tiếng Việt](i18n/vi/ARCHITECTURE.md) | 🇧🇬 [Български](i18n/bg/ARCHITECTURE.md) | 🇩🇰 [Dansk](i18n/da/ARCHITECTURE.md) | 🇫🇮 [Suomi](i18n/fi/ARCHITECTURE.md) | 🇮🇱 [עברית](i18n/he/ARCHITECTURE.md) | 🇭🇺 [Magyar](i18n/hu/ARCHITECTURE.md) | 🇮🇩 [Bahasa Indonesia](i18n/id/ARCHITECTURE.md) | 🇰🇷 [한국어](i18n/ko/ARCHITECTURE.md) | 🇲🇾 [Bahasa Melayu](i18n/ms/ARCHITECTURE.md) | 🇳🇱 [Nederlands](i18n/nl/ARCHITECTURE.md) | 🇳🇴 [Norsk](i18n/no/ARCHITECTURE.md) | 🇵🇹 [Português (Portugal)](i18n/pt/ARCHITECTURE.md) | 🇷🇴 [Română](i18n/ro/ARCHITECTURE.md) | 🇵🇱 [Polski](i18n/pl/ARCHITECTURE.md) | 🇸🇰 [Slovenčina](i18n/sk/ARCHITECTURE.md) | 🇸🇪 [Svenska](i18n/sv/ARCHITECTURE.md) | 🇵🇭 [Filipino](i18n/phi/ARCHITECTURE.md) | 🇨🇿 [Čeština](i18n/cs/ARCHITECTURE.md)-_Last updated: 2026-03-28_+_Last updated: 2026-04-11_## Executive Summary@@ -11,18 +11,25 @@ It provides a single OpenAI-compatible endpoint (`/v1/*`) and routes traffic acrCore capabilities:-- OpenAI-compatible API surface for CLI/tools (28 providers)+- OpenAI-compatible API surface for CLI/tools (60+ providers, 16 executors)- Request/response translation across provider formats- Model combo fallback (multi-model sequence)- Account-level fallback (multi-account per provider)-- OAuth + API-key provider connection management+- OAuth + API-key provider connection management (13 OAuth modules)- Embedding generation via `/v1/embeddings` (6 providers, 9 models)-- Image generation via `/v1/images/generations` (4 providers, 9 models)+- Image generation via `/v1/images/generations` (10+ providers, 20+ models)+- Audio transcription via `/v1/audio/transcriptions` (7 providers)+- Text-to-speech via `/v1/audio/speech` (10 providers)+- Video generation via `/v1/videos/generations` (ComfyUI + SD WebUI)+- Music generation via `/v1/music/generations` (ComfyUI)+- Web search via `/v1/search` (5 providers)+- Moderations via `/v1/moderations`+- Reranking via `/v1/rerank`- Think tag parsing (`<think>...</think>`) for reasoning models- Response sanitization for strict OpenAI SDK compatibility- Role normalization (developer→system, system→user) for cross-provider compatibility- Structured output conversion (json_schema → Gemini responseSchema)-- Local persistence for providers, keys, aliases, combos, settings, pricing+- Local persistence for providers, keys, aliases, combos, settings, pricing (26 DB modules)- Usage/cost tracking and request logging- Optional cloud sync for multi-device/state sync- IP allowlist/blocklist for API access control@@ -42,7 +49,16 @@ Core capabilities:- Compliance audit logging with opt-out per API key- Eval framework for LLM quality assurance- Resilience UI dashboard with real-time circuit breaker status-- Modular OAuth providers (12 individual modules under `src/lib/oauth/providers/`)+- MCP Server (25 tools) with 3 transports (stdio/SSE/Streamable HTTP)+- A2A Server (JSON-RPC 2.0 + SSE) with skills and task lifecycle+- Memory system (extraction, injection, retrieval, summarization)+- Skills system (registry, executor, sandbox, built-in skills)+- MITM proxy with certificate management and DNS handling+- Prompt injection guard middleware+- ACP (Agent Communication Protocol) registry+- Modular OAuth providers (13 individual modules under `src/lib/oauth/providers/`)+- Uninstall/full-uninstall scripts+- OAuth environment repair actionPrimary runtime model:@@ -240,7 +256,7 @@ Domain layer modules:- Eval runner: `src/lib/domain/evalRunner.ts`- Domain state persistence: `src/lib/db/domainState.ts` — SQLite CRUD for fallback chains, budgets, cost history, lockout state, circuit breakers-OAuth provider modules (12 individual files under `src/lib/oauth/providers/`):+OAuth provider modules (13 individual files under `src/lib/oauth/providers/`):- Registry index: `src/lib/oauth/providers/index.ts`- Individual providers: `claude.ts`, `codex.ts`, `gemini.ts`, `antigravity.ts`, `qoder.ts`, `qwen.ts`, `kimi-coding.ts`, `github.ts`, `kiro.ts`, `cursor.ts`, `kilocode.ts`, `cline.ts`@@ -615,15 +631,22 @@ flowchart LREach provider has a specialized executor extending `BaseExecutor` (in `open-sse/executors/base.ts`), which provides URL building, header construction, retry with exponential backoff, credential refresh hooks, and the `execute()` orchestration method.-| Executor | Provider(s) | Special Handling |-| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------- |-| `DefaultExecutor` | OpenAI, Claude, Gemini, Qwen, Qoder, OpenRouter, GLM, Kimi, MiniMax, DeepSeek, Groq, xAI, Mistral, Perplexity, Together, Fireworks, Cerebras, Cohere, NVIDIA | Dynamic URL/header config per provider |-| `AntigravityExecutor` | Google Antigravity | Custom project/session IDs, Retry-After parsing |-| `CodexExecutor` | OpenAI Codex | Injects system instructions, forces reasoning effort |-| `CursorExecutor` | Cursor IDE | ConnectRPC protocol, Protobuf encoding, request signing via checksum |-| `GithubExecutor` | GitHub Copilot | Copilot token refresh, VSCode-mimicking headers |-| `KiroExecutor` | AWS CodeWhisperer/Kiro | AWS EventStream binary format → SSE conversion |-| `GeminiCLIExecutor` | Gemini CLI | Google OAuth token refresh cycle |+| Executor | Provider(s) | Special Handling |+| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- |+| `DefaultExecutor` | OpenAI, Claude, Gemini, Qwen, OpenRouter, GLM, Kimi, MiniMax, DeepSeek, Groq, xAI, Mistral, Perplexity, Together, Fireworks, Cerebras, Cohere, NVIDIA, etc. | Dynamic URL/header config per provider |+| `AntigravityExecutor` | Google Antigravity | Custom project/session IDs, Retry-After parsing |+| `CliProxyApiExecutor` | CLIProxyAPI-compatible providers | Custom auth and protocol handling |+| `CloudflareAiExecutor` | Cloudflare Workers AI | Account ID injection, Neurons-based usage tracking |+| `CodexExecutor` | OpenAI Codex | Injects system instructions, forces reasoning effort |+| `CursorExecutor` | Cursor IDE | ConnectRPC protocol, Protobuf encoding, request signing via checksum |+| `GithubExecutor` | GitHub Copilot | Copilot token refresh, VSCode-mimicking headers |+| `GeminiCLIExecutor` | Gemini CLI | Google OAuth token refresh cycle |+| `KiroExecutor` | AWS CodeWhisperer/Kiro | AWS EventStream binary format → SSE conversion |+| `OpenCodeExecutor` | OpenCode | AI SDK compatible provider setup |+| `PollinationsExecutor` | Pollinations AI | No API key required, rate-limited requests |+| `PuterExecutor` | Puter | Browser-based provider integration |+| `QoderExecutor` | Qoder AI | PAT and OAuth support, multi-model free tier |+| `VertexExecutor` | Google Vertex AI | Service account auth, region-based endpoints |All other providers (including custom compatible nodes) use the `DefaultExecutor`.@@ -641,7 +664,10 @@ All other providers (including custom compatible nodes) use the `DefaultExecutor| Cursor | cursor | Custom checksum | ✅ | ✅ | ❌ | ❌ || Kiro | kiro | AWS SSO OIDC | ✅ (EventStream) | ❌ | ✅ | ✅ Usage limits || Qwen | openai | OAuth | ✅ | ✅ | ✅ | ⚠️ Per request |-| Qoder | openai | OAuth (Basic) | ✅ | ✅ | ✅ | ⚠️ Per request |+| Qoder | openai | OAuth / PAT | ✅ | ✅ | ✅ | ⚠️ Per request |+| Kilo Code | openai | OAuth | ✅ | ✅ | ✅ | ❌ |+| Cline | openai | OAuth | ✅ | ✅ | ✅ | ❌ |+| Kimi Coding | openai | OAuth | ✅ | ✅ | ✅ | ❌ || OpenRouter | openai | API Key | ✅ | ✅ | ❌ | ❌ || GLM/Kimi/MiniMax | claude | API Key | ✅ | ✅ | ❌ | ❌ || DeepSeek | openai | API Key | ✅ | ✅ | ❌ | ❌ |@@ -654,6 +680,17 @@ All other providers (including custom compatible nodes) use the `DefaultExecutor| Cerebras | openai | API Key | ✅ | ✅ | ❌ | ❌ || Cohere | openai | API Key | ✅ | ✅ | ❌ | ❌ || NVIDIA NIM | openai | API Key | ✅ | ✅ | ❌ | ❌ |+| Cloudflare AI | openai | API Token + Acct ID | ✅ | ✅ | ❌ | ❌ |+| Pollinations | openai | None (no key) | ✅ | ✅ | ❌ | ❌ |+| Scaleway AI | openai | API Key | ✅ | ✅ | ❌ | ❌ |+| LongCat | openai | API Key | ✅ | ✅ | ❌ | ❌ |+| Ollama Cloud | openai | API Key (optional) | ✅ | ✅ | ❌ | ❌ |+| HuggingFace | openai | API Key | ✅ | ✅ | ❌ | ❌ |+| Nebius | openai | API Key | ✅ | ✅ | ❌ | ❌ |+| SiliconFlow | openai | API Key | ✅ | ✅ | ❌ | ❌ |+| Hyperbolic | openai | API Key | ✅ | ✅ | ❌ | ❌ |+| Vertex AI | gemini | Service Account | ✅ | ✅ | ✅ | ⚠️ Cloud Console |+| Puter | openai | API Key | ✅ | ✅ | ❌ | ❌ |## Format Translation Coveragediff --git a/docs/FEATURES.md b/docs/FEATURES.mdindex a22f111002..a6d4b4b3b7 100644--- a/docs/FEATURES.md+++ b/docs/FEATURES.md@@ -97,6 +97,7 @@ Dashboard for discovering and managing CLI agents. Shows a grid of 14 built-in aA combo strategy that preserves session continuity when account rotation happens mid-conversation. Before the active account is exhausted, OmniRoute generates a structured handoff summary in the background. After the next request resolves to a different account, the summary is injected as a system message so the new account continues with full context.Configurable via combo-level or global settings:+- **Handoff Threshold** — Quota usage percentage that triggers summary generation (default 85%)- **Max Messages For Summary** — How much recent history to condense- **Summary Model** — Optional override model for generating the handoff summary@@ -116,6 +117,43 @@ Comprehensive proxy configuration enforcement across the entire request pipeline---+## 📧 Email Privacy Masking _(v3.5.6+)_++OAuth account emails are now masked in the provider dashboard (e.g. `di*****@g****.com`) to prevent accidental exposure when sharing screenshots or recording demos. The full email address remains accessible via hover tooltip (`title` attribute).++---++## 👁️ Model Visibility Toggle _(v3.5.6+)_++The provider page model list now includes:++- **Real-time search/filter bar** — Quickly find specific models+- **Per-model visibility toggle** (👁 icon) — Hidden models are grayed out and excluded from the `/v1/models` catalog+- **Active-count badge** (`N/M active`) — Shows at a glance how many models are enabled vs total++---++## 🔧 OAuth Env Repair _(v3.6.1+)_++One-click "Repair env" action for OAuth providers that restores missing environment variables and fixes broken auth state. Accessible from `Dashboard → Providers → [OAuth Provider] → Repair env`. Automatically detects and repairs:++- Missing OAuth client credentials+- Corrupted env file entries+- Backup path sanitization++---++## 🗑️ Uninstall / Full Uninstall _(v3.6.2+)_++Clean removal scripts for all installation methods:++| Command | Action |+| ------------------------ | ----------------------------------------------------------------------------------- |+| `npm run uninstall` | Removes the system app but **keeps your DB and configurations** in `~/.omniroute`. |+| `npm run uninstall:full` | Removes the app AND permanently **erases all configurations, keys, and databases**. |++---+## 🖼️ Media _(v2.0.3+)_Generate images, videos, and music from the dashboard. Supports OpenAI, xAI, Together, Hyperbolic, SD WebUI, ComfyUI, AnimateDiff, Stable Audio Open, and MusicGen.@@ -163,5 +201,6 @@ Key features:- Auto-update on restart- Platform-conditional UI (macOS traffic lights, Windows/Linux default titlebar)- Hardened Electron build packaging — symlinked `node_modules` in the standalone bundle is detected and rejected before packaging, preventing runtime dependency on the build machine (v2.5.5+)+- **Graceful shutdown** — Electron `before-quit` shuts down Next.js cleanly, preventing SQLite WAL database locks (v3.6.2+)📖 See [`electron/README.md`](../electron/README.md) for full documentation.diff --git a/docs/openapi.yaml b/docs/openapi.yamlindex c427c9781c..d59d535a0d 100644--- a/docs/openapi.yaml+++ b/docs/openapi.yaml@@ -1,7 +1,7 @@openapi: 3.1.0info:title: OmniRoute API- version: 3.6.1+ version: 3.6.2description: |OmniRoute is a local-first AI API proxy router. It provides an OpenAI-compatibleendpoint that routes requests to multiple AI providers with load balancing,diff --git a/open-sse/config/providerRegistry.ts b/open-sse/config/providerRegistry.tsindex d36f9b0a1a..21aa1586be 100644--- a/open-sse/config/providerRegistry.ts+++ b/open-sse/config/providerRegistry.ts@@ -102,6 +102,102 @@ const KIMI_CODING_SHARED = {] as RegistryModel[],} as const;+const buildModels = (ids: readonly string[]): RegistryModel[] =>+ ids.map((id) => ({ id, name: id }));++const CHAT_OPENAI_COMPAT_MODELS: Record<string, RegistryModel[]> = {+ deepinfra: buildModels([+ "Qwen/Qwen3-Coder-480B-A35B-Instruct",+ "deepseek-ai/DeepSeek-R1",+ "meta-llama/Llama-3.3-70B-Instruct",+ "anthropic/claude-4-sonnet",+ ]),+ "vercel-ai-gateway": buildModels([+ "openai/gpt-4.1",+ "anthropic/claude-4-sonnet",+ "google/gemini-2.5-pro",+ "moonshotai/kimi-k2",+ "vercel/v0-1.5-md",+ ]),+ "lambda-ai": buildModels([+ "deepseek-r1-671b",+ "llama3.3-70b-instruct-fp8",+ "qwen25-coder-32b-instruct",+ ]),+ sambanova: buildModels([+ "DeepSeek-V3.1",+ "Llama-4-Maverick-17B-128E-Instruct",+ "Qwen3-32B",+ "gpt-oss-120b",+ ]),+ nscale: buildModels([+ "Qwen/QwQ-32B",+ "deepseek-ai/DeepSeek-R1-Distill-Qwen-32B",+ "meta-llama/Llama-3.3-70B-Instruct",+ ]),+ ovhcloud: buildModels([+ "Meta-Llama-3_3-70B-Instruct",+ "Qwen2.5-Coder-32B-Instruct",+ "Mistral-Small-3.2-24B-Instruct-2506",+ ]),+ baseten: buildModels(["moonshotai/Kimi-K2.5", "zai-org/GLM-5", "deepseek-ai/DeepSeek-V3.1"]),+ publicai: buildModels([+ "swiss-ai/apertus-70b-instruct",+ "aisingapore/Qwen-SEA-LION-v4-32B-IT",+ "allenai/Olmo-3-32B-Think",+ ]),+ moonshot: buildModels(["kimi-k2.5", "kimi-latest", "moonshot-v1-auto"]),+ "meta-llama": buildModels([+ "Llama-3.3-70B-Instruct",+ "Llama-4-Maverick-17B-128E-Instruct-FP8",+ "Llama-4-Scout-17B-16E-Instruct-FP8",+ ]),+ "v0-vercel": buildModels(["v0-1.0-md", "v0-1.5-lg", "v0-1.5-md"]),+ morph: buildModels(["morph-v3-fast", "morph-v3-large"]),+ "featherless-ai": buildModels(["featherless-ai/Qwerky-72B", "featherless-ai/Qwerky-QwQ-32B"]),+ friendliai: buildModels(["meta-llama-3.1-70b-instruct", "meta-llama-3.1-8b-instruct"]),+ llamagate: buildModels(["qwen2.5-coder-7b", "deepseek-coder-6.7b", "qwen3-vl-8b"]),+ heroku: buildModels(["claude-3-5-sonnet-latest", "claude-4-sonnet"]),+ galadriel: buildModels(["galadriel-latest"]),+ databricks: buildModels([+ "databricks-gpt-5",+ "databricks-meta-llama-3-3-70b-instruct",+ "databricks-claude-sonnet-4",+ "databricks-gemini-2-5-pro",+ ]),+ snowflake: buildModels(["llama3.1-70b", "llama3.3-70b", "deepseek-r1", "claude-3-5-sonnet"]),+ wandb: buildModels([+ "openai/gpt-oss-120b",+ "Qwen/Qwen3-Coder-480B-A35B-Instruct",+ "deepseek-ai/DeepSeek-V3.1",+ ]),+ volcengine: buildModels([+ "deepseek-v3-2-251201",+ "doubao-seed-2-0-code-preview-260215",+ "kimi-k2-thinking-251104",+ "glm-4-7-251222",+ ]),+ ai21: buildModels(["jamba-large-1.7", "jamba-mini-1.7", "jamba-1.5-large"]),+ gigachat: buildModels(["GigaChat-2-Max", "GigaChat-2-Pro", "GigaChat-2-Lite"]),+ venice: buildModels(["venice-latest"]),+ codestral: buildModels(["codestral-2405", "codestral-latest"]),+ upstage: buildModels(["solar-pro", "solar-mini", "solar-docvision", "solar-embedding-1-large"]),+ maritalk: buildModels(["sabia-3", "sabia-3-small"]),+ "xiaomi-mimo": buildModels(["MiMo-7B-RL", "MiMo-7B-SFT"]),+ "inference-net": buildModels([+ "meta-llama/Llama-3.3-70B-Instruct",+ "deepseek-ai/DeepSeek-R1",+ "Qwen/Qwen2.5-72B-Instruct",+ ]),+ nanogpt: buildModels(["chatgpt-4o-latest", "claude-3.5-sonnet", "gpt-4o-mini"]),+ predibase: buildModels(["llama-3.3-70b"]),+ bytez: buildModels([+ "meta-llama/Llama-3.3-70B-Instruct",+ "mistralai/Mistral-7B-Instruct-v0.3",+ "Qwen/Qwen2.5-72B-Instruct",+ ]),+};+function mapStainlessOs() {switch (platform()) {case "darwin":@@ -1404,6 +1500,358 @@ export const REGISTRY: Record<string, RegistryEntry> = {],},+ deepinfra: {+ id: "deepinfra",+ alias: "deepinfra",+ format: "openai",+ executor: "default",+ baseUrl: "https://api.deepinfra.com/v1/openai/chat/completions",+ authType: "apikey",+ authHeader: "bearer",+ models: CHAT_OPENAI_COMPAT_MODELS.deepinfra,+ },++ "vercel-ai-gateway": {+ id: "vercel-ai-gateway",+ alias: "vag",+ format: "openai",+ executor: "default",+ baseUrl: "https://ai-gateway.vercel.sh/v1/chat/completions",+ authType: "apikey",+ authHeader: "bearer",+ models: CHAT_OPENAI_COMPAT_MODELS["vercel-ai-gateway"],+ },++ "lambda-ai": {+ id: "lambda-ai",+ alias: "lambda",+ format: "openai",+ executor: "default",+ baseUrl: "https://api.lambda.ai/v1/chat/completions",+ authType: "apikey",+ authHeader: "bearer",+ models: CHAT_OPENAI_COMPAT_MODELS["lambda-ai"],+ },++ sambanova: {+ id: "sambanova",+ alias: "samba",+ format: "openai",+ executor: "default",+ baseUrl: "https://api.sambanova.ai/v1/chat/completions",+ authType: "apikey",+ authHeader: "bearer",+ models: CHAT_OPENAI_COMPAT_MODELS.sambanova,+ },++ nscale: {+ id: "nscale",+ alias: "nscale",+ format: "openai",+ executor: "default",+ baseUrl: "https://inference.api.nscale.com/v1/chat/completions",+ authType: "apikey",+ authHeader: "bearer",+ models: CHAT_OPENAI_COMPAT_MODELS.nscale,+ },++ ovhcloud: {+ id: "ovhcloud",+ alias: "ovh",+ format: "openai",+ executor: "default",+ baseUrl: "https://oai.endpoints.kepler.ai.cloud.ovh.net/v1/chat/completions",+ authType: "apikey",+ authHeader: "bearer",+ models: CHAT_OPENAI_COMPAT_MODELS.ovhcloud,+ },++ baseten: {+ id: "baseten",+ alias: "baseten",+ format: "openai",+ executor: "default",+ baseUrl: "https://inference.baseten.co/v1/chat/completions",+ authType: "apikey",+ authHeader: "bearer",+ models: CHAT_OPENAI_COMPAT_MODELS.baseten,+ },++ publicai: {+ id: "publicai",+ alias: "publicai",+ format: "openai",+ executor: "default",+ baseUrl: "https://api.publicai.co/v1/chat/completions",+ authType: "apikey",+ authHeader: "bearer",+ models: CHAT_OPENAI_COMPAT_MODELS.publicai,+ },++ moonshot: {+ id: "moonshot",+ alias: "moonshot",+ format: "openai",+ executor: "default",+ baseUrl: "https://api.moonshot.ai/v1/chat/completions",+ authType: "apikey",+ authHeader: "bearer",+ models: CHAT_OPENAI_COMPAT_MODELS.moonshot,+ },++ "meta-llama": {+ id: "meta-llama",+ alias: "meta",+ format: "openai",+ executor: "default",+ baseUrl: "https://api.llama.com/compat/v1/chat/completions",+ authType: "apikey",+ authHeader: "bearer",+ models: CHAT_OPENAI_COMPAT_MODELS["meta-llama"],+ },++ "v0-vercel": {+ id: "v0-vercel",+ alias: "v0",+ format: "openai",+ executor: "default",+ baseUrl: "https://api.v0.dev/v1/chat/completions",+ authType: "apikey",+ authHeader: "bearer",+ models: CHAT_OPENAI_COMPAT_MODELS["v0-vercel"],+ },++ morph: {+ id: "morph",+ alias: "morph",+ format: "openai",+ executor: "default",+ baseUrl: "https://api.morphllm.com/v1/chat/completions",+ authType: "apikey",+ authHeader: "bearer",+ models: CHAT_OPENAI_COMPAT_MODELS.morph,+ },++ "featherless-ai": {+ id: "featherless-ai",+ alias: "featherless",+ format: "openai",+ executor: "default",+ baseUrl: "https://api.featherless.ai/v1/chat/completions",+ authType: "apikey",+ authHeader: "bearer",+ models: CHAT_OPENAI_COMPAT_MODELS["featherless-ai"],+ },++ friendliai: {+ id: "friendliai",+ alias: "friendli",+ format: "openai",+ executor: "default",+ baseUrl: "https://api.friendli.ai/dedicated/v1/chat/completions",+ authType: "apikey",+ authHeader: "bearer",+ models: CHAT_OPENAI_COMPAT_MODELS.friendliai,+ },++ llamagate: {+ id: "llamagate",+ alias: "llamagate",+ format: "openai",+ executor: "default",+ baseUrl: "https://llamagate.ai/v1/chat/completions",+ authType: "apikey",+ authHeader: "bearer",+ models: CHAT_OPENAI_COMPAT_MODELS.llamagate,+ },++ heroku: {+ id: "heroku",+ alias: "heroku",+ format: "openai",+ executor: "default",+ baseUrl: "https://us.inference.heroku.com/v1/chat/completions",+ authType: "apikey",+ authHeader: "bearer",+ models: CHAT_OPENAI_COMPAT_MODELS.heroku,+ },++ galadriel: {+ id: "galadriel",+ alias: "galadriel",+ format: "openai",+ executor: "default",+ baseUrl: "https://api.galadriel.ai/v1/chat/completions",+ authType: "apikey",+ authHeader: "bearer",+ models: CHAT_OPENAI_COMPAT_MODELS.galadriel,+ },++ databricks: {+ id: "databricks",+ alias: "databricks",+ format: "openai",+ executor: "default",+ baseUrl: "https://adb-0000000000000000.0.azuredatabricks.net/serving-endpoints",+ authType: "apikey",+ authHeader: "bearer",+ models: CHAT_OPENAI_COMPAT_MODELS.databricks,+ },++ snowflake: {+ id: "snowflake",+ alias: "snowflake",+ format: "openai",+ executor: "default",+ baseUrl: "https://example-account.snowflakecomputing.com/api/v2",+ authType: "apikey",+ authHeader: "bearer",+ models: CHAT_OPENAI_COMPAT_MODELS.snowflake,+ },++ wandb: {+ id: "wandb",+ alias: "wandb",+ format: "openai",+ executor: "default",+ baseUrl: "https://api.inference.wandb.ai/v1/chat/completions",+ authType: "apikey",+ authHeader: "bearer",+ models: CHAT_OPENAI_COMPAT_MODELS.wandb,+ },++ volcengine: {+ id: "volcengine",+ alias: "volcengine",+ format: "openai",+ executor: "default",+ baseUrl: "https://ark.cn-beijing.volces.com/api/v3/chat/completions",+ authType: "apikey",+ authHeader: "bearer",+ models: CHAT_OPENAI_COMPAT_MODELS.volcengine,+ },++ ai21: {+ id: "ai21",+ alias: "ai21",+ format: "openai",+ executor: "default",+ baseUrl: "https://api.ai21.com/studio/v1/chat/completions",+ authType: "apikey",+ authHeader: "bearer",+ models: CHAT_OPENAI_COMPAT_MODELS.ai21,+ },++ gigachat: {+ id: "gigachat",+ alias: "gigachat",+ format: "openai",+ executor: "default",+ baseUrl: "https://gigachat.devices.sberbank.ru/api/v1",+ authType: "apikey",+ authHeader: "bearer",+ models: CHAT_OPENAI_COMPAT_MODELS.gigachat,+ },++ venice: {+ id: "venice",+ alias: "venice",+ format: "openai",+ executor: "default",+ baseUrl: "https://api.venice.ai/api/v1/chat/completions",+ authType: "apikey",+ authHeader: "bearer",+ models: CHAT_OPENAI_COMPAT_MODELS.venice,+ },++ codestral: {+ id: "codestral",+ alias: "codestral",+ format: "openai",+ executor: "default",+ baseUrl: "https://codestral.mistral.ai/v1/chat/completions",+ authType: "apikey",+ authHeader: "bearer",+ models: CHAT_OPENAI_COMPAT_MODELS.codestral,+ },++ upstage: {+ id: "upstage",+ alias: "upstage",+ format: "openai",+ executor: "default",+ baseUrl: "https://api.upstage.ai/v1/chat/completions",+ authType: "apikey",+ authHeader: "bearer",+ models: CHAT_OPENAI_COMPAT_MODELS.upstage,+ },++ maritalk: {+ id: "maritalk",+ alias: "maritalk",+ format: "openai",+ executor: "default",+ baseUrl: "https://chat.maritaca.ai/api/chat/inference",+ authType: "apikey",+ authHeader: "bearer",+ models: CHAT_OPENAI_COMPAT_MODELS.maritalk,+ },++ "xiaomi-mimo": {+ id: "xiaomi-mimo",+ alias: "mimo",+ format: "openai",+ executor: "default",+ baseUrl: "https://api.xiaomi.com/v1/chat/completions",+ authType: "apikey",+ authHeader: "bearer",+ models: CHAT_OPENAI_COMPAT_MODELS["xiaomi-mimo"],+ },++ "inference-net": {+ id: "inference-net",+ alias: "inet",+ format: "openai",+ executor: "default",+ baseUrl: "https://api.inference.net/v1/chat/completions",+ authType: "apikey",+ authHeader: "bearer",+ models: CHAT_OPENAI_COMPAT_MODELS["inference-net"],+ },++ nanogpt: {+ id: "nanogpt",+ alias: "nanogpt",+ format: "openai",+ executor: "default",+ baseUrl: "https://nano-gpt.com/api/v1/chat/completions",+ authType: "apikey",+ authHeader: "bearer",+ models: CHAT_OPENAI_COMPAT_MODELS.nanogpt,+ },++ predibase: {+ id: "predibase",+ alias: "predibase",+ format: "openai",+ executor: "default",+ baseUrl: "https://serving.app.predibase.com/v1/chat/completions",+ authType: "apikey",+ authHeader: "bearer",+ models: CHAT_OPENAI_COMPAT_MODELS.predibase,+ },++ bytez: {+ id: "bytez",+ alias: "bytez",+ format: "openai",+ executor: "default",+ baseUrl: "https://api.bytez.com/models/v2",+ authType: "apikey",+ authHeader: "bearer",+ models: CHAT_OPENAI_COMPAT_MODELS.bytez,+ },+aimlapi: {id: "aimlapi",alias: "aiml",diff --git a/open-sse/executors/base.ts b/open-sse/executors/base.tsindex 8983145c96..33606f19b8 100644--- a/open-sse/executors/base.ts+++ b/open-sse/executors/base.ts@@ -263,13 +263,31 @@ export class BaseExecutor {const fallbackCount = this.getFallbackCount();let lastError: unknown = null;let lastStatus = 0;+ let activeCredentials = credentials;// Track per-URL intra-retry attempts to avoid infinite loopsconst retryAttemptsByUrl: Record<number, number> = {};+ if (this.needsRefresh(credentials)) {+ try {+ const refreshed = await this.refreshCredentials(credentials, log || null);+ if (refreshed) {+ activeCredentials = {+ ...credentials,+ ...refreshed,+ };+ }+ } catch (error) {+ log?.warn?.(+ "TOKEN",+ `Credential refresh failed for ${this.provider}: ${error instanceof Error ? error.message : String(error)}`+ );+ }+ }+for (let urlIndex = 0; urlIndex < fallbackCount; urlIndex++) {- const url = this.buildUrl(model, stream, urlIndex, credentials);- const headers = this.buildHeaders(credentials, stream);- applyConfiguredUserAgent(headers, credentials?.providerSpecificData);+ const url = this.buildUrl(model, stream, urlIndex, activeCredentials);+ const headers = this.buildHeaders(activeCredentials, stream);+ applyConfiguredUserAgent(headers, activeCredentials?.providerSpecificData);// Append 1M context beta header when [1m] suffix was used// Only supported for specific Claude models per Anthropic docs@@ -293,7 +311,7 @@ export class BaseExecutor {}}- const transformedBody = await this.transformRequest(model, body, stream, credentials);+ const transformedBody = await this.transformRequest(model, body, stream, activeCredentials);try {// Apply timeout to all requests. Non-streaming requests need this to preventdiff --git a/open-sse/executors/default.ts b/open-sse/executors/default.tsindex 1d57ac8515..aa55d1ffaf 100644--- a/open-sse/executors/default.ts+++ b/open-sse/executors/default.ts@@ -7,8 +7,43 @@ import {CLAUDE_CODE_COMPATIBLE_DEFAULT_CHAT_PATH,joinClaudeCodeCompatibleUrl,} from "../services/claudeCodeCompatible.ts";+import { getGigachatAccessToken } from "../services/gigachatAuth.ts";import { getOpenAICompatibleType, isClaudeCodeCompatible } from "../services/provider.ts";+function normalizeBaseUrl(baseUrl) {+ return (baseUrl || "").trim().replace(/\/$/, "");+}++function normalizeBailianMessagesUrl(baseUrl) {+ const normalized = normalizeBaseUrl(baseUrl).replace(/\?beta=true$/, "");+ const messagesUrl = normalized.endsWith("/messages") ? normalized : `${normalized}/messages`;+ return `${messagesUrl}?beta=true`;+}++function normalizeHerokuChatUrl(baseUrl) {+ const normalized = normalizeBaseUrl(baseUrl);+ if (normalized.endsWith("/v1/chat/completions")) return normalized;+ return `${normalized}/v1/chat/completions`;+}++function normalizeDatabricksChatUrl(baseUrl) {+ const normalized = normalizeBaseUrl(baseUrl);+ if (normalized.endsWith("/chat/completions")) return normalized;+ return `${normalized}/chat/completions`;+}++function normalizeSnowflakeChatUrl(baseUrl) {+ const normalized = normalizeBaseUrl(baseUrl)+ .replace(/\/cortex\/inference:complete$/, "")+ .replace(/\/api\/v2$/, "");+ return `${normalized}/api/v2/cortex/inference:complete`;+}++function normalizeGigachatChatUrl(baseUrl) {+ const normalized = normalizeBaseUrl(baseUrl).replace(/\/chat\/completions$/, "");+ return `${normalized}/chat/completions`;+}+export class DefaultExecutor extends BaseExecutor {constructor(provider) {super(provider, PROVIDERS[provider] || PROVIDERS.openai);@@ -44,6 +79,26 @@ export class DefaultExecutor extends BaseExecutor {return `${normalized}${customPath || "/messages"}`;}switch (this.provider) {+ case "bailian-coding-plan": {+ const baseUrl = credentials?.providerSpecificData?.baseUrl || this.config.baseUrl;+ return normalizeBailianMessagesUrl(baseUrl);+ }+ case "heroku": {+ const baseUrl = credentials?.providerSpecificData?.baseUrl || this.config.baseUrl;+ return normalizeHerokuChatUrl(baseUrl);+ }+ case "databricks": {+ const baseUrl = credentials?.providerSpecificData?.baseUrl || this.config.baseUrl;+ return normalizeDatabricksChatUrl(baseUrl);+ }+ case "snowflake": {+ const baseUrl = credentials?.providerSpecificData?.baseUrl || this.config.baseUrl;+ return normalizeSnowflakeChatUrl(baseUrl);+ }+ case "gigachat": {+ const baseUrl = credentials?.providerSpecificData?.baseUrl || this.config.baseUrl;+ return normalizeGigachatChatUrl(baseUrl);+ }case "claude":case "glm":case "kimi-coding":@@ -78,6 +133,19 @@ export class DefaultExecutor extends BaseExecutor {? (headers["x-goog-api-key"] = effectiveKey): (headers["Authorization"] = `Bearer ${credentials.accessToken}`);break;+ case "snowflake": {+ const rawToken = effectiveKey || credentials.accessToken || "";+ const usesProgrammaticAccessToken = rawToken.startsWith("pat/");+ headers["Authorization"] =+ `Bearer ${usesProgrammaticAccessToken ? rawToken.slice(4) : rawToken}`;+ headers["X-Snowflake-Authorization-Token-Type"] = usesProgrammaticAccessToken+ ? "PROGRAMMATIC_ACCESS_TOKEN"+ : "KEYPAIR_JWT";+ break;+ }+ case "gigachat":+ headers["Authorization"] = `Bearer ${credentials.accessToken || effectiveKey}`;+ break;case "claude":effectiveKey? (headers["x-api-key"] = effectiveKey)@@ -144,6 +212,17 @@ export class DefaultExecutor extends BaseExecutor {* race-condition protection (deduplication via refreshPromiseCache).*/async refreshCredentials(credentials, log) {+ if (this.provider === "gigachat") {+ if (!credentials.apiKey) return null;+ try {+ return await getGigachatAccessToken({+ credentials: credentials.apiKey,+ });+ } catch (error) {+ log?.error?.("TOKEN", `gigachat refresh error: ${error.message}`);+ return null;+ }+ }if (!credentials.refreshToken) return null;try {return await getAccessToken(this.provider, credentials, log);@@ -152,6 +231,14 @@ export class DefaultExecutor extends BaseExecutor {return null;}}++ needsRefresh(credentials) {+ if (this.provider === "gigachat") {+ if (credentials.apiKey && !credentials.accessToken) return true;+ if (!credentials.expiresAt) return false;+ }+ return super.needsRefresh(credentials);+ }}export default DefaultExecutor;diff --git a/open-sse/services/gigachatAuth.ts b/open-sse/services/gigachatAuth.tsnew file mode 100644index 0000000000..1696acc0e7--- /dev/null+++ b/open-sse/services/gigachatAuth.ts@@ -0,0 +1,113 @@+import { randomUUID } from "crypto";++type GigachatTokenResult = {+ accessToken: string;+ expiresAt: string;+};++type GigachatTokenOptions = {+ credentials?: string | null;+ scope?: string;+ authUrl?: string;+ signal?: AbortSignal;+};++const DEFAULT_GIGACHAT_AUTH_URL = "https://ngw.devices.sberbank.ru:9443/api/v2/oauth";+const DEFAULT_GIGACHAT_SCOPE = "GIGACHAT_API_PERS";+const CACHE_SKEW_MS = 60_000;++const tokenCache = new Map<string, GigachatTokenResult>();+const inflightRequests = new Map<string, Promise<GigachatTokenResult>>();++function getCacheKey(credentials: string, authUrl: string, scope: string) {+ return `${authUrl}::${scope}::${credentials}`;+}++function isFreshToken(token: GigachatTokenResult | undefined) {+ if (!token?.accessToken || !token?.expiresAt) return false;+ const expiresAtMs = new Date(token.expiresAt).getTime();+ return Number.isFinite(expiresAtMs) && expiresAtMs - Date.now() > CACHE_SKEW_MS;+}++function normalizeExpiry(rawExpiry: unknown) {+ if (typeof rawExpiry === "number" && Number.isFinite(rawExpiry)) {+ return new Date(rawExpiry).toISOString();+ }+ if (typeof rawExpiry === "string" && rawExpiry.trim().length > 0) {+ const numericValue = Number(rawExpiry);+ if (Number.isFinite(numericValue)) {+ return new Date(numericValue).toISOString();+ }+ const dateMs = Date.parse(rawExpiry);+ if (Number.isFinite(dateMs)) {+ return new Date(dateMs).toISOString();+ }+ }+ return new Date(Date.now() + 30 * 60 * 1000).toISOString();+}++export async function getGigachatAccessToken(+ options: GigachatTokenOptions = {}+): Promise<GigachatTokenResult> {+ const credentials = (options.credentials || "").trim();+ if (!credentials) {+ throw new Error("Missing GigaChat credentials");+ }++ const authUrl = (options.authUrl || DEFAULT_GIGACHAT_AUTH_URL).trim();+ const scope = (options.scope || DEFAULT_GIGACHAT_SCOPE).trim();+ const cacheKey = getCacheKey(credentials, authUrl, scope);++ const cached = tokenCache.get(cacheKey);+ if (isFreshToken(cached)) {+ return cached;+ }++ const inflight = inflightRequests.get(cacheKey);+ if (inflight) {+ return inflight;+ }++ const requestPromise = (async () => {+ const response = await fetch(authUrl, {+ method: "POST",+ headers: {+ Authorization: `Basic ${credentials}`,+ RqUID: randomUUID(),+ "Content-Type": "application/x-www-form-urlencoded",+ },+ body: new URLSearchParams({ scope }).toString(),+ signal: options.signal,+ });++ if (!response.ok) {+ const bodyText = await response.text();+ throw new Error(`GigaChat token request failed: ${response.status} ${bodyText}`.trim());+ }++ const data = (await response.json()) as Record<string, unknown>;+ const accessToken =+ typeof data.tok === "string"+ ? data.tok+ : typeof data.access_token === "string"+ ? data.access_token+ : "";+ if (!accessToken) {+ throw new Error("GigaChat token response missing access token");+ }++ const token = {+ accessToken,+ expiresAt: normalizeExpiry(data.exp ?? data.expires_at),+ };+ tokenCache.set(cacheKey, token);+ return token;+ })();++ inflightRequests.set(cacheKey, requestPromise);+ try {+ return await requestPromise;+ } finally {+ inflightRequests.delete(cacheKey);+ }+}diff --git a/scripts/uninstall.mjs b/scripts/uninstall.mjsindex 62ebe633bc..d95d47fbef 100644--- a/scripts/uninstall.mjs+++ b/scripts/uninstall.mjs@@ -5,6 +5,9 @@ import { execSync } from "child_process";const args = process.argv.slice(2);const fullUninstall = args.includes("--full");+const uninstallAlreadyInProgress =+ process.env.OMNIROUTE_SKIP_UNINSTALL_HOOK === "1" ||+ process.env.npm_lifecycle_event === "uninstall";console.log("🛑 OmniRoute Uninstaller");console.log("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");@@ -37,13 +40,25 @@ if (fullUninstall) {}// 3. NPM uninstall-console.log("🗑️ Removing npm package...");-try {- execSync("npm uninstall -g omniroute", { stdio: "inherit" });- console.log("\n✅ OmniRoute has been successfully uninstalled from your system.");- if (!fullUninstall) {- console.log(`ℹ️ Your configurations and databases were preserved in ${dataDir}.`);+if (uninstallAlreadyInProgress) {+ console.log("ℹ️ npm uninstall is already in progress. Skipping nested uninstall command.");+} else {+ console.log("🗑️ Removing npm package...");+ try {+ execSync("npm uninstall -g omniroute", {+ stdio: "inherit",+ env: {+ ...process.env,+ OMNIROUTE_SKIP_UNINSTALL_HOOK: "1",+ },+ });+ console.log("\n✅ OmniRoute has been successfully uninstalled from your system.");+ if (!fullUninstall) {+ console.log(`ℹ️ Your configurations and databases were preserved in ${dataDir}.`);+ }+ } catch (error) {+ console.warn(+ "⚠️ Failed to remove npm package. You might need to run this command with 'sudo'."+ );}-} catch (error) {- console.warn("⚠️ Failed to remove npm package. You might need to run this command with 'sudo'.");}diff --git a/src/app/(dashboard)/dashboard/playground/page.tsx b/src/app/(dashboard)/dashboard/playground/page.tsxindex cc3ebd238d..fc20c93135 100644--- a/src/app/(dashboard)/dashboard/playground/page.tsx+++ b/src/app/(dashboard)/dashboard/playground/page.tsx@@ -3,7 +3,8 @@import { useState, useEffect, useCallback, useRef } from "react";import { Card, Button, Select, Badge } from "@/shared/components";import { ALIAS_TO_ID } from "@/shared/constants/providers";-import { pickMaskedDisplayValue } from "@/shared/utils/maskEmail";+import { pickMaskedDisplayValue, pickDisplayValue } from "@/shared/utils/maskEmail";+import useEmailPrivacyStore from "@/store/emailPrivacyStore";import dynamic from "next/dynamic";const Editor = dynamic(() => import("@monaco-editor/react"), { ssr: false });@@ -25,6 +26,7 @@ interface ProviderOption {interface ConnectionOption {id: string;name: string;+ email?: string;provider: string;authType: string;}@@ -255,7 +257,8 @@ export default function PlaygroundPage() {for (const conn of data?.connections || []) {conns.push({id: conn.id,- name: pickMaskedDisplayValue([conn.name, conn.email], conn.id),+ name: conn.name || conn.id,+ email: conn.email,provider: conn.provider,authType: conn.authType || "apiKey",});@@ -459,6 +462,8 @@ export default function PlaygroundPage() {}};+ const emailsVisible = useEmailPrivacyStore((s) => s.emailsVisible);+return (<div className="space-y-5">{/* Info Banner */}@@ -540,7 +545,7 @@ export default function PlaygroundPage() {},...providerConnections.map((c) => ({value: c.id,- label: c.name,+ label: pickDisplayValue([c.name, c.email], emailsVisible, c.id),})),]}className="w-full"diff --git a/src/app/(dashboard)/dashboard/providers/[id]/page.tsx b/src/app/(dashboard)/dashboard/providers/[id]/page.tsxindex c5964b6a57..774cfa9cb4 100644--- a/src/app/(dashboard)/dashboard/providers/[id]/page.tsx+++ b/src/app/(dashboard)/dashboard/providers/[id]/page.tsx@@ -43,7 +43,9 @@ import {type ModelCompatProtocolKey,} from "@/shared/constants/modelCompat";import { resolveManagedModelAlias } from "@/shared/utils/providerModelAliases";-import { maskEmail, pickMaskedDisplayValue } from "@/shared/utils/maskEmail";+import { maskEmail, pickMaskedDisplayValue, pickDisplayValue } from "@/shared/utils/maskEmail";+import useEmailPrivacyStore from "@/store/emailPrivacyStore";+import EmailPrivacyToggle from "@/shared/components/EmailPrivacyToggle";type CompatByProtocolMap = Partial<Record<@@ -2379,9 +2381,12 @@ export default function ProviderDetailPage() {) : (<h1 className="text-3xl font-semibold tracking-tight">{providerInfo.name}</h1>)}- <p className="text-text-muted">- {t("connectionCountLabel", { count: connections.length })}- </p>+ <div className="flex items-center gap-2">+ <p className="text-text-muted">+ {t("connectionCountLabel", { count: connections.length })}+ </p>+ <EmailPrivacyToggle size="md" />+ </div></div></div></div>@@ -2620,7 +2625,11 @@ export default function ProviderDetailPage() {setProxyTarget({level: "key",id: conn.id,- label: pickMaskedDisplayValue([conn.name, conn.email], conn.id),+ label: pickDisplayValue(+ [conn.name, conn.email],+ useEmailPrivacyStore.getState().emailsVisible,+ conn.id+ ),})}hasProxy={!!connProxyMap[conn.id]?.proxy}@@ -2729,7 +2738,11 @@ export default function ProviderDetailPage() {setProxyTarget({level: "key",id: conn.id,- label: pickMaskedDisplayValue([conn.name, conn.email], conn.id),+ label: pickDisplayValue(+ [conn.name, conn.email],+ useEmailPrivacyStore.getState().emailsVisible,+ conn.id+ ),})}hasProxy={!!connProxyMap[conn.id]?.proxy}@@ -4567,9 +4580,11 @@ function ConnectionRow({isExportingCodexAuthFile,}: ConnectionRowProps) {const t = useTranslations("providers");+ const emailsVisible = useEmailPrivacyStore((s) => s.emailsVisible);const displayName = isOAuth- ? pickMaskedDisplayValue(+ ? pickDisplayValue([connection.name, connection.email, connection.displayName],+ emailsVisible,t("oauthAccount")): connection.name;@@ -4928,6 +4943,51 @@ ConnectionRow.propTypes = {isExportingCodexAuthFile: PropTypes.bool,};+const CONFIGURABLE_BASE_URL_PROVIDERS = new Set([+ "bailian-coding-plan",+ "heroku",+ "databricks",+ "snowflake",+]);++const DEFAULT_PROVIDER_BASE_URLS: Record<string, string> = {+ "bailian-coding-plan": "https://coding-intl.dashscope.aliyuncs.com/apps/anthropic/v1",+};++function getProviderBaseUrlDefault(providerId?: string | null) {+ return providerId ? DEFAULT_PROVIDER_BASE_URLS[providerId] || "" : "";+}++function getProviderBaseUrlHint(providerId?: string | null) {+ switch (providerId) {+ case "bailian-coding-plan":+ return "Optional: Custom base URL for bailian-coding-plan provider";+ case "heroku":+ return "Required: paste the Heroku Inference base URL. The app will append /v1/chat/completions.";+ case "databricks":+ return "Required: paste the Databricks serving-endpoints base URL. The app will append /chat/completions.";+ case "snowflake":+ return "Required: paste the Snowflake account base URL. The app will append /api/v2/cortex/inference:complete.";+ default:+ return undefined;+ }+}++function getProviderBaseUrlPlaceholder(providerId?: string | null) {+ switch (providerId) {+ case "bailian-coding-plan":+ return getProviderBaseUrlDefault(providerId);+ case "heroku":+ return "https://us.inference.heroku.com";+ case "databricks":+ return "https://adb-1234567890123456.7.azuredatabricks.net/serving-endpoints";+ case "snowflake":+ return "https://example-account.snowflakecomputing.com";+ default:+ return "";+ }+}+function AddApiKeyModal({isOpen,provider,@@ -4939,8 +4999,8 @@ function AddApiKeyModal({onClose,}: AddApiKeyModalProps) {const t = useTranslations("providers");- const isBailian = provider === "bailian-coding-plan";- const defaultBailianUrl = "https://coding-intl.dashscope.aliyuncs.com/apps/anthropic/v1";+ const usesBaseUrl = CONFIGURABLE_BASE_URL_PROVIDERS.has(provider || "");+ const defaultBaseUrl = getProviderBaseUrlDefault(provider);const isVertex = provider === "vertex";const defaultRegion = "us-central1";const isGlm = provider === "glm";@@ -4950,7 +5010,7 @@ function AddApiKeyModal({name: "",apiKey: "",priority: 1,- baseUrl: isBailian ? defaultBailianUrl : "",+ baseUrl: defaultBaseUrl,region: isVertex ? defaultRegion : "",apiRegion: "international",validationModelId: "",@@ -4992,14 +5052,14 @@ function AddApiKeyModal({setSaving(true);setSaveError(null);try {- let validatedBailianBaseUrl = null;- if (isBailian) {- const checked = normalizeAndValidateHttpBaseUrl(formData.baseUrl, defaultBailianUrl);+ let validatedBaseUrl = null;+ if (usesBaseUrl) {+ const checked = normalizeAndValidateHttpBaseUrl(formData.baseUrl, defaultBaseUrl);if (checked.error) {setSaveError(checked.error);return;}- validatedBailianBaseUrl = checked.value;+ validatedBaseUrl = checked.value;}let isValid = false;@@ -5035,8 +5095,8 @@ function AddApiKeyModal({if (formData.customUserAgent.trim()) {providerSpecificData.customUserAgent = formData.customUserAgent.trim();}- if (isBailian) {- providerSpecificData.baseUrl = validatedBailianBaseUrl;+ if (usesBaseUrl) {+ providerSpecificData.baseUrl = validatedBaseUrl;} else if (isVertex) {providerSpecificData.region = formData.region;} else if (isGlm) {@@ -5173,13 +5233,13 @@ function AddApiKeyModal({setFormData({ ...formData, priority: Number.parseInt(e.target.value) || 1 })}/>- {isBailian && (+ {usesBaseUrl && (<Inputlabel="Base URL"value={formData.baseUrl}onChange={(e) => setFormData({ ...formData, baseUrl: e.target.value })}- placeholder={defaultBailianUrl}- hint="Optional: Custom base URL for bailian-coding-plan provider"+ placeholder={getProviderBaseUrlPlaceholder(provider)}+ hint={getProviderBaseUrlHint(provider)}/>)}{isVertex && (@@ -5211,7 +5271,12 @@ function AddApiKeyModal({<ButtononClick={handleSubmit}fullWidth- disabled={!formData.name || !formData.apiKey || saving}+ disabled={+ !formData.name ||+ !formData.apiKey ||+ saving ||+ (usesBaseUrl && !formData.baseUrl.trim() && !defaultBaseUrl)+ }>{saving ? t("saving") : t("save")}</Button>@@ -5271,10 +5336,11 @@ function EditConnectionModal({ isOpen, connection, onSave, onClose }: EditConnecconst [extraApiKeys, setExtraApiKeys] = useState<string[]>([]);const [newExtraKey, setNewExtraKey] = useState("");const [showAdvanced, setShowAdvanced] = useState(false);- const [showEmail, setShowEmail] = useState(false);+ const { emailsVisible: showEmail, toggleEmailVisibility: toggleShowEmail } =+ useEmailPrivacyStore();- const isBailian = connection?.provider === "bailian-coding-plan";- const defaultBailianUrl = "https://coding-intl.dashscope.aliyuncs.com/apps/anthropic/v1";+ const usesBaseUrl = CONFIGURABLE_BASE_URL_PROVIDERS.has(connection?.provider || "");+ const defaultBaseUrl = getProviderBaseUrlDefault(connection?.provider);const isVertex = connection?.provider === "vertex";const isGlm = connection?.provider === "glm";const defaultRegion = "us-central1";@@ -5293,7 +5359,7 @@ function EditConnectionModal({ isOpen, connection, onSave, onClose }: EditConnecpriority: connection.priority || 1,apiKey: "",healthCheckInterval: connection.healthCheckInterval ?? 60,- baseUrl: existingBaseUrl || (isBailian ? defaultBailianUrl : ""),+ baseUrl: existingBaseUrl || defaultBaseUrl,region: existingRegion || (isVertex ? defaultRegion : ""),apiRegion: (connection.providerSpecificData?.apiRegion as string) || "international",validationModelId: (connection.providerSpecificData?.validationModelId as string) || "",@@ -5305,12 +5371,12 @@ function EditConnectionModal({ isOpen, connection, onSave, onClose }: EditConnecsetExtraApiKeys(Array.isArray(existing) ? existing : []);setNewExtraKey("");setShowAdvanced(!!existingCustomUserAgent);- setShowEmail(false);+ // email visibility controlled by global storesetTestResult(null);setValidationResult(null);setSaveError(null);}- }, [connection, isBailian, isVertex]);+ }, [connection, defaultBaseUrl, isVertex]);const handleTest = async () => {if (!connection?.provider) return;@@ -5376,14 +5442,14 @@ function EditConnectionModal({ isOpen, connection, onSave, onClose }: EditConnechealthCheckInterval: formData.healthCheckInterval,};- let validatedBailianBaseUrl = null;- if (isBailian) {- const checked = normalizeAndValidateHttpBaseUrl(formData.baseUrl, defaultBailianUrl);+ let validatedBaseUrl = null;+ if (usesBaseUrl) {+ const checked = normalizeAndValidateHttpBaseUrl(formData.baseUrl, defaultBaseUrl);if (checked.error) {setSaveError(checked.error);return;}- validatedBailianBaseUrl = checked.value;+ validatedBaseUrl = checked.value;}if (!isOAuth && formData.apiKey) {@@ -5434,9 +5500,8 @@ function EditConnectionModal({ isOpen, connection, onSave, onClose }: EditConnecif (formData.validationModelId) {updates.providerSpecificData.validationModelId = formData.validationModelId;}- // Update baseUrl for bailian-coding-plan- if (isBailian) {- updates.providerSpecificData.baseUrl = validatedBailianBaseUrl;+ if (usesBaseUrl) {+ updates.providerSpecificData.baseUrl = validatedBaseUrl;} else if (isVertex) {updates.providerSpecificData.region = formData.region;} else if (isGlm) {@@ -5494,7 +5559,7 @@ function EditConnectionModal({ isOpen, connection, onSave, onClose }: EditConnec</p><buttontype="button"- onClick={() => setShowEmail((current) => !current)}+ onClick={toggleShowEmail}className="rounded p-1 text-text-muted hover:bg-sidebar hover:text-primary"title={showEmail ? "Hide email" : "Show email"}>@@ -5598,13 +5663,13 @@ function EditConnectionModal({ isOpen, connection, onSave, onClose }: EditConnec</>)}- {isBailian && (+ {usesBaseUrl && (<Inputlabel="Base URL"value={formData.baseUrl}onChange={(e) => setFormData({ ...formData, baseUrl: e.target.value })}- placeholder={defaultBailianUrl}- hint="Custom base URL for bailian-coding-plan provider"+ placeholder={getProviderBaseUrlPlaceholder(connection.provider)}+ hint={getProviderBaseUrlHint(connection.provider)}/>)}diff --git a/src/app/(dashboard)/dashboard/usage/components/ProviderLimits/index.tsx b/src/app/(dashboard)/dashboard/usage/components/ProviderLimits/index.tsxindex 9fea3b9972..d01f829eac 100644--- a/src/app/(dashboard)/dashboard/usage/components/ProviderLimits/index.tsx+++ b/src/app/(dashboard)/dashboard/usage/components/ProviderLimits/index.tsx@@ -15,7 +15,9 @@ import Card from "@/shared/components/Card";import Badge from "@/shared/components/Badge";import { CardSkeleton } from "@/shared/components/Loading";import { USAGE_SUPPORTED_PROVIDERS } from "@/shared/constants/providers";-import { pickMaskedDisplayValue } from "@/shared/utils/maskEmail";+import { pickMaskedDisplayValue, pickDisplayValue } from "@/shared/utils/maskEmail";+import useEmailPrivacyStore from "@/store/emailPrivacyStore";+import EmailPrivacyToggle from "@/shared/components/EmailPrivacyToggle";const LS_GROUP_BY = "omniroute:limits:groupBy";const LS_EXPANDED_GROUPS = "omniroute:limits:expandedGroups";@@ -79,6 +81,7 @@ function formatCountdown(resetAt) {export default function ProviderLimits() {const t = useTranslations("usage");+ const emailsVisible = useEmailPrivacyStore((s) => s.emailsVisible);const [connections, setConnections] = useState([]);const [quotaData, setQuotaData] = useState({});const [loading, setLoading] = useState({});@@ -427,6 +430,7 @@ export default function ProviderLimits() {{visibleConnections.length !== sortedConnections.length &&` ${t("filteredFromCount", { count: sortedConnections.length })}`}</span>+ <EmailPrivacyToggle /></div><div className="flex items-center gap-2">@@ -546,8 +550,9 @@ export default function ProviderLimits() {</div><div className="min-w-0"><div className="text-[13px] font-semibold text-text-main truncate">- {pickMaskedDisplayValue(+ {pickDisplayValue([conn.name, conn.displayName, conn.email],+ emailsVisible,config.label)}</div>diff --git a/src/app/api/providers/[id]/models/route.ts b/src/app/api/providers/[id]/models/route.tsindex 8468994dd7..09d05ecbc0 100755--- a/src/app/api/providers/[id]/models/route.ts+++ b/src/app/api/providers/[id]/models/route.ts@@ -688,6 +688,20 @@ export async function GET(provider in PROVIDER_MODELS_CONFIG? PROVIDER_MODELS_CONFIG[provider as keyof typeof PROVIDER_MODELS_CONFIG]: undefined;+ const localCatalog = PROVIDER_MODELS[provider] || [];+ if (!config && localCatalog.length > 0) {+ return buildResponse({+ provider,+ connectionId,+ models: localCatalog.map((m: any) => ({+ id: m.id,+ name: m.name || m.id,+ owned_by: provider,+ })),+ source: "local_catalog",+ warning: "API unavailable — using cached catalog",+ });+ }if (!config) {return NextResponse.json({ error: `Provider ${provider} does not support models listing` },diff --git a/src/app/api/providers/validate/route.ts b/src/app/api/providers/validate/route.tsindex 6fdbdd6b5f..610c827d55 100644--- a/src/app/api/providers/validate/route.ts+++ b/src/app/api/providers/validate/route.ts@@ -33,12 +33,21 @@ export async function POST(request) {if (isValidationFailure(validation)) {return NextResponse.json({ error: validation.error }, { status: 400 });}- const { provider, apiKey, validationModelId, customUserAgent, baseUrl: bodyBaseUrl } = validation.data;+ const {+ provider,+ apiKey,+ validationModelId,+ customUserAgent,+ baseUrl: bodyBaseUrl,+ } = validation.data;let providerSpecificData: any = { validationModelId };if (customUserAgent) {providerSpecificData.customUserAgent = customUserAgent;}+ if (bodyBaseUrl) {+ providerSpecificData.baseUrl = bodyBaseUrl;+ }if (isOpenAICompatibleProvider(provider) || isAnthropicCompatibleProvider(provider)) {const node: any = await getProviderNodeById(provider);diff --git a/src/i18n/messages/en.json b/src/i18n/messages/en.jsonindex e0b430c72f..8fbb8f3740 100644--- a/src/i18n/messages/en.json+++ b/src/i18n/messages/en.json@@ -1812,7 +1812,9 @@"modelsPathHint": "Custom models path for validation (e.g. /v4/models)","statusDeactivated": "Deactivated (Manual)","statusBanned": "Banned / Sandbox Violation",- "statusCreditsExhausted": "Insufficient Balance / Quota Exhausted"+ "statusCreditsExhausted": "Insufficient Balance / Quota Exhausted",+ "showEmails": "Show all emails",+ "hideEmails": "Hide all emails"},"settings": {"title": "Settings",diff --git a/src/lib/modelsDevSync.ts b/src/lib/modelsDevSync.tsindex 1b1d60a7fb..c5008ddf4d 100644--- a/src/lib/modelsDevSync.ts+++ b/src/lib/modelsDevSync.ts@@ -175,7 +175,7 @@ const MODELS_DEV_PROVIDER_MAP: Record<string, string[]> = {// Additional providers that may overlap with OmniRoutealibaba: ["ali", "alibaba", "bcp", "alicode", "alicode-intl"],zai: ["zai", "glm"], // GLM models via Z.AI- moonshot: ["kimi", "kimi-coding", "kmc", "kmca"],+ moonshot: ["moonshot", "kimi", "kimi-coding", "kmc", "kmca"],minimax: ["minimax", "minimax-cn"],longcat: ["lc", "longcat"],pollinations: ["pol", "pollinations"],diff --git a/src/lib/providers/validation.ts b/src/lib/providers/validation.tsindex 752ed99d57..af50b53c9c 100644--- a/src/lib/providers/validation.ts+++ b/src/lib/providers/validation.ts@@ -14,6 +14,7 @@ import {isAnthropicCompatibleProvider,isOpenAICompatibleProvider,} from "@/shared/constants/providers";+import { getGigachatAccessToken } from "@omniroute/open-sse/services/gigachatAuth.ts";import { validateQoderCliPat } from "@omniroute/open-sse/services/qoderCli.ts";const OPENAI_LIKE_FORMATS = new Set(["openai", "openai-responses"]);@@ -80,6 +81,34 @@ function resolveChatUrl(provider: string, baseUrl: string, providerSpecificData:return normalized;}+function normalizeHerokuChatUrl(baseUrl: string) {+ const normalized = normalizeBaseUrl(baseUrl);+ if (!normalized) return "";+ return normalized.endsWith("/v1/chat/completions")+ ? normalized+ : `${normalized}/v1/chat/completions`;+}++function normalizeDatabricksChatUrl(baseUrl: string) {+ const normalized = normalizeBaseUrl(baseUrl);+ if (!normalized) return "";+ return normalized.endsWith("/chat/completions") ? normalized : `${normalized}/chat/completions`;+}++function normalizeSnowflakeChatUrl(baseUrl: string) {+ const normalized = normalizeBaseUrl(baseUrl)+ .replace(/\/cortex\/inference:complete$/, "")+ .replace(/\/api\/v2$/, "");+ if (!normalized) return "";+ return `${normalized}/api/v2/cortex/inference:complete`;+}++function normalizeGigachatChatUrl(baseUrl: string) {+ const normalized = normalizeBaseUrl(baseUrl).replace(/\/chat\/completions$/, "");+ if (!normalized) return "";+ return `${normalized}/chat/completions`;+}+function getCustomUserAgent(providerSpecificData: any = {}) {if (typeof providerSpecificData?.customUserAgent !== "string") return null;const customUserAgent = providerSpecificData.customUserAgent.trim();@@ -185,6 +214,37 @@ async function validateOpenAILikeProvider({return { valid: true, error: null };}+async function validateDirectChatProvider({ url, headers, body, providerSpecificData = {} }: any) {+ try {+ const response = await fetch(url, {+ method: "POST",+ headers: applyCustomUserAgent(headers, providerSpecificData),+ body: JSON.stringify(body),+ });++ if (response.status === 401 || response.status === 403) {+ return { valid: false, error: "Invalid API key" };+ }++ if (+ response.ok ||+ response.status === 400 ||+ response.status === 422 ||+ response.status === 429+ ) {+ return { valid: true, error: null };+ }++ if (response.status >= 500) {+ return { valid: false, error: `Provider unavailable (${response.status})` };+ }++ return { valid: false, error: `Validation failed: ${response.status}` };+ } catch (error: any) {+ return { valid: false, error: error.message || "Validation failed" };+ }+}+async function validateAnthropicLikeProvider({apiKey,baseUrl,@@ -480,6 +540,97 @@ async function validateBailianCodingPlanProvider({ apiKey, providerSpecificData}}+async function validateHerokuProvider({ apiKey, providerSpecificData = {} }: any) {+ const baseUrl = normalizeBaseUrl(providerSpecificData.baseUrl);+ if (!baseUrl) {+ return { valid: false, error: "Missing base URL" };+ }++ return validateDirectChatProvider({+ url: normalizeHerokuChatUrl(baseUrl),+ headers: buildBearerHeaders(apiKey, providerSpecificData),+ body: {+ model: providerSpecificData.validationModelId || "claude-4-sonnet",+ messages: [{ role: "user", content: "test" }],+ max_tokens: 1,+ },+ providerSpecificData,+ });+}++async function validateDatabricksProvider({ apiKey, providerSpecificData = {} }: any) {+ const baseUrl = normalizeBaseUrl(providerSpecificData.baseUrl);+ if (!baseUrl) {+ return { valid: false, error: "Missing base URL" };+ }++ return validateDirectChatProvider({+ url: normalizeDatabricksChatUrl(baseUrl),+ headers: buildBearerHeaders(apiKey, providerSpecificData),+ body: {+ model: providerSpecificData.validationModelId || "databricks-meta-llama-3-3-70b-instruct",+ messages: [{ role: "user", content: "test" }],+ max_tokens: 1,+ },+ providerSpecificData,+ });+}++async function validateSnowflakeProvider({ apiKey, providerSpecificData = {} }: any) {+ const baseUrl = normalizeBaseUrl(providerSpecificData.baseUrl);+ if (!baseUrl) {+ return { valid: false, error: "Missing base URL" };+ }++ const usesProgrammaticAccessToken = apiKey.startsWith("pat/");+ return validateDirectChatProvider({+ url: normalizeSnowflakeChatUrl(baseUrl),+ headers: {+ "Content-Type": "application/json",+ Authorization: `Bearer ${usesProgrammaticAccessToken ? apiKey.slice(4) : apiKey}`,+ "X-Snowflake-Authorization-Token-Type": usesProgrammaticAccessToken+ ? "PROGRAMMATIC_ACCESS_TOKEN"+ : "KEYPAIR_JWT",+ },+ body: {+ model: providerSpecificData.validationModelId || "llama3.3-70b",+ messages: [{ role: "user", content: "test" }],+ max_tokens: 1,+ },+ providerSpecificData,+ });+}++async function validateGigachatProvider({ apiKey, providerSpecificData = {} }: any) {+ const baseUrl =+ normalizeBaseUrl(providerSpecificData.baseUrl) || "https://gigachat.devices.sberbank.ru/api/v1";++ let token;+ try {+ token = await getGigachatAccessToken({ credentials: apiKey });+ } catch (error: any) {+ if (String(error?.message || "").match(/\b(401|403)\b/)) {+ return { valid: false, error: "Invalid API key" };+ }+ return { valid: false, error: error.message || "Validation failed" };+ }++ return validateDirectChatProvider({+ url: normalizeGigachatChatUrl(baseUrl),+ headers: {+ "Content-Type": "application/json",+ Authorization: `Bearer ${token.accessToken}`,+ Accept: "application/json",+ },+ body: {+ model: providerSpecificData.validationModelId || "GigaChat-2-Pro",+ messages: [{ role: "user", content: "test" }],+ max_tokens: 1,+ },+ providerSpecificData,+ });+}+async function validateOpenAICompatibleProvider({ apiKey, providerSpecificData = {} }: any) {const baseUrl = normalizeBaseUrl(providerSpecificData.baseUrl);if (!baseUrl) {@@ -866,6 +1017,10 @@ export async function validateProviderApiKey({ provider, apiKey, providerSpecifielevenlabs: validateElevenLabsProvider,inworld: validateInworldProvider,"bailian-coding-plan": validateBailianCodingPlanProvider,+ heroku: validateHerokuProvider,+ databricks: validateDatabricksProvider,+ snowflake: validateSnowflakeProvider,+ gigachat: validateGigachatProvider,// LongCat AI — does not expose /v1/models; validate via chat completions directly (#592)longcat: async ({ apiKey, providerSpecificData }: any) => {try {diff --git a/src/shared/components/EmailPrivacyToggle.tsx b/src/shared/components/EmailPrivacyToggle.tsxnew file mode 100644index 0000000000..9821fcbad0--- /dev/null+++ b/src/shared/components/EmailPrivacyToggle.tsx@@ -0,0 +1,41 @@+"use client";++import useEmailPrivacyStore from "@/store/emailPrivacyStore";+import { useTranslations } from "next-intl";++/**+ * EmailPrivacyToggle — A toggle button (eye icon) for global email visibility.+ *+ * When emails are hidden (default), displays a closed-eye icon.+ * When active, displays an open-eye icon and all masked emails become fully visible.+ *+ * Accepts an optional `size` prop: "sm" (default) for inline use, "md" for page headers.+ */+export default function EmailPrivacyToggle({ size = "sm" }: { size?: "sm" | "md" }) {+ const { emailsVisible, toggleEmailVisibility } = useEmailPrivacyStore();+ const t = useTranslations("providers");++ const iconSize = size === "md" ? "text-[20px]" : "text-[16px]";+ const padSize = size === "md" ? "p-1.5" : "p-1";++ const label = emailsVisible ? t("hideEmails") : t("showEmails");++ return (+ <button+ type="button"+ onClick={toggleEmailVisibility}+ className={`rounded ${padSize} transition-colors ${+ emailsVisible+ ? "bg-primary/15 text-primary hover:bg-primary/25"+ : "text-text-muted hover:bg-sidebar hover:text-primary"+ }`}+ title={label}+ aria-label={label}+ aria-pressed={emailsVisible}+ >+ <span className={`material-symbols-outlined ${iconSize} leading-none`}>+ {emailsVisible ? "visibility" : "visibility_off"}+ </span>+ </button>+ );+}diff --git a/src/shared/constants/providers.ts b/src/shared/constants/providers.tsindex 4ddfe6453c..073d958f0f 100644--- a/src/shared/constants/providers.ts+++ b/src/shared/constants/providers.ts@@ -590,6 +590,294 @@ export const APIKEY_PROVIDERS = {hasFree: true,freeNote: "1M free tokens for new accounts — EU/GDPR compliant (Paris), Qwen3 235B & Llama 70B",},+ deepinfra: {+ id: "deepinfra",+ alias: "deepinfra",+ name: "DeepInfra",+ icon: "hub",+ color: "#2563EB",+ textIcon: "DI",+ website: "https://deepinfra.com",+ },+ "vercel-ai-gateway": {+ id: "vercel-ai-gateway",+ alias: "vag",+ name: "Vercel AI Gateway",+ icon: "route",+ color: "#111827",+ textIcon: "VAI",+ website: "https://vercel.com/docs/ai-gateway",+ },+ "lambda-ai": {+ id: "lambda-ai",+ alias: "lambda",+ name: "Lambda AI",+ icon: "bolt",+ color: "#7C3AED",+ textIcon: "LA",+ website: "https://lambda.ai",+ },+ sambanova: {+ id: "sambanova",+ alias: "samba",+ name: "SambaNova",+ icon: "memory",+ color: "#DC2626",+ textIcon: "SN",+ website: "https://sambanova.ai",+ },+ nscale: {+ id: "nscale",+ alias: "nscale",+ name: "nScale",+ icon: "token",+ color: "#0891B2",+ textIcon: "NS",+ website: "https://nscale.com",+ },+ ovhcloud: {+ id: "ovhcloud",+ alias: "ovh",+ name: "OVHcloud AI",+ icon: "cloud",+ color: "#2563EB",+ textIcon: "OVH",+ website: "https://www.ovhcloud.com",+ },+ baseten: {+ id: "baseten",+ alias: "baseten",+ name: "Baseten",+ icon: "deployed_code",+ color: "#111827",+ textIcon: "BT",+ website: "https://baseten.co",+ },+ publicai: {+ id: "publicai",+ alias: "publicai",+ name: "PublicAI",+ icon: "public",+ color: "#059669",+ textIcon: "PA",+ website: "https://publicai.co",+ },+ moonshot: {+ id: "moonshot",+ alias: "moonshot",+ name: "Moonshot AI",+ icon: "rocket_launch",+ color: "#1E40AF",+ textIcon: "MS",+ website: "https://platform.moonshot.ai",+ },+ "meta-llama": {+ id: "meta-llama",+ alias: "meta",+ name: "Meta Llama API",+ icon: "smart_toy",+ color: "#0F766E",+ textIcon: "ML",+ website: "https://llama.developer.meta.com",+ },+ "v0-vercel": {+ id: "v0-vercel",+ alias: "v0",+ name: "v0 (Vercel)",+ icon: "code_blocks",+ color: "#111827",+ textIcon: "V0",+ website: "https://v0.dev",+ },+ morph: {+ id: "morph",+ alias: "morph",+ name: "Morph",+ icon: "auto_fix_high",+ color: "#2563EB",+ textIcon: "MP",+ website: "https://morphllm.com",+ },+ "featherless-ai": {+ id: "featherless-ai",+ alias: "featherless",+ name: "Featherless AI",+ icon: "flutter_dash",+ color: "#EA580C",+ textIcon: "FL",+ website: "https://featherless.ai",+ },+ friendliai: {+ id: "friendliai",+ alias: "friendli",+ name: "FriendliAI",+ icon: "handshake",+ color: "#EC4899",+ textIcon: "FR",+ website: "https://friendli.ai",+ },+ llamagate: {+ id: "llamagate",+ alias: "llamagate",+ name: "LlamaGate",+ icon: "gate",+ color: "#16A34A",+ textIcon: "LG",+ website: "https://llamagate.ai",+ },+ heroku: {+ id: "heroku",+ alias: "heroku",+ name: "Heroku AI",+ icon: "cloud_upload",+ color: "#7C3AED",+ textIcon: "HK",+ website: "https://www.heroku.com",+ },+ galadriel: {+ id: "galadriel",+ alias: "galadriel",+ name: "Galadriel",+ icon: "auto_awesome",+ color: "#F59E0B",+ textIcon: "GA",+ website: "https://galadriel.com",+ },+ databricks: {+ id: "databricks",+ alias: "databricks",+ name: "Databricks",+ icon: "table_chart",+ color: "#F97316",+ textIcon: "DB",+ website: "https://www.databricks.com",+ },+ snowflake: {+ id: "snowflake",+ alias: "snowflake",+ name: "Snowflake Cortex",+ icon: "ac_unit",+ color: "#29B5E8",+ textIcon: "SF",+ website: "https://www.snowflake.com",+ },+ wandb: {+ id: "wandb",+ alias: "wandb",+ name: "Weights & Biases Inference",+ icon: "monitoring",+ color: "#FFBE0B",+ textIcon: "WB",+ website: "https://wandb.ai",+ },+ volcengine: {+ id: "volcengine",+ alias: "volcengine",+ name: "Volcengine",+ icon: "local_fire_department",+ color: "#DC2626",+ textIcon: "VE",+ website: "https://www.volcengine.com",+ },+ ai21: {+ id: "ai21",+ alias: "ai21",+ name: "AI21 Labs",+ icon: "psychology_alt",+ color: "#0284C7",+ textIcon: "AI21",+ website: "https://www.ai21.com",+ },+ gigachat: {+ id: "gigachat",+ alias: "gigachat",+ name: "GigaChat (Sber)",+ icon: "lock_person",+ color: "#10B981",+ textIcon: "GC",+ website: "https://developers.sber.ru",+ },+ venice: {+ id: "venice",+ alias: "venice",+ name: "Venice.ai",+ icon: "travel_explore",+ color: "#0EA5E9",+ textIcon: "VN",+ website: "https://venice.ai",+ },+ codestral: {+ id: "codestral",+ alias: "codestral",+ name: "Codestral",+ icon: "terminal",+ color: "#FF7000",+ textIcon: "CS",+ website: "https://mistral.ai",+ },+ upstage: {+ id: "upstage",+ alias: "upstage",+ name: "Upstage",+ icon: "trending_up",+ color: "#0F766E",+ textIcon: "UP",+ website: "https://www.upstage.ai",+ },+ maritalk: {+ id: "maritalk",+ alias: "maritalk",+ name: "Maritalk",+ icon: "translate",+ color: "#1D4ED8",+ textIcon: "MT",+ website: "https://www.maritaca.ai",+ },+ "xiaomi-mimo": {+ id: "xiaomi-mimo",+ alias: "mimo",+ name: "Xiaomi MiMo",+ icon: "devices",+ color: "#EA580C",+ textIcon: "MM",+ website: "https://www.mi.com",+ },+ "inference-net": {+ id: "inference-net",+ alias: "inet",+ name: "Inference.net",+ icon: "dns",+ color: "#2563EB",+ textIcon: "IN",+ website: "https://inference.net",+ },+ nanogpt: {+ id: "nanogpt",+ alias: "nanogpt",+ name: "NanoGPT",+ icon: "chat",+ color: "#4F46E5",+ textIcon: "NG",+ website: "https://nano-gpt.com",+ },+ predibase: {+ id: "predibase",+ alias: "predibase",+ name: "Predibase",+ icon: "deployed_code_history",+ color: "#0F766E",+ textIcon: "PB",+ website: "https://predibase.com",+ },+ bytez: {+ id: "bytez",+ alias: "bytez",+ name: "Bytez",+ icon: "api",+ color: "#6366F1",+ textIcon: "BZ",+ website: "https://bytez.com",+ },aimlapi: {id: "aimlapi",alias: "aiml",diff --git a/src/shared/utils/maskEmail.ts b/src/shared/utils/maskEmail.tsindex e992d7dd87..08471f4010 100644--- a/src/shared/utils/maskEmail.ts+++ b/src/shared/utils/maskEmail.ts@@ -56,3 +56,22 @@ export function pickMaskedDisplayValue(}return fallback;}++/**+ * Visibility-aware variant of pickMaskedDisplayValue.+ * When `showFull` is true, returns the raw (unmasked) value.+ * When `showFull` is false, returns the masked value (default behavior).+ */+export function pickDisplayValue(+ values: Array<string | null | undefined>,+ showFull: boolean,+ fallback = ""+): string {+ if (showFull) {+ for (const value of values) {+ if (value?.trim()) return value.trim();+ }+ return fallback;+ }+ return pickMaskedDisplayValue(values, fallback);+}diff --git a/src/store/emailPrivacyStore.ts b/src/store/emailPrivacyStore.tsnew file mode 100644index 0000000000..a8856e8224--- /dev/null+++ b/src/store/emailPrivacyStore.ts@@ -0,0 +1,25 @@+"use client";++import { create } from "zustand";+import { persist } from "zustand/middleware";++interface EmailPrivacyState {+ /** When true, all email addresses are shown in full (unmasked). Default: false (masked). */+ emailsVisible: boolean;+ /** Toggle the global email visibility state. */+ toggleEmailVisibility: () => void;+}++const useEmailPrivacyStore = create<EmailPrivacyState>()(+ persist(+ (set, get) => ({+ emailsVisible: false,+ toggleEmailVisibility: () => set({ emailsVisible: !get().emailsVisible }),+ }),+ {+ name: "omniroute-email-privacy",+ }+ )+);++export default useEmailPrivacyStore;diff --git a/src/store/index.ts b/src/store/index.tsindex 4721b6b702..5894921f99 100644--- a/src/store/index.ts+++ b/src/store/index.ts@@ -3,3 +3,4 @@ export { default as useThemeStore } from "./themeStore";export { default as useUserStore } from "./userStore";export { default as useProviderStore } from "./providerStore";export { useNotificationStore } from "./notificationStore";+export { default as useEmailPrivacyStore } from "./emailPrivacyStore";diff --git a/tests/unit/chat-openai-compat-providers.test.mjs b/tests/unit/chat-openai-compat-providers.test.mjsnew file mode 100644index 0000000000..53fa044e7f--- /dev/null+++ b/tests/unit/chat-openai-compat-providers.test.mjs@@ -0,0 +1,52 @@+import test from "node:test";+import assert from "node:assert/strict";++import { REGISTRY } from "../../open-sse/config/providerRegistry.ts";+import { getModelsByProviderId } from "../../src/shared/constants/models.ts";+import { APIKEY_PROVIDERS } from "../../src/shared/constants/providers.ts";++const CHAT_OPENAI_COMPAT_PROVIDER_IDS = [+ "deepinfra",+ "vercel-ai-gateway",+ "lambda-ai",+ "sambanova",+ "nscale",+ "ovhcloud",+ "baseten",+ "publicai",+ "moonshot",+ "meta-llama",+ "v0-vercel",+ "morph",+ "featherless-ai",+ "friendliai",+ "llamagate",+ "heroku",+ "galadriel",+ "databricks",+ "snowflake",+ "wandb",+ "volcengine",+ "ai21",+ "gigachat",+ "venice",+ "codestral",+ "upstage",+ "maritalk",+ "xiaomi-mimo",+ "inference-net",+ "nanogpt",+ "predibase",+ "bytez",+];++test("chat-openai-compat providers are registered across provider metadata, registry and local catalog", () => {+ for (const providerId of CHAT_OPENAI_COMPAT_PROVIDER_IDS) {+ assert.ok(APIKEY_PROVIDERS[providerId], `${providerId} missing from APIKEY_PROVIDERS`);+ assert.ok(REGISTRY[providerId], `${providerId} missing from REGISTRY`);++ const models = getModelsByProviderId(providerId);+ assert.ok(Array.isArray(models), `${providerId} models must be an array`);+ assert.ok(models.length > 0, `${providerId} models must not be empty`);+ }+});diff --git a/tests/unit/executor-default-base.test.mjs b/tests/unit/executor-default-base.test.mjsindex ae846ea9d7..48c7d7bfbd 100644--- a/tests/unit/executor-default-base.test.mjs+++ b/tests/unit/executor-default-base.test.mjs@@ -156,6 +156,49 @@ test("DefaultExecutor.buildUrl handles openai-compatible and anthropic-compatibl);});+test("DefaultExecutor.buildUrl normalizes configurable chat-openai-compat base URLs", () => {+ const bailian = new DefaultExecutor("bailian-coding-plan");+ const heroku = new DefaultExecutor("heroku");+ const databricks = new DefaultExecutor("databricks");+ const snowflake = new DefaultExecutor("snowflake");+ const gigachat = new DefaultExecutor("gigachat");++ assert.equal(+ bailian.buildUrl("qwen3-coder-plus", true, 0, {+ providerSpecificData: {+ baseUrl: "https://coding-intl.dashscope.aliyuncs.com/apps/anthropic/v1",+ },+ }),+ "https://coding-intl.dashscope.aliyuncs.com/apps/anthropic/v1/messages?beta=true"+ );+ assert.equal(+ heroku.buildUrl("claude-4-sonnet", true, 0, {+ providerSpecificData: { baseUrl: "https://us.inference.heroku.com" },+ }),+ "https://us.inference.heroku.com/v1/chat/completions"+ );+ assert.equal(+ databricks.buildUrl("databricks-gpt-5", true, 0, {+ providerSpecificData: {+ baseUrl: "https://adb-1234567890123456.7.azuredatabricks.net/serving-endpoints",+ },+ }),+ "https://adb-1234567890123456.7.azuredatabricks.net/serving-endpoints/chat/completions"+ );+ assert.equal(+ snowflake.buildUrl("llama3.3-70b", true, 0, {+ providerSpecificData: { baseUrl: "https://account.snowflakecomputing.com" },+ }),+ "https://account.snowflakecomputing.com/api/v2/cortex/inference:complete"+ );+ assert.equal(+ gigachat.buildUrl("GigaChat-2-Pro", true, 0, {+ providerSpecificData: { baseUrl: "https://gigachat.devices.sberbank.ru/api/v1" },+ }),+ "https://gigachat.devices.sberbank.ru/api/v1/chat/completions"+ );+});+test("DefaultExecutor.buildUrl falls back to OpenAI config for unknown providers", () => {const executor = new DefaultExecutor("unknown-provider");assert.equal(executor.config.baseUrl, PROVIDERS.openai.baseUrl);@@ -198,6 +241,24 @@ test("DefaultExecutor.buildHeaders handles GLM, default auth and anthropic-compaassert.equal(anthropicHeaders.Accept, "text/event-stream");});+test("DefaultExecutor.buildHeaders handles Snowflake PATs and GigaChat access tokens", () => {+ const snowflake = new DefaultExecutor("snowflake");+ const gigachat = new DefaultExecutor("gigachat");++ const snowflakePatHeaders = snowflake.buildHeaders({ apiKey: "pat/test-token" }, false);+ const snowflakeJwtHeaders = snowflake.buildHeaders({ apiKey: "jwt-token" }, false);+ const gigachatHeaders = gigachat.buildHeaders({ accessToken: "gigachat-token" }, false);++ assert.equal(snowflakePatHeaders.Authorization, "Bearer test-token");+ assert.equal(+ snowflakePatHeaders["X-Snowflake-Authorization-Token-Type"],+ "PROGRAMMATIC_ACCESS_TOKEN"+ );+ assert.equal(snowflakeJwtHeaders.Authorization, "Bearer jwt-token");+ assert.equal(snowflakeJwtHeaders["X-Snowflake-Authorization-Token-Type"], "KEYPAIR_JWT");+ assert.equal(gigachatHeaders.Authorization, "Bearer gigachat-token");+});+test("DefaultExecutor.buildHeaders strips DashScope headers for Qwen API keys and preserves them for OAuth", () => {const executor = new DefaultExecutor("qwen");@@ -315,6 +376,20 @@ test("DefaultExecutor.refreshCredentials returns null without refresh token", asassert.equal(result, null);});+test("DefaultExecutor.needsRefresh requests a proactive token for GigaChat", () => {+ const executor = new DefaultExecutor("gigachat");++ assert.equal(executor.needsRefresh({ apiKey: "base64-basic-credentials" }), true);+ assert.equal(+ executor.needsRefresh({+ apiKey: "base64-basic-credentials",+ accessToken: "existing-token",+ expiresAt: new Date(Date.now() + 60 * 60 * 1000).toISOString(),+ }),+ false+ );+});+test("DefaultExecutor.refreshCredentials delegates to OAuth refresh and returns new tokens", async () => {const executor = new DefaultExecutor("gemini");const originalFetch = globalThis.fetch;@@ -410,6 +485,49 @@ test("BaseExecutor.execute returns response metadata and merges headers", async}});+test("BaseExecutor.execute refreshes credentials before the request when needed", async () => {+ class RefreshingExecutor extends BaseExecutor {+ constructor() {+ super("refreshing-provider", {+ baseUrl: "https://refresh.example/v1/chat/completions",+ });+ }++ needsRefresh() {+ return true;+ }++ async refreshCredentials() {+ return {+ accessToken: "fresh-token",+ expiresAt: new Date(Date.now() + 60 * 60 * 1000).toISOString(),+ };+ }+ }++ const executor = new RefreshingExecutor();+ const originalFetch = globalThis.fetch;+ let capturedHeaders;+ globalThis.fetch = async (url, options) => {+ assert.equal(String(url), "https://refresh.example/v1/chat/completions");+ capturedHeaders = options.headers;+ return new Response(JSON.stringify({ ok: true }), { status: 200 });+ };++ try {+ await executor.execute({+ model: "gpt-4.1",+ body: {},+ stream: false,+ credentials: { apiKey: "stale-token" },+ });++ assert.equal(capturedHeaders.Authorization, "Bearer fresh-token");+ } finally {+ globalThis.fetch = originalFetch;+ }+});+test("BaseExecutor.execute falls back to the next base URL after a transport error", async () => {const executor = new TestExecutor();const originalFetch = globalThis.fetch;diff --git a/tests/unit/modelsDevSync.test.mjs b/tests/unit/modelsDevSync.test.mjsindex 49f8a848f4..c6257c4f48 100644--- a/tests/unit/modelsDevSync.test.mjs+++ b/tests/unit/modelsDevSync.test.mjs@@ -408,6 +408,10 @@ describe("modelsDevSync — mapProviderId", () => {it("maps bedrock to [kiro, kr]", () => {assert.deepEqual(mapProviderId("bedrock"), ["kiro", "kr"]);});++ it("maps moonshot to the canonical provider plus Kimi aliases", () => {+ assert.deepEqual(mapProviderId("moonshot"), ["moonshot", "kimi", "kimi-coding", "kmc", "kmca"]);+ });});describe("modelsDevSync — fetchModelsDev (live API)", () => {diff --git a/tests/unit/provider-models-route.test.mjs b/tests/unit/provider-models-route.test.mjsindex 328a11fb83..1ad44ee762 100644--- a/tests/unit/provider-models-route.test.mjs+++ b/tests/unit/provider-models-route.test.mjs@@ -143,6 +143,23 @@ test("provider models route returns static catalog entries for providers with haassert.equal(body.models.length, 8);});+test("provider models route returns the local catalog for new built-in chat-openai-compat providers", async () => {+ const connection = await seedConnection("deepinfra", {+ apiKey: "deepinfra-key",+ });++ const response = await callRoute(connection.id);+ const body = await response.json();++ assert.equal(response.status, 200);+ assert.equal(body.provider, "deepinfra");+ assert.equal(body.source, "local_catalog");+ assert.match(body.warning, /cached catalog/i);+ assert.ok(Array.isArray(body.models));+ assert.ok(body.models.length > 0);+ assert.ok(body.models.some((model) => model.id === "Qwen/Qwen3-Coder-480B-A35B-Instruct"));+});+test("provider models route validates Gemini CLI credentials before fetching quota buckets", async () => {const missingToken = await seedConnection("gemini-cli", {authType: "oauth",diff --git a/tests/unit/provider-validation-specialty.test.mjs b/tests/unit/provider-validation-specialty.test.mjsindex 43679a7dbb..dab5f7ee6a 100644--- a/tests/unit/provider-validation-specialty.test.mjs+++ b/tests/unit/provider-validation-specialty.test.mjs@@ -398,3 +398,146 @@ test("specialty validators cover remaining status branches for Deepgram, Assemblassert.equal(elevenOffline.error, "elevenlabs offline");assert.equal(longcatValid.valid, true);});++test("specialty validators cover Heroku, Databricks, Snowflake and GigaChat success paths", async () => {+ const seen = [];+ globalThis.fetch = async (url, init = {}) => {+ const target = String(url);+ seen.push({ url: target, headers: init.headers || {} });++ if (target === "https://ngw.devices.sberbank.ru:9443/api/v2/oauth") {+ assert.equal(init.headers.Authorization, "Basic gigachat-basic-creds");+ return new Response(+ JSON.stringify({+ tok: "gigachat-access-token",+ exp: Date.now() + 60 * 60 * 1000,+ }),+ { status: 200 }+ );+ }+ if (target === "https://us.inference.heroku.com/v1/chat/completions") {+ assert.equal(init.headers.Authorization, "Bearer heroku-key");+ return new Response(JSON.stringify({ error: "bad request" }), { status: 400 });+ }+ if (+ target ===+ "https://adb-1234567890123456.7.azuredatabricks.net/serving-endpoints/chat/completions"+ ) {+ assert.equal(init.headers.Authorization, "Bearer databricks-key");+ return new Response(JSON.stringify({ error: "unprocessable" }), { status: 422 });+ }+ if (target === "https://account.snowflakecomputing.com/api/v2/cortex/inference:complete") {+ assert.equal(init.headers.Authorization, "Bearer snowflake-token");+ assert.equal(+ init.headers["X-Snowflake-Authorization-Token-Type"],+ "PROGRAMMATIC_ACCESS_TOKEN"+ );+ return new Response(JSON.stringify({ error: "bad request" }), { status: 400 });+ }+ if (target === "https://gigachat.devices.sberbank.ru/api/v1/chat/completions") {+ assert.equal(init.headers.Authorization, "Bearer gigachat-access-token");+ return new Response(JSON.stringify({ error: "bad request" }), { status: 400 });+ }++ throw new Error(`unexpected fetch: ${target}`);+ };++ const heroku = await validateProviderApiKey({+ provider: "heroku",+ apiKey: "heroku-key",+ providerSpecificData: { baseUrl: "https://us.inference.heroku.com" },+ });+ const databricks = await validateProviderApiKey({+ provider: "databricks",+ apiKey: "databricks-key",+ providerSpecificData: {+ baseUrl: "https://adb-1234567890123456.7.azuredatabricks.net/serving-endpoints",+ },+ });+ const snowflake = await validateProviderApiKey({+ provider: "snowflake",+ apiKey: "pat/snowflake-token",+ providerSpecificData: { baseUrl: "https://account.snowflakecomputing.com" },+ });+ const gigachat = await validateProviderApiKey({+ provider: "gigachat",+ apiKey: "gigachat-basic-creds",+ });++ assert.equal(heroku.valid, true);+ assert.equal(databricks.valid, true);+ assert.equal(snowflake.valid, true);+ assert.equal(gigachat.valid, true);+ assert.equal(+ seen.some((call) => call.url === "https://ngw.devices.sberbank.ru:9443/api/v2/oauth"),+ true+ );+});++test("specialty validators surface missing base URLs and invalid auth for Heroku, Databricks, Snowflake and GigaChat", async () => {+ const missingHerokuBase = await validateProviderApiKey({+ provider: "heroku",+ apiKey: "heroku-key",+ providerSpecificData: {},+ });+ const missingDatabricksBase = await validateProviderApiKey({+ provider: "databricks",+ apiKey: "databricks-key",+ providerSpecificData: {},+ });+ const missingSnowflakeBase = await validateProviderApiKey({+ provider: "snowflake",+ apiKey: "snowflake-key",+ providerSpecificData: {},+ });++ globalThis.fetch = async (url) => {+ const target = String(url);+ if (target === "https://ngw.devices.sberbank.ru:9443/api/v2/oauth") {+ return new Response(JSON.stringify({ error: "unauthorized" }), { status: 401 });+ }+ if (target === "https://us.inference.heroku.com/v1/chat/completions") {+ return new Response(JSON.stringify({ error: "unauthorized" }), { status: 401 });+ }+ if (+ target ===+ "https://adb-1234567890123456.7.azuredatabricks.net/serving-endpoints/chat/completions"+ ) {+ return new Response(JSON.stringify({ error: "forbidden" }), { status: 403 });+ }+ if (target === "https://account.snowflakecomputing.com/api/v2/cortex/inference:complete") {+ return new Response(JSON.stringify({ error: "unauthorized" }), { status: 401 });+ }+ throw new Error(`unexpected fetch: ${target}`);+ };++ const herokuInvalid = await validateProviderApiKey({+ provider: "heroku",+ apiKey: "heroku-key",+ providerSpecificData: { baseUrl: "https://us.inference.heroku.com" },+ });+ const databricksInvalid = await validateProviderApiKey({+ provider: "databricks",+ apiKey: "databricks-key",+ providerSpecificData: {+ baseUrl: "https://adb-1234567890123456.7.azuredatabricks.net/serving-endpoints",+ },+ });+ const snowflakeInvalid = await validateProviderApiKey({+ provider: "snowflake",+ apiKey: "snowflake-key",+ providerSpecificData: { baseUrl: "https://account.snowflakecomputing.com" },+ });+ const gigachatInvalid = await validateProviderApiKey({+ provider: "gigachat",+ apiKey: "gigachat-basic-creds-invalid",+ });++ assert.equal(missingHerokuBase.error, "Missing base URL");+ assert.equal(missingDatabricksBase.error, "Missing base URL");+ assert.equal(missingSnowflakeBase.error, "Missing base URL");+ assert.equal(herokuInvalid.error, "Invalid API key");+ assert.equal(databricksInvalid.error, "Invalid API key");+ assert.equal(snowflakeInvalid.error, "Invalid API key");+ assert.equal(gigachatInvalid.error, "Invalid API key");+});diff --git a/tests/unit/providers-validate-route.test.mjs b/tests/unit/providers-validate-route.test.mjsindex dba8a1de6c..bb86aff06f 100644--- a/tests/unit/providers-validate-route.test.mjs+++ b/tests/unit/providers-validate-route.test.mjs@@ -65,3 +65,36 @@ test("providers validate route returns 400 for invalid provider type", async ()// Should return 400 for unsupportedassert.equal(response.status, 400);});++test("providers validate route forwards baseUrl to built-in specialty validators", async () => {+ await resetStorage();++ const originalFetch = globalThis.fetch;+ globalThis.fetch = async (url, init = {}) => {+ if (String(url) === "https://us.inference.heroku.com/v1/chat/completions") {+ assert.equal(init.headers.Authorization, "Bearer heroku-key");+ return new Response(JSON.stringify({ error: "bad request" }), { status: 400 });+ }+ throw new Error(`unexpected fetch: ${url}`);+ };++ try {+ const request = new Request("http://localhost/api/providers/validate", {+ method: "POST",+ body: JSON.stringify({+ provider: "heroku",+ apiKey: "heroku-key",+ baseUrl: "https://us.inference.heroku.com",+ }),+ });++ const response = await validateRoute.POST(request);+ const body = await response.json();++ assert.equal(response.status, 200);+ assert.equal(body.valid, true);+ assert.equal(body.error, null);+ } finally {+ globalThis.fetch = originalFetch;+ }+});