Files
OmniRoute/docs/diagrams/request-pipeline.mmd
diegosouzapw 675668c430 docs(diagrams): create 8 canonical Mermaid sources + folder structure
Introduce docs/diagrams/ with the README index and 8 versioned Mermaid
sources that reflect the v3.8.0 platform:

- request-pipeline.mmd     /v1/chat/completions request pipeline
- auto-combo-9factor.mmd   Auto-Combo 9-factor scoring weights
- resilience-3layers.mmd   Provider breaker / cooldown / model lockout
- i18n-flow.mmd            Hash-based incremental doc translation
- mcp-tools-37.mmd         MCP Server tool inventory by category
- cloud-agent-flow.mmd     Codex / Devin / Jules task lifecycle
- authz-pipeline.mmd       3-class authz pipeline (PUBLIC/CLIENT_API/MANAGEMENT)
- db-schema-overview.mmd   Selected core SQLite relations

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 13:53:56 -03:00

25 lines
1.2 KiB
Plaintext

%% Request pipeline for /v1/chat/completions
%% Reflects: src/app/api/v1/chat/completions/route.ts → open-sse/handlers/chatCore.ts
%% v3.8.0
flowchart LR
Client["Client<br/>(IDE/CLI/SDK)"] --> Route["Next.js Route<br/>/v1/chat/completions"]
Route --> CORS["CORS preflight"]
CORS --> Validate["Zod validation<br/>(request body)"]
Validate --> Authz["AuthZ pipeline<br/>(extractApiKey +<br/>isValidApiKey)"]
Authz --> Policy["API key policy<br/>(allowlist + scopes)"]
Policy --> Guard["Prompt-injection<br/>guardrail"]
Guard --> ChatCore["handleChatCore"]
ChatCore --> Cache{"Cache hit?"}
Cache -->|yes| Return["Return cached"]
Cache -->|no| Rate["Rate limit<br/>(per-key, per-IP)"]
Rate --> Combo{"Combo<br/>target?"}
Combo -->|combo| Resolve["resolveComboTargets<br/>(14 strategies)"]
Resolve --> Single["handleSingleModel<br/>(per target)"]
Combo -->|single| Single
Single --> Translate["translateRequest<br/>(OpenAI↔Claude↔Gemini)"]
Translate --> Exec["getExecutor<br/>(31 executors)"]
Exec --> Upstream["Upstream Provider<br/>(177 providers)"]
Upstream --> Stream["SSE / JSON"]
Stream --> Transformer["responsesTransformer<br/>(Responses↔Chat)"]
Transformer --> Client