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
Merge FASE 4: diagrams folder with 8 Mermaid + SVGs
diegosouzapw4968de9405cb
diff --cc docs/architecture/ARCHITECTURE.mdindex 3b1d15c68c,e3880b477a..bd814b3ee2--- a/docs/architecture/ARCHITECTURE.md+++ b/docs/architecture/ARCHITECTURE.md@@@ -78,6 -78,21 +78,21 @@@ Primary runtime model- Next.js app routes under `src/app/api/*` implement both dashboard APIs and compatibility APIs- A shared SSE/routing core in `src/sse/*` + `open-sse/*` handles provider execution, translation, streaming, fallback, and usage+ ## Reference Diagrams++ Canonical, version-controlled Mermaid sources for the v3.8.0 platform live in-[`docs/diagrams/`](./diagrams/README.md). Two are reproduced below for orientation;++[`docs/diagrams/`](../diagrams/README.md). Two are reproduced below for orientation;+ the rest are linked from their domain-specific guides.+-+++-> Source: [diagrams/request-pipeline.mmd](./diagrams/request-pipeline.mmd)++> Source: [diagrams/request-pipeline.mmd](../diagrams/request-pipeline.mmd)+-+++-> Source: [diagrams/resilience-3layers.mmd](./diagrams/resilience-3layers.mmd) — also linked from++> Source: [diagrams/resilience-3layers.mmd](../diagrams/resilience-3layers.mmd) — also linked from+ > [RESILIENCE_GUIDE.md](./RESILIENCE_GUIDE.md) and the `CLAUDE.md` resilience reference.+## Scope and Boundaries### In Scopediff --cc docs/architecture/AUTHZ_GUIDE.mdindex 6f3a18575c,b7128a1cee..51aa328fce--- a/docs/architecture/AUTHZ_GUIDE.md+++ b/docs/architecture/AUTHZ_GUIDE.md@@@ -5,6 -5,10 +5,10 @@@OmniRoute has a route-aware authorization pipeline that gates every API request. Classification is **deterministic** and **fail-closed** — anything that cannot be classified ends up as `MANAGEMENT` and demands a session or management-grade token. This page explains the model for engineers maintaining routes or designing new endpoints.-+++-> Source: [diagrams/authz-pipeline.mmd](./diagrams/authz-pipeline.mmd)++> Source: [diagrams/authz-pipeline.mmd](../diagrams/authz-pipeline.mmd)+## Two Auth Modes### 1. API Key (Bearer)diff --cc docs/architecture/CODEBASE_DOCUMENTATION.mdindex 95608bb023,e4d944573d..1a2f70c2c5--- a/docs/architecture/CODEBASE_DOCUMENTATION.md+++ b/docs/architecture/CODEBASE_DOCUMENTATION.md@@@ -286,6 -286,10 +286,10 @@@ Top-level files in `src/lib/`Singleton SQLite database (`getDbInstance()` in `core.ts`, WAL journaling).**Never write raw SQL in routes or handlers** — go through these modules.-+++-> Source: [diagrams/db-schema-overview.mmd](./diagrams/db-schema-overview.mmd)++> Source: [diagrams/db-schema-overview.mmd](../diagrams/db-schema-overview.mmd)+Domain modules (each owns one or more tables): `apiKeys.ts`, `backup.ts`,`batches.ts`, `cleanup.ts`, `cliToolState.ts`, `combos.ts`,`commandCodeAuth.ts`, `compression.ts`, `compressionAnalytics.ts`,@@@ -643,6 -642,10 +647,10 @@@ Organized into 6 subfolders by purpose## 9. Request Pipeline (Summary)-+++-> Source: [diagrams/request-pipeline.mmd](./diagrams/request-pipeline.mmd)++> Source: [diagrams/request-pipeline.mmd](../diagrams/request-pipeline.mmd)+```Client request→ /v1/chat/completions (route.ts)diff --cc docs/architecture/RESILIENCE_GUIDE.mdindex e851f07498,085f0b25ae..06b2893d7a--- a/docs/architecture/RESILIENCE_GUIDE.md+++ b/docs/architecture/RESILIENCE_GUIDE.md@@@ -2,6 -2,10 +2,10 @@@OmniRoute has three distinct but related resilience mechanisms. Each has a different scope and purpose. Keep them separate when debugging routing behavior.-+++-> Source: [diagrams/resilience-3layers.mmd](./diagrams/resilience-3layers.mmd)++> Source: [diagrams/resilience-3layers.mmd](../diagrams/resilience-3layers.mmd)+## 1. Provider Circuit Breaker**Scope:** entire provider (e.g., `glm`, `openai`, `anthropic`).diff --cc docs/diagrams/README.mdindex 33560b242c,9912a4ddd4..31829d168a--- a/docs/diagrams/README.md+++ b/docs/diagrams/README.md@@@ -1,13 -1,48 +1,56 @@@# Diagrams- Mermaid sources (`.mmd`) and exported SVGs/PNGs for architecture flows.+ Mermaid sources (`.mmd`) and exported SVGs for OmniRoute v3.8.0 architecture flows.- Populated incrementally — FASE 4 of the platform overhaul creates 8 canonical diagrams.+ ## Canonical diagrams- Source diagrams: link from architecture docs using:-| Source | Exported | Used in |-| -------------------------------------------------- | ---------------------------------------- | ---------------------------------------------------- |-| [request-pipeline.mmd](./request-pipeline.mmd) | [SVG](./exported/request-pipeline.svg) | docs/ARCHITECTURE.md, docs/CODEBASE_DOCUMENTATION.md |-| [auto-combo-9factor.mmd](./auto-combo-9factor.mmd) | [SVG](./exported/auto-combo-9factor.svg) | docs/AUTO-COMBO.md |-| [resilience-3layers.mmd](./resilience-3layers.mmd) | [SVG](./exported/resilience-3layers.svg) | docs/RESILIENCE_GUIDE.md, CLAUDE.md |-| [i18n-flow.mmd](./i18n-flow.mmd) | [SVG](./exported/i18n-flow.svg) | docs/I18N.md |-| [mcp-tools-37.mmd](./mcp-tools-37.mmd) | [SVG](./exported/mcp-tools-37.svg) | docs/MCP-SERVER.md |-| [cloud-agent-flow.mmd](./cloud-agent-flow.mmd) | [SVG](./exported/cloud-agent-flow.svg) | docs/CLOUD_AGENT.md |-| [authz-pipeline.mmd](./authz-pipeline.mmd) | [SVG](./exported/authz-pipeline.svg) | docs/AUTHZ_GUIDE.md |-| [db-schema-overview.mmd](./db-schema-overview.mmd) | [SVG](./exported/db-schema-overview.svg) | docs/CODEBASE_DOCUMENTATION.md |++| Source | Exported | Used in |++| -------------------------------------------------- | ---------------------------------------- | ------------------------------------------------------------------------------ |++| [request-pipeline.mmd](./request-pipeline.mmd) | [SVG](./exported/request-pipeline.svg) | docs/architecture/ARCHITECTURE.md, docs/architecture/CODEBASE_DOCUMENTATION.md |++| [auto-combo-9factor.mmd](./auto-combo-9factor.mmd) | [SVG](./exported/auto-combo-9factor.svg) | docs/routing/AUTO-COMBO.md |++| [resilience-3layers.mmd](./resilience-3layers.mmd) | [SVG](./exported/resilience-3layers.svg) | docs/architecture/RESILIENCE_GUIDE.md, CLAUDE.md |++| [i18n-flow.mmd](./i18n-flow.mmd) | [SVG](./exported/i18n-flow.svg) | docs/guides/I18N.md |++| [mcp-tools-37.mmd](./mcp-tools-37.mmd) | [SVG](./exported/mcp-tools-37.svg) | docs/frameworks/MCP-SERVER.md |++| [cloud-agent-flow.mmd](./cloud-agent-flow.mmd) | [SVG](./exported/cloud-agent-flow.svg) | docs/frameworks/CLOUD_AGENT.md |++| [authz-pipeline.mmd](./authz-pipeline.mmd) | [SVG](./exported/authz-pipeline.svg) | docs/architecture/AUTHZ_GUIDE.md |++| [db-schema-overview.mmd](./db-schema-overview.mmd) | [SVG](./exported/db-schema-overview.svg) | docs/architecture/CODEBASE_DOCUMENTATION.md |++ ## How to update++ 1. Edit `*.mmd`.+ 2. Re-render: `npm run docs:render-diagrams` (uses `@mermaid-js/mermaid-cli`).+ 3. Commit both `.mmd` and `.svg`.++ If `@mermaid-js/mermaid-cli` is not available locally, install it once:++ ```bash+ npm install -g @mermaid-js/mermaid-cli+ ```++ The script renders every `.mmd` in `docs/diagrams/` into `docs/diagrams/exported/*.svg`+ with a white background, suitable for both dark and light themes.++ ## Linking from a doc+++From a doc in `docs/<subfolder>/`, the relative path becomes `../diagrams/...`:+```markdown- -+++- > [Mermaid source](./diagram-name.mmd)++> Source: [../diagrams/request-pipeline.mmd](../diagrams/request-pipeline.mmd)+```+-> Source: [diagrams/request-pipeline.mmd](./diagrams/request-pipeline.mmd)++From the repo root (e.g. `CLAUDE.md`):++++```markdown+++ ```++ ## Conventions++ - One concept per diagram. Don't try to fit the whole platform in one chart.-- Keep node labels short (3–6 words). Use `<br/>` for line breaks inside nodes.++- Keep node labels short (3-6 words). Use `<br/>` for line breaks inside nodes.+ - Prefer `flowchart LR` for pipelines and `flowchart TB` for layered models.+ - Use `sequenceDiagram` for interactive (request/response) flows.+ - Use `erDiagram` for database schema overviews.+ - Update both `.mmd` and `.svg` in the same commit. Keep them in lock-step.diff --cc docs/frameworks/CLOUD_AGENT.mdindex f585efe629,5bd7b64575..22173d4fd6--- a/docs/frameworks/CLOUD_AGENT.md+++ b/docs/frameworks/CLOUD_AGENT.md@@@ -12,6 -12,10 +12,10 @@@ A Cloud Agent task is **not** a regulaunit of work that may take minutes to hours, can produce a Pull Request as itsartifact, and supports follow-up messages and (in some providers) plan approval gates.-+++-> Source: [diagrams/cloud-agent-flow.mmd](./diagrams/cloud-agent-flow.mmd)++> Source: [diagrams/cloud-agent-flow.mmd](../diagrams/cloud-agent-flow.mmd)+## Supported Agents| Provider ID | Class | Source | Upstream Base URL | Plan Approval |diff --cc docs/frameworks/MCP-SERVER.mdindex 92f2120b61,ee1b87ec55..b03fbc98aa--- a/docs/frameworks/MCP-SERVER.md+++ b/docs/frameworks/MCP-SERVER.md@@@ -4,6 -4,10 +4,10 @@@>> Source of truth: `open-sse/mcp-server/schemas/tools.ts` (30 tools) + `open-sse/mcp-server/tools/memoryTools.ts` (3 tools) + `open-sse/mcp-server/tools/skillTools.ts` (4 tools). Tool registration and scope wiring lives in `open-sse/mcp-server/server.ts`.-+++-> Source: [diagrams/mcp-tools-37.mmd](./diagrams/mcp-tools-37.mmd)++> Source: [diagrams/mcp-tools-37.mmd](../diagrams/mcp-tools-37.mmd)+## InstallationOmniRoute MCP is built-in. Start it with:diff --cc docs/guides/I18N.mdindex 7564f66197,3a6264b86b..db85d72746--- a/docs/guides/I18N.md+++ b/docs/guides/I18N.md@@@ -17,6 -17,10 +17,10 @@@ OmniRoute supports **30 languages** wit## Architecture-+++-> Source: [diagrams/i18n-flow.mmd](./diagrams/i18n-flow.mmd)++> Source: [diagrams/i18n-flow.mmd](../diagrams/i18n-flow.mmd)+### Source of Truth- **UI strings**: `src/i18n/messages/en.json` (English source, ~2800 keys)diff --cc docs/i18n/in/docs/guides/I18N.mdindex c2676241d3,142bd074b2..909472adf2--- a/docs/i18n/in/docs/guides/I18N.md+++ b/docs/i18n/in/docs/guides/I18N.md@@@ -19,6 -19,6 +19,10 @@@ OmniRoute supports **30 languages** wit## आर्किटेक्चर++++++> Source: [diagrams/i18n-flow.mmd](./diagrams/i18n-flow.mmd)++### Source of Truth- **UI strings**: `src/i18n/messages/en.json` (English source, ~2800 keys)diff --cc docs/routing/AUTO-COMBO.mdindex 14421afd6a,a15fd2d756..689dd33f3a--- a/docs/routing/AUTO-COMBO.md+++ b/docs/routing/AUTO-COMBO.md@@@ -77,6 -77,10 +77,10 @@@ Auto-scoring selects best provider/modeThe Auto-Combo Engine dynamically selects the best provider/model for each request using a **9-factor scoring function** (defined in `open-sse/services/autoCombo/scoring.ts` → `DEFAULT_WEIGHTS`). All weights sum to **1.0**.-+++-> Source: [diagrams/auto-combo-9factor.mmd](./diagrams/auto-combo-9factor.mmd)++> Source: [diagrams/auto-combo-9factor.mmd](../diagrams/auto-combo-9factor.mmd)+| Factor | Default Weight | Description || :----------------- | :------------- | :---------------------------------------------------------------------- || `health` | 0.22 | Health score from circuit breaker (CLOSED=1.0, HALF_OPEN=0.5, OPEN=0.0) |diff --cc package.jsonindex 33055ac46f,ccc0f0f644..6f71fe0921--- a/package.json+++ b/package.json@@@ -79,16 -79,17 +79,17 @@@"test:plan3": "cross-env DISABLE_SQLITE_AUTO_BACKUP=true node --import tsx/esm --test tests/unit/plan3-p0.test.ts","test:fixes": "cross-env DISABLE_SQLITE_AUTO_BACKUP=true node --import tsx/esm --test tests/unit/fixes-p1.test.ts","test:security": "cross-env DISABLE_SQLITE_AUTO_BACKUP=true node --import tsx/esm --test tests/unit/security-fase01.test.ts",- "check:cycles": "node scripts/check-cycles.mjs",- "check:route-validation:t06": "node scripts/check-route-validation.mjs",- "check:any-budget:t11": "node scripts/check-t11-any-budget.mjs",- "check:docs-sync": "node scripts/check-docs-sync.mjs",- "check:env-doc-sync": "node scripts/check-env-doc-sync.mjs",- "check:docs-counts": "node scripts/check-docs-counts-sync.mjs",- "check:deprecated-versions": "node scripts/check-deprecated-versions.mjs",+ "check:cycles": "node scripts/check/check-cycles.mjs",+ "check:route-validation:t06": "node scripts/check/check-route-validation.mjs",+ "check:any-budget:t11": "node scripts/check/check-t11-any-budget.mjs",+ "check:docs-sync": "node scripts/check/check-docs-sync.mjs",+ "check:env-doc-sync": "node scripts/check/check-env-doc-sync.mjs",+ "check:docs-counts": "node scripts/check/check-docs-counts-sync.mjs",+ "check:deprecated-versions": "node scripts/check/check-deprecated-versions.mjs","check:docs-all": "npm run check:docs-sync && npm run check:docs-counts && npm run check:env-doc-sync && npm run check:deprecated-versions",+ "docs:render-diagrams": "node scripts/docs/render-diagrams.mjs",- "check:node-runtime": "node --import tsx/esm scripts/check-supported-node-runtime.ts",- "check:pack-artifact": "node --import tsx/esm scripts/validate-pack-artifact.ts",+ "check:node-runtime": "node --import tsx/esm scripts/check/check-supported-node-runtime.ts",+ "check:pack-artifact": "node --import tsx/esm scripts/build/validate-pack-artifact.ts","audit:deps": "npm audit --audit-level=moderate && npm run audit:electron","audit:electron": "npm --prefix electron audit --audit-level=moderate","typecheck:core": "tsc --pretty false -p tsconfig.typecheck-core.json",