Skip to content

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

Merge branch 'main' into fix/streaming-reasoning-field-alias

diegosouzapwe90c9c171a1a
diff --cc docs/MCP-SERVER.md
index 5de3579f5e,1a20feb758..2f8e6bab3f
--- a/docs/MCP-SERVER.md
+++ b/docs/MCP-SERVER.md
@@@ -38,16 -38,16 +38,16 @@@ See [IDE Configs](integrations/ide-conf
## Advanced Tools (8)
--| Tool | Description |
--| :--------------------------------- | :---------------------------------------------- |
--| `omniroute_simulate_route` | Dry-run routing simulation with fallback tree |
--| `omniroute_set_budget_guard` | Session budget with degrade/block/alert actions |
--| `omniroute_set_resilience_profile` | Apply conservative/balanced/aggressive preset |
- | `omniroute_test_combo` | Live-test all models in a combo |
- | `omniroute_get_provider_metrics` | Detailed metrics for one provider |
- | `omniroute_best_combo_for_task` | Task-fitness recommendation with alternatives |
- | `omniroute_explain_route` | Explain a past routing decision |
- | `omniroute_get_session_snapshot` | Full session state: costs, tokens, errors |
++| Tool | Description |
++| :--------------------------------- | :---------------------------------------------------------- |
++| `omniroute_simulate_route` | Dry-run routing simulation with fallback tree |
++| `omniroute_set_budget_guard` | Session budget with degrade/block/alert actions |
++| `omniroute_set_resilience_profile` | Apply conservative/balanced/aggressive preset |
+ | `omniroute_test_combo` | Live-test all models in a combo via a real upstream request |
-| `omniroute_get_provider_metrics` | Detailed metrics for one provider |
-| `omniroute_best_combo_for_task` | Task-fitness recommendation with alternatives |
-| `omniroute_explain_route` | Explain a past routing decision |
-| `omniroute_get_session_snapshot` | Full session state: costs, tokens, errors |
++| `omniroute_get_provider_metrics` | Detailed metrics for one provider |
++| `omniroute_best_combo_for_task` | Task-fitness recommendation with alternatives |
++| `omniroute_explain_route` | Explain a past routing decision |
++| `omniroute_get_session_snapshot` | Full session state: costs, tokens, errors |
## Authentication
diff --cc open-sse/mcp-server/README.md
index 1ceb90c459,c70858f2a0..d184286e61
--- a/open-sse/mcp-server/README.md
+++ b/open-sse/mcp-server/README.md
@@@ -132,16 -132,16 +132,16 @@@ omniroute --mc
### Phase 2: Advanced Tools (8)
--| # | Tool | Scopes | Description |
--| --- | ---------------------------------- | ------------------------------------ | ---------------------------------------------------------------------------- |
--| 9 | `omniroute_simulate_route` | `read:health`, `read:combos` | Dry-run routing simulation showing fallback tree and estimated costs |
--| 10 | `omniroute_set_budget_guard` | `write:budget` | Set session budget with action on exceed: `degrade`, `block`, or `alert` |
--| 11 | `omniroute_set_resilience_profile` | `write:resilience` | Apply resilience profile: `aggressive`, `balanced`, or `conservative` |
- | 12 | `omniroute_test_combo` | `execute:completions`, `read:combos` | Test each provider in a combo with a real prompt, report latency/cost |
- | 13 | `omniroute_get_provider_metrics` | `read:health` | Per-provider metrics with latency percentiles (p50/p95/p99), circuit breaker |
- | 14 | `omniroute_best_combo_for_task` | `read:combos`, `read:health` | AI-powered combo recommendation by task type with budget/latency constraints |
- | 15 | `omniroute_explain_route` | `read:health`, `read:usage` | Explain why a request was routed to a provider (scoring factors, fallbacks) |
- | 16 | `omniroute_get_session_snapshot` | `read:usage` | Full session snapshot: cost, tokens, top models, errors, budget status |
++| # | Tool | Scopes | Description |
++| --- | ---------------------------------- | ------------------------------------ | ---------------------------------------------------------------------------------------------- |
++| 9 | `omniroute_simulate_route` | `read:health`, `read:combos` | Dry-run routing simulation showing fallback tree and estimated costs |
++| 10 | `omniroute_set_budget_guard` | `write:budget` | Set session budget with action on exceed: `degrade`, `block`, or `alert` |
++| 11 | `omniroute_set_resilience_profile` | `write:resilience` | Apply resilience profile: `aggressive`, `balanced`, or `conservative` |
+ | 12 | `omniroute_test_combo` | `execute:completions`, `read:combos` | Test each provider in a combo with a real prompt and a real upstream call, report latency/cost |
-| 13 | `omniroute_get_provider_metrics` | `read:health` | Per-provider metrics with latency percentiles (p50/p95/p99), circuit breaker |
-| 14 | `omniroute_best_combo_for_task` | `read:combos`, `read:health` | AI-powered combo recommendation by task type with budget/latency constraints |
-| 15 | `omniroute_explain_route` | `read:health`, `read:usage` | Explain why a request was routed to a provider (scoring factors, fallbacks) |
-| 16 | `omniroute_get_session_snapshot` | `read:usage` | Full session snapshot: cost, tokens, top models, errors, budget status |
++| 13 | `omniroute_get_provider_metrics` | `read:health` | Per-provider metrics with latency percentiles (p50/p95/p99), circuit breaker |
++| 14 | `omniroute_best_combo_for_task` | `read:combos`, `read:health` | AI-powered combo recommendation by task type with budget/latency constraints |
++| 15 | `omniroute_explain_route` | `read:health`, `read:usage` | Explain why a request was routed to a provider (scoring factors, fallbacks) |
++| 16 | `omniroute_get_session_snapshot` | `read:usage` | Full session snapshot: cost, tokens, top models, errors, budget status |
---
diff --cc open-sse/services/combo.ts
index c9bf705d0f,a9ce1eeeec..bda9d5e16d
--- a/open-sse/services/combo.ts
+++ b/open-sse/services/combo.ts
@@@ -45,6 -45,80 +45,84 @@@ const DEFAULT_MODEL_P95_MS =
};
const MIN_HISTORY_SAMPLES = 10;
+ /**
+ * Validate that a successful (HTTP 200) non-streaming response actually contains
+ * meaningful content. Returns { valid: true } or { valid: false, reason }.
+ *
+ * Only inspects non-streaming JSON responses — streaming responses are passed through
+ * because buffering the full stream would defeat the purpose of streaming.
+ *
+ * Checks:
+ * 1. Body is valid JSON
+ * 2. Has at least one choice with non-empty content or tool_calls
+ */
+ async function validateResponseQuality(
+ response: Response,
+ isStreaming: boolean,
+ log: { warn?: (...args: any[]) => void }
+ ): Promise<{ valid: boolean; reason?: string; clonedResponse?: Response }> {
+ if (isStreaming) return { valid: true };
+
+ const contentType = response.headers.get("content-type") || "";
+ if (!contentType.includes("application/json") && !contentType.includes("text/")) {
+ return { valid: true };
+ }
+
+ let cloned: Response;
+ try {
+ cloned = response.clone();
+ } catch {
+ return { valid: true };
+ }
+
+ let text: string;
+ try {
+ text = await cloned.text();
+ } catch {
+ return { valid: true };
+ }
+
+ if (!text || text.trim().length === 0) {
+ return { valid: false, reason: "empty response body" };
+ }
+
+ let json: any;
+ try {
+ json = JSON.parse(text);
+ } catch {
+ if (text.startsWith("data:")) return { valid: true };
+ return { valid: false, reason: "response is not valid JSON" };
+ }
+
+ const choices = json?.choices;
+ if (!Array.isArray(choices) || choices.length === 0) {
+ if (json?.output || json?.result || json?.data || json?.response) return { valid: true };
- if (json?.error) return { valid: false, reason: `upstream error in 200 body: ${json.error?.message || JSON.stringify(json.error).substring(0, 200)}` };
++ if (json?.error)
++ return {
++ valid: false,
++ reason: `upstream error in 200 body: ${json.error?.message || JSON.stringify(json.error).substring(0, 200)}`,
++ };
+ return { valid: true };
+ }
+
+ const firstChoice = choices[0];
+ const message = firstChoice?.message || firstChoice?.delta;
+ if (!message) {
+ return { valid: false, reason: "choice has no message object" };
+ }
+
+ const content = message.content;
+ const toolCalls = message.tool_calls;
+ const hasContent = content !== null && content !== undefined && content !== "";
+ const hasToolCalls = Array.isArray(toolCalls) && toolCalls.length > 0;
+
+ if (!hasContent && !hasToolCalls) {
+ return { valid: false, reason: "empty content and no tool_calls in response" };
+ }
+
+ return { valid: true };
+ }
+
// In-memory atomic counter per combo for round-robin distribution
// Resets on server restart (by design — no stale state)
const rrCounters = new Map();
diff --cc release_notes.md
index 0000000000,2e84cda3d1..8f347fd5a8
mode 000000,100644..100644
--- a/release_notes.md
+++ b/release_notes.md
@@@ -1,0 -1,17 +1,16 @@@
+ ## [3.2.8] - 2026-03-29
+
+ ### ✨ Enhancements & Refactoring
+
+ - **Docker Auto-Update UI** — Integrated a detached background update process for Docker Compose deployments. The Dashboard UI now seamlessly tracks update lifecycle events combining JSON REST responses with SSE streaming progress overlays for robust cross-environment reliability.
+ - **Cache Analytics** — Repaired zero-metrics visualization mapping by migrating Semantic Cache telemetry logs directly into the centralized tracking SQLite module.
+
+ ### 🐛 Bug Fixes
+
+ - **Authentication Logic** — Fixed a bug where saving dashboard settings or adding models failed with a 401 Unauthorized error when `requireLogin` was disabled. API endpoints now correctly evaluate the global authentication toggle. Resolved global redirection by reactivating `src/middleware.ts`.
+ - **CLI Tool Detection (Windows)** — Prevented fatal initialization exceptions during CLI environment detection by catching `cross-spawn` ENOENT errors correctly. Adds explicit detection paths for `\AppData\Local\droid\droid.exe`.
+ - **Codex Native Passthrough** — Normalized model translation parameters preventing context poisoning in proxy pass-through mode, enforcing generic `store: false` constraints explicitly for all Codex-originated requests.
+ - **SSE Token Reporting** — Normalized provider tool-call chunk `finish_reason` detection, fixing 0% Usage analytics for stream-only responses missing strict `<DONE>` indicators.
+ - **DeepSeek <think> Tags** — Implemented an explicit `<think>` extraction mapping inside `responsesHandler.ts`, ensuring DeepSeek reasoning streams map equivalently to native Anthropic `<thinking>` structures.
+
+ ---
-
diff --cc tests/unit/chat-combo-live-test.test.mjs
index 0000000000,ea4741e785..e8cc552931
mode 000000,100644..100644
--- a/tests/unit/chat-combo-live-test.test.mjs
+++ b/tests/unit/chat-combo-live-test.test.mjs
@@@ -1,0 -1,128 +1,122 @@@
+ import test from "node:test";
+ import assert from "node:assert/strict";
+ import fs from "node:fs";
+ import os from "node:os";
+ import path from "node:path";
+
+ const TEST_DATA_DIR = fs.mkdtempSync(path.join(os.tmpdir(), "omniroute-chat-combo-live-"));
+ process.env.DATA_DIR = TEST_DATA_DIR;
+
+ const core = await import("../../src/lib/db/core.ts");
+ const providersDb = await import("../../src/lib/db/providers.ts");
+ const chatRoute = await import("../../src/app/api/v1/chat/completions/route.ts");
-const {
- clearModelUnavailability,
- resetAllAvailability,
- setModelUnavailable,
-} = await import("../../src/domain/modelAvailability.ts");
-const {
- getCircuitBreaker,
- resetAllCircuitBreakers,
- STATE,
-} = await import("../../src/shared/utils/circuitBreaker.ts");
++const { clearModelUnavailability, resetAllAvailability, setModelUnavailable } =
++ await import("../../src/domain/modelAvailability.ts");
++const { getCircuitBreaker, resetAllCircuitBreakers, STATE } =
++ await import("../../src/shared/utils/circuitBreaker.ts");
+
+ const originalFetch = globalThis.fetch;
+
+ async function resetStorage() {
+ core.resetDbInstance();
+ fs.rmSync(TEST_DATA_DIR, { recursive: true, force: true });
+ fs.mkdirSync(TEST_DATA_DIR, { recursive: true });
+ resetAllAvailability();
+ resetAllCircuitBreakers();
+ }
+
+ async function seedSuppressedConnection() {
+ return providersDb.createProviderConnection({
+ provider: "openai",
+ authType: "apikey",
+ name: "openai-live-test",
+ apiKey: "sk-live-test",
+ isActive: true,
+ testStatus: "credits_exhausted",
+ rateLimitedUntil: new Date(Date.now() + 60_000).toISOString(),
+ });
+ }
+
+ function makeRequest(extraHeaders = {}) {
+ return new Request("http://localhost/v1/chat/completions", {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ ...extraHeaders,
+ },
+ body: JSON.stringify({
+ model: "openai/gpt-4o-mini",
+ messages: [{ role: "user", content: "Reply with OK only." }],
+ max_tokens: 16,
+ stream: false,
+ }),
+ });
+ }
+
+ test.beforeEach(async () => {
+ globalThis.fetch = originalFetch;
+ await resetStorage();
+ });
+
+ test.afterEach(() => {
+ globalThis.fetch = originalFetch;
+ resetAllAvailability();
+ resetAllCircuitBreakers();
+ });
+
+ test.after(() => {
+ globalThis.fetch = originalFetch;
+ resetAllAvailability();
+ resetAllCircuitBreakers();
+ core.resetDbInstance();
+ fs.rmSync(TEST_DATA_DIR, { recursive: true, force: true });
+ });
+
+ test("combo live test bypasses local cooldown and breaker state to perform a real upstream request", async () => {
+ const created = await seedSuppressedConnection();
+
+ setModelUnavailable("openai", "gpt-4o-mini", 60_000, "test cooldown");
+ const breaker = getCircuitBreaker("openai");
+ breaker.state = STATE.OPEN;
+ breaker.lastFailureTime = Date.now();
+
+ const fetchCalls = [];
+ globalThis.fetch = async (url, init = {}) => {
+ fetchCalls.push({ url: String(url), init });
+ return Response.json({
+ id: "chatcmpl-live-test",
+ choices: [
+ {
+ message: {
+ role: "assistant",
+ content: "OK",
+ },
+ },
+ ],
+ });
+ };
+
+ const blockedByCooldown = await chatRoute.POST(makeRequest());
+ assert.equal(blockedByCooldown.status, 503);
+ assert.equal(fetchCalls.length, 0);
+
+ clearModelUnavailability("openai", "gpt-4o-mini");
+
+ const blockedByBreaker = await chatRoute.POST(makeRequest());
+ assert.equal(blockedByBreaker.status, 503);
+ assert.equal(fetchCalls.length, 0);
+
+ const liveResponse = await chatRoute.POST(
+ makeRequest({ "X-Internal-Test": "combo-health-check" })
+ );
+ const liveBody = await liveResponse.json();
+
+ assert.equal(liveResponse.status, 200);
+ assert.equal(fetchCalls.length, 1);
+ assert.match(fetchCalls[0].url, /\/chat\/completions$/);
+ assert.equal(fetchCalls[0].init.headers.Authorization, "Bearer sk-live-test");
+ assert.equal(liveBody.choices[0].message.content, "OK");
+
+ const updated = await providersDb.getProviderConnectionById(created.id);
+ assert.equal(updated.testStatus, "active");
+ });