Files
OmniRoute/src/app/docs/lib/openapi.generated.ts
Septianata Rizky Pratama 45310f202d fix: auto-start WS server in-process and change default port to 20132 (#6072)
* feat: change default LIVE_WS_PORT from 20129 to 20132

Update the default WebSocket port for the live dashboard server from 20129 to 20132 across all configuration files, documentation, code comments, and tests. Also consolidate OMNIROUTE_DISABLE_LIVE_WS and OMNIROUTE_ENABLE_LIVE_WS into a single OMNIROUTE_ENABLE_LIVE_WS flag. Wire the live WebSocket server to start in-process via instrumentation-node.ts.

* feat: clarify NEXT_PUBLIC_LIVE_WS_PUBLIC_URL path usage and derive upgrade path from URL

Update .env.example and ENVIRONMENT.md to document that the pathname portion of NEXT_PUBLIC_LIVE_WS_PUBLIC_URL (e.g. /live-ws) is used as the WebSocket upgrade path by the dev proxy, handshake response, and client connection logic.

Extract deriveLiveWsPath() into shared/utils/wsPath.ts and wire it through:
- src/app/api/v1/ws/route.ts — handshake response path field
- src/hooks/useLiveDashboard.ts — build

* fix: use the standard URL API to safely parse and update the effectiveWsUrl

* build(docker): expose live WebSocket server port and configure CORS origins

Add LIVE_WS_PORT (20132), LIVE_WS_HOST (0.0.0.0), and LIVE_WS_ALLOWED_ORIGINS environment variables to all Docker Compose profiles and expose the WebSocket port mapping. Prevent infinite self-loop in standalone-server-ws.mjs by skipping proxy when the server itself is running on the LiveWS port.

* docs(env): fix comment formatting for HOST and HOSTNAME variables

---------

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
2026-07-11 01:01:27 -03:00

239 lines
7.0 KiB
TypeScript

// AUTO-GENERATED by scripts/docs/gen-openapi-module.mjs — DO NOT EDIT MANUALLY
// Regenerate with: node scripts/docs/gen-openapi-module.mjs
//
// Source of truth: docs/openapi.yaml
//
// The Api Explorer consumes `OPENAPI_ENDPOINTS`; the spec metadata
// (`OPENAPI_VERSION`, `OPENAPI_TITLE`) is surfaced in the page header.
export interface OpenApiEndpoint {
/** Path template — may contain `{param}` placeholders. */
path: string;
/** HTTP method in upper case (GET / POST / PUT / DELETE / PATCH / ...). */
method: string;
/** Short one-line summary from the spec. */
summary: string;
/** Long-form description (markdown is allowed). */
description: string;
/** Primary tag — used for sidebar grouping in the Api Explorer. */
tag: string;
/** All tags declared on the operation. */
tags: string[];
/** `true` when the operation declares a non-empty `security` array. */
requiresAuth: boolean;
/** `true` when the operation declares a `requestBody`. */
hasRequestBody: boolean;
}
export const OPENAPI_VERSION = "3.8.35";
export const OPENAPI_TITLE = "OmniRoute API";
export const OPENAPI_ENDPOINTS: OpenApiEndpoint[] = [
{
path: "/api/v1",
method: "GET",
summary: "API v1 root endpoint",
description: "Returns basic API info and status.",
tag: "System",
tags: ["System"],
requiresAuth: true,
hasRequestBody: false,
},
{
path: "/api/v1/api/chat",
method: "POST",
summary: "Ollama-compatible chat endpoint",
description: "Provides compatibility with Ollama's /api/chat format.",
tag: "Chat",
tags: ["Chat"],
requiresAuth: true,
hasRequestBody: true,
},
{
path: "/api/v1/audio/speech",
method: "POST",
summary: "Generate speech audio",
description: "Text-to-speech endpoint. Routes to configured TTS providers.",
tag: "Audio",
tags: ["Audio"],
requiresAuth: true,
hasRequestBody: true,
},
{
path: "/api/v1/audio/transcriptions",
method: "POST",
summary: "Transcribe audio",
description: "Audio-to-text transcription endpoint.",
tag: "Audio",
tags: ["Audio"],
requiresAuth: true,
hasRequestBody: true,
},
{
path: "/api/v1/chat/completions",
method: "POST",
summary: "Create chat completion",
description: "OpenAI-compatible chat completions endpoint. Routes to configured providers.",
tag: "Chat",
tags: ["Chat"],
requiresAuth: true,
hasRequestBody: true,
},
{
path: "/api/v1/embeddings",
method: "POST",
summary: "Create embeddings",
description: "",
tag: "Embeddings",
tags: ["Embeddings"],
requiresAuth: true,
hasRequestBody: true,
},
{
path: "/api/v1/images/generations",
method: "POST",
summary: "Generate images",
description: "",
tag: "Images",
tags: ["Images"],
requiresAuth: true,
hasRequestBody: true,
},
{
path: "/api/v1/messages",
method: "POST",
summary: "Create message (Anthropic-compatible)",
description: "Anthropic Messages API endpoint. Routes to Claude providers.",
tag: "Messages",
tags: ["Messages"],
requiresAuth: true,
hasRequestBody: true,
},
{
path: "/api/v1/messages/count_tokens",
method: "POST",
summary: "Count tokens for a message",
description: "",
tag: "Messages",
tags: ["Messages"],
requiresAuth: true,
hasRequestBody: true,
},
{
path: "/api/v1/models",
method: "GET",
summary: "List available models",
description: "Returns all models available across configured providers.",
tag: "Models",
tags: ["Models"],
requiresAuth: true,
hasRequestBody: false,
},
{
path: "/api/v1/moderations",
method: "POST",
summary: "Create moderation",
description: "Content moderation endpoint. Routes to configured moderation providers.",
tag: "Moderations",
tags: ["Moderations"],
requiresAuth: true,
hasRequestBody: true,
},
{
path: "/api/v1/providers/{provider}/chat/completions",
method: "POST",
summary: "Create chat completion (provider-specific)",
description: "Routes to a specific provider by name.",
tag: "Chat",
tags: ["Chat"],
requiresAuth: true,
hasRequestBody: true,
},
{
path: "/api/v1/providers/{provider}/embeddings",
method: "POST",
summary: "Create embeddings (provider-specific)",
description: "",
tag: "Embeddings",
tags: ["Embeddings"],
requiresAuth: true,
hasRequestBody: true,
},
{
path: "/api/v1/providers/{provider}/images/generations",
method: "POST",
summary: "Generate images (provider-specific)",
description: "",
tag: "Images",
tags: ["Images"],
requiresAuth: true,
hasRequestBody: true,
},
{
path: "/api/v1/providers/{provider}/models",
method: "GET",
summary: "List models for a specific provider",
description:
"Returns only models for the selected provider with provider prefix removed from each model id.",
tag: "Models",
tags: ["Models"],
requiresAuth: true,
hasRequestBody: false,
},
{
path: "/api/v1/rerank",
method: "POST",
summary: "Rerank documents",
description: "Document reranking endpoint.",
tag: "Rerank",
tags: ["Rerank"],
requiresAuth: true,
hasRequestBody: true,
},
{
path: "/api/v1/responses",
method: "POST",
summary: "Create response (OpenAI Responses API)",
description: "OpenAI Responses API endpoint.",
tag: "Responses",
tags: ["Responses"],
requiresAuth: true,
hasRequestBody: true,
},
{
path: "/api/v1/ws",
method: "GET",
summary: "Chat completion over WebSocket (handshake + upgrade)",
description:
'OpenAI-compatible chat over a WebSocket connection. `GET` with `?handshake=1` returns the connection descriptor (auth path, message protocol and live-event channels) as JSON; a plain `GET` without an Upgrade returns `426 Upgrade Required`. After upgrading, the client exchanges JSON frames — `{type:"request", id, payload:{model, messages}}` to start a completion and `{type:"cancel", id}` to abort it. A separate live channel (default port `LIVE_WS_PORT=20132`, path `/live`) streams dashboard events on the `requests`, `combo` and `credentials` topics with a 15s heartbeat. Requires an API key.',
tag: "Chat",
tags: ["Chat"],
requiresAuth: true,
hasRequestBody: false,
},
{
path: "/api/v1beta/models",
method: "GET",
summary: "List models (Gemini format)",
description: "Returns models in Gemini v1beta format for native SDK compatibility",
tag: "Models",
tags: ["Models"],
requiresAuth: true,
hasRequestBody: false,
},
{
path: "/api/v1beta/models/{path}",
method: "POST",
summary: "Gemini generateContent",
description: "Gemini-compatible generateContent endpoint",
tag: "Models",
tags: ["Models"],
requiresAuth: true,
hasRequestBody: true,
},
];
export const OPENAPI_TAGS: string[] = Array.from(
new Set(OPENAPI_ENDPOINTS.map((endpoint) => endpoint.tag))
).sort();