|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| export interface OpenApiEndpoint {
|
|
|
| path: string;
|
|
|
| method: string;
|
|
|
| summary: string;
|
|
|
| description: string;
|
|
|
| tag: string;
|
|
|
| tags: string[];
|
|
|
| requiresAuth: boolean;
|
|
|
| hasRequestBody: boolean;
|
| }
|
|
|
| export const OPENAPI_VERSION = "3.8.7";
|
| 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/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();
|
|
|