unified-ai-router 3.3.1 → 3.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/.vitepress/dist/404.html +1 -1
- package/docs/.vitepress/dist/assets/configuration.md.DanKHGkj.js +38 -0
- package/docs/.vitepress/dist/assets/configuration.md.DanKHGkj.lean.js +1 -0
- package/docs/.vitepress/dist/assets/index.md.D1fgr_Mo.js +1 -0
- package/docs/.vitepress/dist/assets/index.md.D1fgr_Mo.lean.js +1 -0
- package/docs/.vitepress/dist/assets/{quickstart.md.CcVBvYS-.js → quickstart.md.mGNzdQVa.js} +2 -2
- package/docs/.vitepress/dist/assets/quickstart.md.mGNzdQVa.lean.js +1 -0
- package/docs/.vitepress/dist/configuration.html +62 -0
- package/docs/.vitepress/dist/hashmap.json +1 -1
- package/docs/.vitepress/dist/index.html +3 -3
- package/docs/.vitepress/dist/quickstart.html +4 -4
- package/docs/index.md +1 -1
- package/package.json +1 -1
- package/docs/.vitepress/dist/assets/index.md.BEq0uQr4.js +0 -1
- package/docs/.vitepress/dist/assets/index.md.BEq0uQr4.lean.js +0 -1
- package/docs/.vitepress/dist/assets/overview.md.CBO-d9uK.js +0 -1
- package/docs/.vitepress/dist/assets/overview.md.CBO-d9uK.lean.js +0 -1
- package/docs/.vitepress/dist/assets/quickstart.md.CcVBvYS-.lean.js +0 -1
- package/docs/.vitepress/dist/overview.html +0 -25
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
</head>
|
|
17
17
|
<body>
|
|
18
18
|
<div id="app"></div>
|
|
19
|
-
<script>window.__VP_HASH_MAP__=JSON.parse("{\"
|
|
19
|
+
<script>window.__VP_HASH_MAP__=JSON.parse("{\"configuration.md\":\"DanKHGkj\",\"index.md\":\"D1fgr_Mo\",\"quickstart.md\":\"mGNzdQVa\"}");window.__VP_SITE_DATA__=JSON.parse("{\"lang\":\"en-US\",\"dir\":\"ltr\",\"title\":\"Unified AI Router\",\"description\":\"OpenAI-compatible router with multi-provider fallback.\",\"base\":\"/Unified-AI-Router/\",\"head\":[],\"router\":{\"prefetchLinks\":true},\"appearance\":true,\"themeConfig\":{\"nav\":[{\"text\":\"Home\",\"link\":\"/\"},{\"text\":\"Quickstart\",\"link\":\"/quickstart\"},{\"text\":\"Configuration\",\"link\":\"/configuration\"}],\"sidebar\":[{\"text\":\"Guide\",\"items\":[{\"text\":\"Quickstart\",\"link\":\"/quickstart\"},{\"text\":\"Configuration\",\"link\":\"/configuration\"}]}],\"socialLinks\":[{\"icon\":\"github\",\"link\":\"https://github.com/mlibre/Unified-AI-Router\"}]},\"locales\":{},\"scrollOffset\":134,\"cleanUrls\":false,\"additionalConfig\":{}}");</script>
|
|
20
20
|
|
|
21
21
|
</body>
|
|
22
22
|
</html>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import{_ as s,c as e,o as a,af as n}from"./chunks/framework.DLCvNBTH.js";const c=JSON.parse('{"title":"Configuration","description":"","frontmatter":{},"headers":[],"relativePath":"configuration.md","filePath":"configuration.md"}'),t={name:"configuration.md"};function l(o,i,r,h,p,d){return a(),e("div",null,[...i[0]||(i[0]=[n(`<h1 id="configuration" tabindex="-1">Configuration <a class="header-anchor" href="#configuration" aria-label="Permalink to “Configuration”"></a></h1><p>This page focuses on how to configure the router for local development and production deployments: setting environment variables (<code>.env</code>) and customizing <code>provider.js</code>.</p><hr><h2 id="goals" tabindex="-1">Goals <a class="header-anchor" href="#goals" aria-label="Permalink to “Goals”"></a></h2><ul><li>Explain which environment variables the project expects and best practices for storing them.</li><li>Show how to author <code>provider.js</code> entries: enabling/disabling providers, ordering (fallback), and useful fields.</li><li>Provide examples for local, staging, and cloud deployments (Vercel / Render / GitHub Actions).</li><li>Troubleshooting tips when providers fail or models are not found.</li></ul><hr><h2 id="env-environment-variables" tabindex="-1">.env (environment variables) <a class="header-anchor" href="#env-environment-variables" aria-label="Permalink to “.env (environment variables)”"></a></h2><p>The repository includes a <code>.env.example</code> file with common keys. Copy it to <code>.env</code> and fill the keys for the providers you plan to use:</p><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;" tabindex="0" dir="ltr"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">cp</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> .env.example</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> .env</span></span>
|
|
2
|
+
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># edit .env and paste your API keys</span></span></code></pre></div><h3 id="typical-keys" tabindex="-1">Typical keys <a class="header-anchor" href="#typical-keys" aria-label="Permalink to “Typical keys”"></a></h3><ul><li><code>OPENAI_API_KEY</code> — OpenAI API key</li><li><code>GEMINI_API_KEY</code> — Google Gemini API key</li><li><code>OPENROUTER_API_KEY</code> — OpenRouter key</li><li><code>VERCEL_AI_GATEWAY_API_KEY</code> — Vercel AI Gateway key</li><li><code>COHERE_API_KEY</code>, <code>CEREBRAS_API_KEY</code>, <code>ZAI_API_KEY</code>, <code>GROK_API_KEY</code>, <code>QROQ_API_KEY</code>, <code>LLM7_API_KEY</code> — other providers</li><li><code>PORT</code> — optional, default 3000</li></ul><blockquote><p>Tip: use descriptive names and, when you need multiple keys for the same provider (e.g. multiple OpenRouter accounts), use suffixes like <code>OPENROUTER_API_KEY</code>, <code>OPENROUTER_API_KEY_2</code> and reference them from <code>provider.js</code>.</p></blockquote><h3 id="security-deployment" tabindex="-1">Security & deployment <a class="header-anchor" href="#security-deployment" aria-label="Permalink to “Security & deployment”"></a></h3><ul><li>Do <strong>not</strong> commit <code>.env</code> to Git. It is in <code>.gitignore</code> by default.</li><li>For cloud deployments, set the same variables in your provider’s environment configuration (Render, Vercel, GitHub Actions secrets, etc.).</li><li>Rotate keys regularly and use least-privileged keys where provider supports them.</li></ul><hr><h2 id="provider-js-—-how-it-works" tabindex="-1"><code>provider.js</code> — how it works <a class="header-anchor" href="#provider-js-—-how-it-works" aria-label="Permalink to “provider.js — how it works”"></a></h2><p><code>provider.js</code> exports an <strong>ordered array</strong> of provider configuration objects. The router will attempt each provider in array order and fall back automatically if one fails.</p><p>Each provider object supports (at minimum) these fields:</p><div class="language-js"><button title="Copy Code" class="copy"></button><span class="lang">js</span><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;" tabindex="0" dir="ltr"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
|
|
3
|
+
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"openai"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// simple identifier for logs/debug</span></span>
|
|
4
|
+
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> apiKey</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: process.env.</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">OPENAI_API_KEY</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
5
|
+
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> model</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"gpt-4"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// model id to request from this provider</span></span>
|
|
6
|
+
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> apiUrl</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"https://api.openai.com/v1"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// base URL for provider-compatible OpenAI endpoints</span></span>
|
|
7
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><h3 id="important-notes" tabindex="-1">Important notes <a class="header-anchor" href="#important-notes" aria-label="Permalink to “Important notes”"></a></h3><ul><li><code>apiKey</code> should reference the environment variable (use <code>process.env.X</code>). If the env var is missing the router will skip that provider and log a warning.</li><li><code>model</code> should match the provider’s model name exactly. If a provider uses a different naming scheme, use the exact ID that the provider’s API expects.</li><li><code>apiUrl</code> is used to create the OpenAI-compatible client; if a provider exposes a compatibility endpoint (like OpenRouter or Vercel Ai Gateway), set it accordingly.</li><li>Duplicate <code>name</code> values are allowed but can make logs confusing; prefer unique names like <code>openai</code>, <code>openai-alt</code>.</li></ul><h3 id="example-provider-js-snippet" tabindex="-1">Example <code>provider.js</code> snippet <a class="header-anchor" href="#example-provider-js-snippet" aria-label="Permalink to “Example provider.js snippet”"></a></h3><div class="language-js"><button title="Copy Code" class="copy"></button><span class="lang">js</span><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;" tabindex="0" dir="ltr"><code><span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">module</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">exports</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> =</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> [</span></span>
|
|
8
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span></span>
|
|
9
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> name: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"openai"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
10
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> apiKey: process.env.</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">OPENAI_API_KEY</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
11
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> model: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"gpt-4.1-mini-2025-04-14"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
12
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> apiUrl: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"https://api.openai.com/v1"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
13
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
|
|
14
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span></span>
|
|
15
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> name: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"google-gemini"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
16
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> apiKey: process.env.</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">GEMINI_API_KEY</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
17
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> model: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"gemini-2.5-pro"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
18
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> apiUrl: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"https://generativelanguage.googleapis.com/v1beta/openai/"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
19
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
|
|
20
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span></span>
|
|
21
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> name: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"openrouter"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
22
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> apiKey: process.env.</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">OPENROUTER_API_KEY</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
23
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> model: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"x-ai/grok-4-fast:free"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
24
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> apiUrl: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"https://openrouter.ai/api/v1"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
25
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
|
|
26
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">];</span></span></code></pre></div><h3 id="to-add-multiple-keys-for-the-same-provider" tabindex="-1">To add multiple keys for the same provider <a class="header-anchor" href="#to-add-multiple-keys-for-the-same-provider" aria-label="Permalink to “To add multiple keys for the same provider”"></a></h3><div class="language-js"><button title="Copy Code" class="copy"></button><span class="lang">js</span><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;" tabindex="0" dir="ltr"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// use different env vars and list providers multiple times (the router will try them in order)</span></span>
|
|
27
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
|
|
28
|
+
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"openrouter"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
29
|
+
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> apiKey</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: process.env.</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">OPENROUTER_API_KEY</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// primary</span></span>
|
|
30
|
+
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> model</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"x-ai/grok-4-fast:free"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
31
|
+
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> apiUrl</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"https://openrouter.ai/api/v1"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
32
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">},</span></span>
|
|
33
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
|
|
34
|
+
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"openrouter-alt"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
35
|
+
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> apiKey</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: process.env.</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">OPENROUTER_API_KEY_2</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// fallback / alternative account</span></span>
|
|
36
|
+
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> model</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"z-ai/glm-4.5-air:free"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
37
|
+
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> apiUrl</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"https://openrouter.ai/api/v1"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
38
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><hr><h2 id="model-selection-and-compatibility" tabindex="-1">Model selection and compatibility <a class="header-anchor" href="#model-selection-and-compatibility" aria-label="Permalink to “Model selection and compatibility”"></a></h2><ul><li>Choose a <code>model</code> that the provider actually exposes. The router attempts to list models via the provider client using <code>client.models.list()</code> — if the model is not found it will warn in logs.</li><li>Some providers require different model name formats (e.g. <code>models/gpt-4</code> vs <code>gpt-4</code>). If in doubt, query the provider’s models endpoint or check their docs.</li></ul><hr><h2 id="tool-calling-and-streaming" tabindex="-1">Tool-calling and streaming <a class="header-anchor" href="#tool-calling-and-streaming" aria-label="Permalink to “Tool-calling and streaming”"></a></h2><ul><li>If you plan to use <strong>tools</strong> (the project supports OpenAI-style tool metadata), pass <code>tools</code> into <code>chatCompletion</code> calls and make sure the chosen provider supports tool-calling. Not all providers do.</li><li>Streaming is enabled by passing <code>stream: true</code> to the endpoint or API call. Ensure the provider supports SSE/streaming and model supports streaming.</li></ul><hr><h2 id="local-testing-examples" tabindex="-1">Local testing & examples <a class="header-anchor" href="#local-testing-examples" aria-label="Permalink to “Local testing & examples”"></a></h2><ul><li>Non-streaming test:</li></ul><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;" tabindex="0" dir="ltr"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">node</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> tests/openai-server-non-stream.js</span></span></code></pre></div><ul><li>Streaming test:</li></ul><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;" tabindex="0" dir="ltr"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">node</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> tests/openai-server-stream.js</span></span></code></pre></div><ul><li>Library-level test (direct router):</li></ul><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;" tabindex="0" dir="ltr"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">node</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> tests/chat.js</span></span></code></pre></div><hr><h2 id="deployment-tips" tabindex="-1">Deployment tips <a class="header-anchor" href="#deployment-tips" aria-label="Permalink to “Deployment tips”"></a></h2><ul><li><strong>Render</strong> / <strong>Vercel</strong>: Add the same env variables to service settings. Use <code>npm start</code> as the start command (project <code>package.json</code> already sets this).</li><li><strong>GitHub Actions / Pages</strong>: only needed for building docs; server deployment still requires a host for Node.</li><li>If you change <code>.env</code> or <code>provider.js</code>, restart the Node process.</li></ul><hr><h2 id="troubleshooting" tabindex="-1">Troubleshooting <a class="header-anchor" href="#troubleshooting" aria-label="Permalink to “Troubleshooting”"></a></h2><ul><li><code>Skipping provider ... due to missing API key</code> — check <code>.env</code> and deployment env configuration.</li><li><code>Model <name> not found</code> — ensure the <code>model</code> matches what the provider exposes or remove that provider from <code>provider.js</code> until you pick the right model.</li><li><code>All providers failed</code> — examine provider-specific error logs (the router logs each provider failure) and verify network access / API quotas.</li></ul><hr><h2 id="quick-checklist-before-first-run" tabindex="-1">Quick checklist before first run <a class="header-anchor" href="#quick-checklist-before-first-run" aria-label="Permalink to “Quick checklist before first run”"></a></h2><ul><li>[ ] <code>cp .env.example .env</code> and set API keys</li><li>[ ] Edit <code>provider.js</code> to enable and order the providers you want</li><li>[ ] <code>npm install</code> and <code>npm start</code></li><li>[ ] Run <code>node tests/openai-server-non-stream.js</code> to validate</li></ul>`,48)])])}const E=s(t,[["render",l]]);export{c as __pageData,E as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as s,c as e,o as a,af as n}from"./chunks/framework.DLCvNBTH.js";const c=JSON.parse('{"title":"Configuration","description":"","frontmatter":{},"headers":[],"relativePath":"configuration.md","filePath":"configuration.md"}'),t={name:"configuration.md"};function l(o,i,r,h,p,d){return a(),e("div",null,[...i[0]||(i[0]=[n("",48)])])}const E=s(t,[["render",l]]);export{c as __pageData,E as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as t,c as e,o as a}from"./chunks/framework.DLCvNBTH.js";const m=JSON.parse('{"title":"","description":"","frontmatter":{"layout":"home","hero":{"name":"Unified AI Router","text":"A lightweight OpenAI-compatible server in Nodejs","tagline":"OpenAI-compatible endpoints, automatic fallback, streaming support, and tool-calling — all in one lightweight package.","actions":[{"theme":"brand","text":"Quickstart","link":"/quickstart"},{"theme":"alt","text":"Configuration","link":"/configuration"}]},"features":[{"title":"Multi-provider fallback","details":"If one provider fails, requests automatically fall back to the next available provider."},{"title":"OpenAI-compatible API","details":"Run a drop-in replacement for the OpenAI chat completion endpoints (streaming & non-streaming)."},{"title":"Tool calling & streaming","details":"Supports tool-calling metadata and SSE streaming to integrate with existing tooling."},{"title":"Easy to self-host","details":"Run locally or deploy to cloud host providers."}]},"headers":[],"relativePath":"index.md","filePath":"index.md"}'),i={name:"index.md"};function o(n,l,r,s,c,d){return a(),e("div")}const g=t(i,[["render",o]]);export{m as __pageData,g as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as t,c as e,o as a}from"./chunks/framework.DLCvNBTH.js";const m=JSON.parse('{"title":"","description":"","frontmatter":{"layout":"home","hero":{"name":"Unified AI Router","text":"A lightweight OpenAI-compatible server in Nodejs","tagline":"OpenAI-compatible endpoints, automatic fallback, streaming support, and tool-calling — all in one lightweight package.","actions":[{"theme":"brand","text":"Quickstart","link":"/quickstart"},{"theme":"alt","text":"Configuration","link":"/configuration"}]},"features":[{"title":"Multi-provider fallback","details":"If one provider fails, requests automatically fall back to the next available provider."},{"title":"OpenAI-compatible API","details":"Run a drop-in replacement for the OpenAI chat completion endpoints (streaming & non-streaming)."},{"title":"Tool calling & streaming","details":"Supports tool-calling metadata and SSE streaming to integrate with existing tooling."},{"title":"Easy to self-host","details":"Run locally or deploy to cloud host providers."}]},"headers":[],"relativePath":"index.md","filePath":"index.md"}'),i={name:"index.md"};function o(n,l,r,s,c,d){return a(),e("div")}const g=t(i,[["render",o]]);export{m as __pageData,g as default};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{_ as i,c as
|
|
1
|
+
import{_ as i,c as e,o as a,af as t}from"./chunks/framework.DLCvNBTH.js";const k=JSON.parse('{"title":"Quickstart — Run locally in minutes","description":"","frontmatter":{},"headers":[],"relativePath":"quickstart.md","filePath":"quickstart.md"}'),n={name:"quickstart.md"};function l(h,s,o,r,p,d){return a(),e("div",null,[...s[0]||(s[0]=[t(`<h1 id="quickstart-—-run-locally-in-minutes" tabindex="-1">Quickstart — Run locally in minutes <a class="header-anchor" href="#quickstart-—-run-locally-in-minutes" aria-label="Permalink to “Quickstart — Run locally in minutes”"></a></h1><p>This page walks you through running the OpenAI-compatible server locally and calling the <code>/v1/chat/completions</code> endpoint.</p><h2 id="_1-install" tabindex="-1">1) Install <a class="header-anchor" href="#_1-install" aria-label="Permalink to “1) Install”"></a></h2><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;" tabindex="0" dir="ltr"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">git</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> clone</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> https://github.com/mlibre/Unified-AI-Router.git</span></span>
|
|
2
2
|
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">cd</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> Unified-AI-Router</span></span>
|
|
3
3
|
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">npm</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> install</span></span></code></pre></div><h2 id="_2-configure-api-keys" tabindex="-1">2) Configure API keys <a class="header-anchor" href="#_2-configure-api-keys" aria-label="Permalink to “2) Configure API keys”"></a></h2><p>Copy the example env file and populate the keys for the providers you want to use:</p><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;" tabindex="0" dir="ltr"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">cp</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> .env.example</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> .env</span></span>
|
|
4
4
|
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># edit .env and add keys (OPENAI_API_KEY, GEMINI_API_KEY, etc.)</span></span></code></pre></div><p>Edit <code>provider.js</code> to enable or reorder providers (the router tries them in array order).</p><h2 id="_3-start-the-server" tabindex="-1">3) Start the server <a class="header-anchor" href="#_3-start-the-server" aria-label="Permalink to “3) Start the server”"></a></h2><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;" tabindex="0" dir="ltr"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">npm</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> start</span></span></code></pre></div><p>By default the server listens on <code>http://localhost:3000</code> and supports these OpenAI-compatible endpoints:</p><ul><li><code>POST /v1/chat/completions</code> — streaming & non-streaming chat completions</li><li><code>POST /chat/completions</code> — same as above (alternate path)</li><li><code>GET /v1/models</code> & <code>GET /models</code> — lists models available from providers</li><li><code>GET /health</code> — health check</li></ul><h2 id="_4-quick-test-non-streaming" tabindex="-1">4) Quick test (non-streaming) <a class="header-anchor" href="#_4-quick-test-non-streaming" aria-label="Permalink to “4) Quick test (non-streaming)”"></a></h2><p>Use <code>curl</code> or your HTTP client to test a simple chat completion:</p><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;" tabindex="0" dir="ltr"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">curl</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -s</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -X</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> POST</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> http://localhost:3000/v1/chat/completions</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
|
|
5
5
|
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -H</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> "Content-Type: application/json"</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \\</span></span>
|
|
6
|
-
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -d</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> '{ "messages": [{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Say hello." }], "model":"gpt-3.5-turbo" }'</span></span></code></pre></div><h2 id="_5-next-steps" tabindex="-1">5) Next steps <a class="header-anchor" href="#_5-next-steps" aria-label="Permalink to “5) Next steps”"></a></h2><ul><li>Configure additional providers in <code>provider.js</code> and set env keys.</li><li>Try streaming by setting <code>stream: true</code> when calling the endpoint.</li><li>See <code>tests/</code> for example scripts that exercise streaming, non-streaming, and tools.</li></ul>`,17)])])}const u=i(n,[["render",l]]);export{
|
|
6
|
+
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -d</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> '{ "messages": [{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Say hello." }], "model":"gpt-3.5-turbo" }'</span></span></code></pre></div><h2 id="_5-next-steps" tabindex="-1">5) Next steps <a class="header-anchor" href="#_5-next-steps" aria-label="Permalink to “5) Next steps”"></a></h2><ul><li>Configure additional providers in <code>provider.js</code> and set env keys.</li><li>Try streaming by setting <code>stream: true</code> when calling the endpoint.</li><li>See <code>tests/</code> for example scripts that exercise streaming, non-streaming, and tools.</li></ul>`,17)])])}const u=i(n,[["render",l]]);export{k as __pageData,u as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as i,c as e,o as a,af as t}from"./chunks/framework.DLCvNBTH.js";const k=JSON.parse('{"title":"Quickstart — Run locally in minutes","description":"","frontmatter":{},"headers":[],"relativePath":"quickstart.md","filePath":"quickstart.md"}'),n={name:"quickstart.md"};function l(h,s,o,r,p,d){return a(),e("div",null,[...s[0]||(s[0]=[t("",17)])])}const u=i(n,[["render",l]]);export{k as __pageData,u as default};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en-US" dir="ltr">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
+
<title>Configuration | Unified AI Router</title>
|
|
7
|
+
<meta name="description" content="OpenAI-compatible router with multi-provider fallback.">
|
|
8
|
+
<meta name="generator" content="VitePress v2.0.0-alpha.12">
|
|
9
|
+
<link rel="preload stylesheet" href="/Unified-AI-Router/assets/style.CVX7x1tQ.css" as="style">
|
|
10
|
+
<link rel="preload stylesheet" href="/Unified-AI-Router/vp-icons.css" as="style">
|
|
11
|
+
|
|
12
|
+
<script type="module" src="/Unified-AI-Router/assets/app.BKyBzHbv.js"></script>
|
|
13
|
+
<link rel="preload" href="/Unified-AI-Router/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
|
|
14
|
+
<link rel="modulepreload" href="/Unified-AI-Router/assets/chunks/theme.h95WUA9L.js">
|
|
15
|
+
<link rel="modulepreload" href="/Unified-AI-Router/assets/chunks/framework.DLCvNBTH.js">
|
|
16
|
+
<link rel="modulepreload" href="/Unified-AI-Router/assets/configuration.md.DanKHGkj.lean.js">
|
|
17
|
+
<script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
|
|
18
|
+
<script id="check-mac-os">document.documentElement.classList.toggle("mac",/Mac|iPhone|iPod|iPad/i.test(navigator.platform));</script>
|
|
19
|
+
</head>
|
|
20
|
+
<body>
|
|
21
|
+
<div id="app"><div class="Layout" data-v-1df9f90f><!--[--><!--]--><!--[--><span tabindex="-1" data-v-0b0ada53></span><a href="#VPContent" class="VPSkipLink visually-hidden" data-v-0b0ada53>Skip to content</a><!--]--><!----><header class="VPNav" data-v-1df9f90f data-v-9f75dce3><div class="VPNavBar" data-v-9f75dce3 data-v-2a96a3d0><div class="wrapper" data-v-2a96a3d0><div class="container" data-v-2a96a3d0><div class="title" data-v-2a96a3d0><div class="VPNavBarTitle has-sidebar" data-v-2a96a3d0 data-v-1e38c6bc><a class="title" href="/Unified-AI-Router/" data-v-1e38c6bc><!--[--><!--]--><!----><span data-v-1e38c6bc>Unified AI Router</span><!--[--><!--]--></a></div></div><div class="content" data-v-2a96a3d0><div class="content-body" data-v-2a96a3d0><!--[--><!--]--><div class="VPNavBarSearch search" data-v-2a96a3d0><!----></div><nav aria-labelledby="main-nav-aria-label" class="VPNavBarMenu menu" data-v-2a96a3d0 data-v-39714824><span id="main-nav-aria-label" class="visually-hidden" data-v-39714824> Main Navigation </span><!--[--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/Unified-AI-Router/" tabindex="0" data-v-39714824 data-v-e56f3d57><!--[--><span data-v-e56f3d57>Home</span><!--]--></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/Unified-AI-Router/quickstart.html" tabindex="0" data-v-39714824 data-v-e56f3d57><!--[--><span data-v-e56f3d57>Quickstart</span><!--]--></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink active" href="/Unified-AI-Router/configuration.html" tabindex="0" data-v-39714824 data-v-e56f3d57><!--[--><span data-v-e56f3d57>Configuration</span><!--]--></a><!--]--><!--]--></nav><!----><div class="VPNavBarAppearance appearance" data-v-2a96a3d0 data-v-6c893767><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title aria-checked="false" data-v-6c893767 data-v-5337faa4 data-v-1d5665e3><span class="check" data-v-1d5665e3><span class="icon" data-v-1d5665e3><!--[--><span class="vpi-sun sun" data-v-5337faa4></span><span class="vpi-moon moon" data-v-5337faa4></span><!--]--></span></span></button></div><div class="VPSocialLinks VPNavBarSocialLinks social-links" data-v-2a96a3d0 data-v-0394ad82 data-v-d07f11e6><!--[--><a class="VPSocialLink no-icon" href="https://github.com/mlibre/Unified-AI-Router" aria-label="github" target="_blank" rel="me noopener" data-v-d07f11e6 data-v-591a6b30><span class="vpi-social-github"></span></a><!--]--></div><div class="VPFlyout VPNavBarExtra extra" data-v-2a96a3d0 data-v-bb2aa2f0 data-v-42cb505d><button type="button" class="button" aria-haspopup="true" aria-expanded="false" aria-label="extra navigation" data-v-42cb505d><span class="vpi-more-horizontal icon" data-v-42cb505d></span></button><div class="menu" data-v-42cb505d><div class="VPMenu" data-v-42cb505d data-v-25a6cce8><!----><!--[--><!--[--><!----><div class="group" data-v-bb2aa2f0><div class="item appearance" data-v-bb2aa2f0><p class="label" data-v-bb2aa2f0>Appearance</p><div class="appearance-action" data-v-bb2aa2f0><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title aria-checked="false" data-v-bb2aa2f0 data-v-5337faa4 data-v-1d5665e3><span class="check" data-v-1d5665e3><span class="icon" data-v-1d5665e3><!--[--><span class="vpi-sun sun" data-v-5337faa4></span><span class="vpi-moon moon" data-v-5337faa4></span><!--]--></span></span></button></div></div></div><div class="group" data-v-bb2aa2f0><div class="item social-links" data-v-bb2aa2f0><div class="VPSocialLinks social-links-list" data-v-bb2aa2f0 data-v-d07f11e6><!--[--><a class="VPSocialLink no-icon" href="https://github.com/mlibre/Unified-AI-Router" aria-label="github" target="_blank" rel="me noopener" data-v-d07f11e6 data-v-591a6b30><span class="vpi-social-github"></span></a><!--]--></div></div></div><!--]--><!--]--></div></div></div><!--[--><!--]--><button type="button" class="VPNavBarHamburger hamburger" aria-label="mobile navigation" aria-expanded="false" aria-controls="VPNavScreen" data-v-2a96a3d0 data-v-e5dd9c1c><span class="container" data-v-e5dd9c1c><span class="top" data-v-e5dd9c1c></span><span class="middle" data-v-e5dd9c1c></span><span class="bottom" data-v-e5dd9c1c></span></span></button></div></div></div></div><div class="divider" data-v-2a96a3d0><div class="divider-line" data-v-2a96a3d0></div></div></div><!----></header><div class="VPLocalNav has-sidebar empty" data-v-1df9f90f data-v-8acdfeb5><div class="container" data-v-8acdfeb5><button class="menu" aria-expanded="false" aria-controls="VPSidebarNav" data-v-8acdfeb5><span class="vpi-align-left menu-icon" data-v-8acdfeb5></span><span class="menu-text" data-v-8acdfeb5>Menu</span></button><div class="VPLocalNavOutlineDropdown" style="--vp-vh:0px;" data-v-8acdfeb5 data-v-0bf0e06f><button data-v-0bf0e06f>Return to top</button><!----></div></div></div><aside class="VPSidebar" data-v-1df9f90f data-v-e7c6e512><div class="curtain" data-v-e7c6e512></div><nav class="nav" id="VPSidebarNav" aria-labelledby="sidebar-aria-label" tabindex="-1" data-v-e7c6e512><span class="visually-hidden" id="sidebar-aria-label" data-v-e7c6e512> Sidebar Navigation </span><!--[--><!--]--><!--[--><div class="no-transition group" data-v-8d50c081><section class="VPSidebarItem level-0 has-active" data-v-8d50c081 data-v-d81de50c><div class="item" role="button" tabindex="0" data-v-d81de50c><div class="indicator" data-v-d81de50c></div><h2 class="text" data-v-d81de50c>Guide</h2><!----></div><div class="items" data-v-d81de50c><!--[--><div class="VPSidebarItem level-1 is-link" data-v-d81de50c data-v-d81de50c><div class="item" data-v-d81de50c><div class="indicator" data-v-d81de50c></div><a class="VPLink link link" href="/Unified-AI-Router/quickstart.html" data-v-d81de50c><!--[--><p class="text" data-v-d81de50c>Quickstart</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-d81de50c data-v-d81de50c><div class="item" data-v-d81de50c><div class="indicator" data-v-d81de50c></div><a class="VPLink link link" href="/Unified-AI-Router/configuration.html" data-v-d81de50c><!--[--><p class="text" data-v-d81de50c>Configuration</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><!--]--><!--[--><!--]--></nav></aside><div class="VPContent has-sidebar" id="VPContent" data-v-1df9f90f data-v-aff0b8d7><div class="VPDoc has-sidebar has-aside" data-v-aff0b8d7 data-v-7011f0d8><!--[--><!--]--><div class="container" data-v-7011f0d8><div class="aside" data-v-7011f0d8><div class="aside-curtain" data-v-7011f0d8></div><div class="aside-container" data-v-7011f0d8><div class="aside-content" data-v-7011f0d8><div class="VPDocAside" data-v-7011f0d8 data-v-3f215769><!--[--><!--]--><!--[--><!--]--><nav aria-labelledby="doc-outline-aria-label" class="VPDocAsideOutline" data-v-3f215769 data-v-60d5052e><div class="content" data-v-60d5052e><div class="outline-marker" data-v-60d5052e></div><div aria-level="2" class="outline-title" id="doc-outline-aria-label" role="heading" data-v-60d5052e>On this page</div><ul class="VPDocOutlineItem root" data-v-60d5052e data-v-2d0bdf9b><!--[--><!--]--></ul></div></nav><!--[--><!--]--><div class="spacer" data-v-3f215769></div><!--[--><!--]--><!----><!--[--><!--]--><!--[--><!--]--></div></div></div></div><div class="content" data-v-7011f0d8><div class="content-container" data-v-7011f0d8><!--[--><!--]--><main class="main" data-v-7011f0d8><div style="position:relative;" class="vp-doc _Unified-AI-Router_configuration" data-v-7011f0d8><div><h1 id="configuration" tabindex="-1">Configuration <a class="header-anchor" href="#configuration" aria-label="Permalink to “Configuration”"></a></h1><p>This page focuses on how to configure the router for local development and production deployments: setting environment variables (<code>.env</code>) and customizing <code>provider.js</code>.</p><hr><h2 id="goals" tabindex="-1">Goals <a class="header-anchor" href="#goals" aria-label="Permalink to “Goals”"></a></h2><ul><li>Explain which environment variables the project expects and best practices for storing them.</li><li>Show how to author <code>provider.js</code> entries: enabling/disabling providers, ordering (fallback), and useful fields.</li><li>Provide examples for local, staging, and cloud deployments (Vercel / Render / GitHub Actions).</li><li>Troubleshooting tips when providers fail or models are not found.</li></ul><hr><h2 id="env-environment-variables" tabindex="-1">.env (environment variables) <a class="header-anchor" href="#env-environment-variables" aria-label="Permalink to “.env (environment variables)”"></a></h2><p>The repository includes a <code>.env.example</code> file with common keys. Copy it to <code>.env</code> and fill the keys for the providers you plan to use:</p><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;" tabindex="0" dir="ltr"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">cp</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> .env.example</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> .env</span></span>
|
|
22
|
+
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># edit .env and paste your API keys</span></span></code></pre></div><h3 id="typical-keys" tabindex="-1">Typical keys <a class="header-anchor" href="#typical-keys" aria-label="Permalink to “Typical keys”"></a></h3><ul><li><code>OPENAI_API_KEY</code> — OpenAI API key</li><li><code>GEMINI_API_KEY</code> — Google Gemini API key</li><li><code>OPENROUTER_API_KEY</code> — OpenRouter key</li><li><code>VERCEL_AI_GATEWAY_API_KEY</code> — Vercel AI Gateway key</li><li><code>COHERE_API_KEY</code>, <code>CEREBRAS_API_KEY</code>, <code>ZAI_API_KEY</code>, <code>GROK_API_KEY</code>, <code>QROQ_API_KEY</code>, <code>LLM7_API_KEY</code> — other providers</li><li><code>PORT</code> — optional, default 3000</li></ul><blockquote><p>Tip: use descriptive names and, when you need multiple keys for the same provider (e.g. multiple OpenRouter accounts), use suffixes like <code>OPENROUTER_API_KEY</code>, <code>OPENROUTER_API_KEY_2</code> and reference them from <code>provider.js</code>.</p></blockquote><h3 id="security-deployment" tabindex="-1">Security & deployment <a class="header-anchor" href="#security-deployment" aria-label="Permalink to “Security & deployment”"></a></h3><ul><li>Do <strong>not</strong> commit <code>.env</code> to Git. It is in <code>.gitignore</code> by default.</li><li>For cloud deployments, set the same variables in your provider’s environment configuration (Render, Vercel, GitHub Actions secrets, etc.).</li><li>Rotate keys regularly and use least-privileged keys where provider supports them.</li></ul><hr><h2 id="provider-js-—-how-it-works" tabindex="-1"><code>provider.js</code> — how it works <a class="header-anchor" href="#provider-js-—-how-it-works" aria-label="Permalink to “provider.js — how it works”"></a></h2><p><code>provider.js</code> exports an <strong>ordered array</strong> of provider configuration objects. The router will attempt each provider in array order and fall back automatically if one fails.</p><p>Each provider object supports (at minimum) these fields:</p><div class="language-js"><button title="Copy Code" class="copy"></button><span class="lang">js</span><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;" tabindex="0" dir="ltr"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
|
|
23
|
+
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"openai"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// simple identifier for logs/debug</span></span>
|
|
24
|
+
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> apiKey</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: process.env.</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">OPENAI_API_KEY</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
25
|
+
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> model</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"gpt-4"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// model id to request from this provider</span></span>
|
|
26
|
+
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> apiUrl</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"https://api.openai.com/v1"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// base URL for provider-compatible OpenAI endpoints</span></span>
|
|
27
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><h3 id="important-notes" tabindex="-1">Important notes <a class="header-anchor" href="#important-notes" aria-label="Permalink to “Important notes”"></a></h3><ul><li><code>apiKey</code> should reference the environment variable (use <code>process.env.X</code>). If the env var is missing the router will skip that provider and log a warning.</li><li><code>model</code> should match the provider’s model name exactly. If a provider uses a different naming scheme, use the exact ID that the provider’s API expects.</li><li><code>apiUrl</code> is used to create the OpenAI-compatible client; if a provider exposes a compatibility endpoint (like OpenRouter or Vercel Ai Gateway), set it accordingly.</li><li>Duplicate <code>name</code> values are allowed but can make logs confusing; prefer unique names like <code>openai</code>, <code>openai-alt</code>.</li></ul><h3 id="example-provider-js-snippet" tabindex="-1">Example <code>provider.js</code> snippet <a class="header-anchor" href="#example-provider-js-snippet" aria-label="Permalink to “Example provider.js snippet”"></a></h3><div class="language-js"><button title="Copy Code" class="copy"></button><span class="lang">js</span><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;" tabindex="0" dir="ltr"><code><span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">module</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">exports</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> =</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> [</span></span>
|
|
28
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span></span>
|
|
29
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> name: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"openai"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
30
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> apiKey: process.env.</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">OPENAI_API_KEY</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
31
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> model: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"gpt-4.1-mini-2025-04-14"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
32
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> apiUrl: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"https://api.openai.com/v1"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
33
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
|
|
34
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span></span>
|
|
35
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> name: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"google-gemini"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
36
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> apiKey: process.env.</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">GEMINI_API_KEY</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
37
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> model: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"gemini-2.5-pro"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
38
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> apiUrl: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"https://generativelanguage.googleapis.com/v1beta/openai/"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
39
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
|
|
40
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span></span>
|
|
41
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> name: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"openrouter"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
42
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> apiKey: process.env.</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">OPENROUTER_API_KEY</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
43
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> model: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"x-ai/grok-4-fast:free"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
44
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> apiUrl: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"https://openrouter.ai/api/v1"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
45
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
|
|
46
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">];</span></span></code></pre></div><h3 id="to-add-multiple-keys-for-the-same-provider" tabindex="-1">To add multiple keys for the same provider <a class="header-anchor" href="#to-add-multiple-keys-for-the-same-provider" aria-label="Permalink to “To add multiple keys for the same provider”"></a></h3><div class="language-js"><button title="Copy Code" class="copy"></button><span class="lang">js</span><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;" tabindex="0" dir="ltr"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// use different env vars and list providers multiple times (the router will try them in order)</span></span>
|
|
47
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
|
|
48
|
+
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"openrouter"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
49
|
+
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> apiKey</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: process.env.</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">OPENROUTER_API_KEY</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// primary</span></span>
|
|
50
|
+
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> model</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"x-ai/grok-4-fast:free"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
51
|
+
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> apiUrl</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"https://openrouter.ai/api/v1"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
52
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">},</span></span>
|
|
53
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
|
|
54
|
+
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"openrouter-alt"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
55
|
+
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> apiKey</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: process.env.</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">OPENROUTER_API_KEY_2</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// fallback / alternative account</span></span>
|
|
56
|
+
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> model</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"z-ai/glm-4.5-air:free"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
57
|
+
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> apiUrl</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"https://openrouter.ai/api/v1"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
|
58
|
+
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><hr><h2 id="model-selection-and-compatibility" tabindex="-1">Model selection and compatibility <a class="header-anchor" href="#model-selection-and-compatibility" aria-label="Permalink to “Model selection and compatibility”"></a></h2><ul><li>Choose a <code>model</code> that the provider actually exposes. The router attempts to list models via the provider client using <code>client.models.list()</code> — if the model is not found it will warn in logs.</li><li>Some providers require different model name formats (e.g. <code>models/gpt-4</code> vs <code>gpt-4</code>). If in doubt, query the provider’s models endpoint or check their docs.</li></ul><hr><h2 id="tool-calling-and-streaming" tabindex="-1">Tool-calling and streaming <a class="header-anchor" href="#tool-calling-and-streaming" aria-label="Permalink to “Tool-calling and streaming”"></a></h2><ul><li>If you plan to use <strong>tools</strong> (the project supports OpenAI-style tool metadata), pass <code>tools</code> into <code>chatCompletion</code> calls and make sure the chosen provider supports tool-calling. Not all providers do.</li><li>Streaming is enabled by passing <code>stream: true</code> to the endpoint or API call. Ensure the provider supports SSE/streaming and model supports streaming.</li></ul><hr><h2 id="local-testing-examples" tabindex="-1">Local testing & examples <a class="header-anchor" href="#local-testing-examples" aria-label="Permalink to “Local testing & examples”"></a></h2><ul><li>Non-streaming test:</li></ul><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;" tabindex="0" dir="ltr"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">node</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> tests/openai-server-non-stream.js</span></span></code></pre></div><ul><li>Streaming test:</li></ul><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;" tabindex="0" dir="ltr"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">node</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> tests/openai-server-stream.js</span></span></code></pre></div><ul><li>Library-level test (direct router):</li></ul><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;" tabindex="0" dir="ltr"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">node</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> tests/chat.js</span></span></code></pre></div><hr><h2 id="deployment-tips" tabindex="-1">Deployment tips <a class="header-anchor" href="#deployment-tips" aria-label="Permalink to “Deployment tips”"></a></h2><ul><li><strong>Render</strong> / <strong>Vercel</strong>: Add the same env variables to service settings. Use <code>npm start</code> as the start command (project <code>package.json</code> already sets this).</li><li><strong>GitHub Actions / Pages</strong>: only needed for building docs; server deployment still requires a host for Node.</li><li>If you change <code>.env</code> or <code>provider.js</code>, restart the Node process.</li></ul><hr><h2 id="troubleshooting" tabindex="-1">Troubleshooting <a class="header-anchor" href="#troubleshooting" aria-label="Permalink to “Troubleshooting”"></a></h2><ul><li><code>Skipping provider ... due to missing API key</code> — check <code>.env</code> and deployment env configuration.</li><li><code>Model <name> not found</code> — ensure the <code>model</code> matches what the provider exposes or remove that provider from <code>provider.js</code> until you pick the right model.</li><li><code>All providers failed</code> — examine provider-specific error logs (the router logs each provider failure) and verify network access / API quotas.</li></ul><hr><h2 id="quick-checklist-before-first-run" tabindex="-1">Quick checklist before first run <a class="header-anchor" href="#quick-checklist-before-first-run" aria-label="Permalink to “Quick checklist before first run”"></a></h2><ul><li>[ ] <code>cp .env.example .env</code> and set API keys</li><li>[ ] Edit <code>provider.js</code> to enable and order the providers you want</li><li>[ ] <code>npm install</code> and <code>npm start</code></li><li>[ ] Run <code>node tests/openai-server-non-stream.js</code> to validate</li></ul></div></div></main><footer class="VPDocFooter" data-v-7011f0d8 data-v-e257564d><!--[--><!--]--><!----><nav class="prev-next" aria-labelledby="doc-footer-aria-label" data-v-e257564d><span class="visually-hidden" id="doc-footer-aria-label" data-v-e257564d>Pager</span><div class="pager" data-v-e257564d><a class="VPLink link pager-link prev" href="/Unified-AI-Router/quickstart.html" data-v-e257564d><!--[--><span class="desc" data-v-e257564d>Previous page</span><span class="title" data-v-e257564d>Quickstart</span><!--]--></a></div><div class="pager" data-v-e257564d><!----></div></nav></footer><!--[--><!--]--></div></div></div><!--[--><!--]--></div></div><!----><!--[--><!--]--></div></div>
|
|
59
|
+
<script>window.__VP_HASH_MAP__=JSON.parse("{\"configuration.md\":\"DanKHGkj\",\"index.md\":\"D1fgr_Mo\",\"quickstart.md\":\"mGNzdQVa\"}");window.__VP_SITE_DATA__=JSON.parse("{\"lang\":\"en-US\",\"dir\":\"ltr\",\"title\":\"Unified AI Router\",\"description\":\"OpenAI-compatible router with multi-provider fallback.\",\"base\":\"/Unified-AI-Router/\",\"head\":[],\"router\":{\"prefetchLinks\":true},\"appearance\":true,\"themeConfig\":{\"nav\":[{\"text\":\"Home\",\"link\":\"/\"},{\"text\":\"Quickstart\",\"link\":\"/quickstart\"},{\"text\":\"Configuration\",\"link\":\"/configuration\"}],\"sidebar\":[{\"text\":\"Guide\",\"items\":[{\"text\":\"Quickstart\",\"link\":\"/quickstart\"},{\"text\":\"Configuration\",\"link\":\"/configuration\"}]}],\"socialLinks\":[{\"icon\":\"github\",\"link\":\"https://github.com/mlibre/Unified-AI-Router\"}]},\"locales\":{},\"scrollOffset\":134,\"cleanUrls\":false,\"additionalConfig\":{}}");</script>
|
|
60
|
+
|
|
61
|
+
</body>
|
|
62
|
+
</html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"configuration.md":"DanKHGkj","index.md":"D1fgr_Mo","quickstart.md":"mGNzdQVa"}
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
<link rel="preload" href="/Unified-AI-Router/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
|
|
14
14
|
<link rel="modulepreload" href="/Unified-AI-Router/assets/chunks/theme.h95WUA9L.js">
|
|
15
15
|
<link rel="modulepreload" href="/Unified-AI-Router/assets/chunks/framework.DLCvNBTH.js">
|
|
16
|
-
<link rel="modulepreload" href="/Unified-AI-Router/assets/index.md.
|
|
16
|
+
<link rel="modulepreload" href="/Unified-AI-Router/assets/index.md.D1fgr_Mo.lean.js">
|
|
17
17
|
<script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
|
|
18
18
|
<script id="check-mac-os">document.documentElement.classList.toggle("mac",/Mac|iPhone|iPod|iPad/i.test(navigator.platform));</script>
|
|
19
19
|
</head>
|
|
20
20
|
<body>
|
|
21
|
-
<div id="app"><div class="Layout" data-v-1df9f90f><!--[--><!--]--><!--[--><span tabindex="-1" data-v-0b0ada53></span><a href="#VPContent" class="VPSkipLink visually-hidden" data-v-0b0ada53>Skip to content</a><!--]--><!----><header class="VPNav" data-v-1df9f90f data-v-9f75dce3><div class="VPNavBar" data-v-9f75dce3 data-v-2a96a3d0><div class="wrapper" data-v-2a96a3d0><div class="container" data-v-2a96a3d0><div class="title" data-v-2a96a3d0><div class="VPNavBarTitle" data-v-2a96a3d0 data-v-1e38c6bc><a class="title" href="/Unified-AI-Router/" data-v-1e38c6bc><!--[--><!--]--><!----><span data-v-1e38c6bc>Unified AI Router</span><!--[--><!--]--></a></div></div><div class="content" data-v-2a96a3d0><div class="content-body" data-v-2a96a3d0><!--[--><!--]--><div class="VPNavBarSearch search" data-v-2a96a3d0><!----></div><nav aria-labelledby="main-nav-aria-label" class="VPNavBarMenu menu" data-v-2a96a3d0 data-v-39714824><span id="main-nav-aria-label" class="visually-hidden" data-v-39714824> Main Navigation </span><!--[--><!--[--><a class="VPLink link VPNavBarMenuLink active" href="/Unified-AI-Router/" tabindex="0" data-v-39714824 data-v-e56f3d57><!--[--><span data-v-e56f3d57>Home</span><!--]--></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/Unified-AI-Router/quickstart.html" tabindex="0" data-v-39714824 data-v-e56f3d57><!--[--><span data-v-e56f3d57>Quickstart</span><!--]--></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/Unified-AI-Router/
|
|
22
|
-
<script>window.__VP_HASH_MAP__=JSON.parse("{\"
|
|
21
|
+
<div id="app"><div class="Layout" data-v-1df9f90f><!--[--><!--]--><!--[--><span tabindex="-1" data-v-0b0ada53></span><a href="#VPContent" class="VPSkipLink visually-hidden" data-v-0b0ada53>Skip to content</a><!--]--><!----><header class="VPNav" data-v-1df9f90f data-v-9f75dce3><div class="VPNavBar" data-v-9f75dce3 data-v-2a96a3d0><div class="wrapper" data-v-2a96a3d0><div class="container" data-v-2a96a3d0><div class="title" data-v-2a96a3d0><div class="VPNavBarTitle" data-v-2a96a3d0 data-v-1e38c6bc><a class="title" href="/Unified-AI-Router/" data-v-1e38c6bc><!--[--><!--]--><!----><span data-v-1e38c6bc>Unified AI Router</span><!--[--><!--]--></a></div></div><div class="content" data-v-2a96a3d0><div class="content-body" data-v-2a96a3d0><!--[--><!--]--><div class="VPNavBarSearch search" data-v-2a96a3d0><!----></div><nav aria-labelledby="main-nav-aria-label" class="VPNavBarMenu menu" data-v-2a96a3d0 data-v-39714824><span id="main-nav-aria-label" class="visually-hidden" data-v-39714824> Main Navigation </span><!--[--><!--[--><a class="VPLink link VPNavBarMenuLink active" href="/Unified-AI-Router/" tabindex="0" data-v-39714824 data-v-e56f3d57><!--[--><span data-v-e56f3d57>Home</span><!--]--></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/Unified-AI-Router/quickstart.html" tabindex="0" data-v-39714824 data-v-e56f3d57><!--[--><span data-v-e56f3d57>Quickstart</span><!--]--></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/Unified-AI-Router/configuration.html" tabindex="0" data-v-39714824 data-v-e56f3d57><!--[--><span data-v-e56f3d57>Configuration</span><!--]--></a><!--]--><!--]--></nav><!----><div class="VPNavBarAppearance appearance" data-v-2a96a3d0 data-v-6c893767><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title aria-checked="false" data-v-6c893767 data-v-5337faa4 data-v-1d5665e3><span class="check" data-v-1d5665e3><span class="icon" data-v-1d5665e3><!--[--><span class="vpi-sun sun" data-v-5337faa4></span><span class="vpi-moon moon" data-v-5337faa4></span><!--]--></span></span></button></div><div class="VPSocialLinks VPNavBarSocialLinks social-links" data-v-2a96a3d0 data-v-0394ad82 data-v-d07f11e6><!--[--><a class="VPSocialLink no-icon" href="https://github.com/mlibre/Unified-AI-Router" aria-label="github" target="_blank" rel="me noopener" data-v-d07f11e6 data-v-591a6b30><span class="vpi-social-github"></span></a><!--]--></div><div class="VPFlyout VPNavBarExtra extra" data-v-2a96a3d0 data-v-bb2aa2f0 data-v-42cb505d><button type="button" class="button" aria-haspopup="true" aria-expanded="false" aria-label="extra navigation" data-v-42cb505d><span class="vpi-more-horizontal icon" data-v-42cb505d></span></button><div class="menu" data-v-42cb505d><div class="VPMenu" data-v-42cb505d data-v-25a6cce8><!----><!--[--><!--[--><!----><div class="group" data-v-bb2aa2f0><div class="item appearance" data-v-bb2aa2f0><p class="label" data-v-bb2aa2f0>Appearance</p><div class="appearance-action" data-v-bb2aa2f0><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title aria-checked="false" data-v-bb2aa2f0 data-v-5337faa4 data-v-1d5665e3><span class="check" data-v-1d5665e3><span class="icon" data-v-1d5665e3><!--[--><span class="vpi-sun sun" data-v-5337faa4></span><span class="vpi-moon moon" data-v-5337faa4></span><!--]--></span></span></button></div></div></div><div class="group" data-v-bb2aa2f0><div class="item social-links" data-v-bb2aa2f0><div class="VPSocialLinks social-links-list" data-v-bb2aa2f0 data-v-d07f11e6><!--[--><a class="VPSocialLink no-icon" href="https://github.com/mlibre/Unified-AI-Router" aria-label="github" target="_blank" rel="me noopener" data-v-d07f11e6 data-v-591a6b30><span class="vpi-social-github"></span></a><!--]--></div></div></div><!--]--><!--]--></div></div></div><!--[--><!--]--><button type="button" class="VPNavBarHamburger hamburger" aria-label="mobile navigation" aria-expanded="false" aria-controls="VPNavScreen" data-v-2a96a3d0 data-v-e5dd9c1c><span class="container" data-v-e5dd9c1c><span class="top" data-v-e5dd9c1c></span><span class="middle" data-v-e5dd9c1c></span><span class="bottom" data-v-e5dd9c1c></span></span></button></div></div></div></div><div class="divider" data-v-2a96a3d0><div class="divider-line" data-v-2a96a3d0></div></div></div><!----></header><!----><!----><div class="VPContent is-home" id="VPContent" data-v-1df9f90f data-v-aff0b8d7><div class="VPHome" data-v-aff0b8d7 data-v-8b561e3d><!--[--><!--]--><div class="VPHero VPHomeHero" data-v-8b561e3d data-v-1e96e9e8><div class="container" data-v-1e96e9e8><div class="main" data-v-1e96e9e8><!--[--><!--]--><!--[--><h1 class="heading" data-v-1e96e9e8><span class="name clip" data-v-1e96e9e8>Unified AI Router</span><span class="text" data-v-1e96e9e8>A lightweight OpenAI-compatible server in Nodejs</span></h1><p class="tagline" data-v-1e96e9e8>OpenAI-compatible endpoints, automatic fallback, streaming support, and tool-calling — all in one lightweight package.</p><!--]--><!--[--><!--]--><div class="actions" data-v-1e96e9e8><!--[--><div class="action" data-v-1e96e9e8><a class="VPButton medium brand" href="/Unified-AI-Router/quickstart.html" data-v-1e96e9e8 data-v-01bff58b><!--[-->Quickstart<!--]--></a></div><div class="action" data-v-1e96e9e8><a class="VPButton medium alt" href="/Unified-AI-Router/configuration.html" data-v-1e96e9e8 data-v-01bff58b><!--[-->Configuration<!--]--></a></div><!--]--></div><!--[--><!--]--></div><!----></div></div><!--[--><!--]--><!--[--><!--]--><div class="VPFeatures VPHomeFeatures" data-v-8b561e3d data-v-a6181336><div class="container" data-v-a6181336><div class="items" data-v-a6181336><!--[--><div class="grid-4 item" data-v-a6181336><div class="VPLink no-icon VPFeature" data-v-a6181336 data-v-5219619b><!--[--><article class="box" data-v-5219619b><!----><h2 class="title" data-v-5219619b>Multi-provider fallback</h2><p class="details" data-v-5219619b>If one provider fails, requests automatically fall back to the next available provider.</p><!----></article><!--]--></div></div><div class="grid-4 item" data-v-a6181336><div class="VPLink no-icon VPFeature" data-v-a6181336 data-v-5219619b><!--[--><article class="box" data-v-5219619b><!----><h2 class="title" data-v-5219619b>OpenAI-compatible API</h2><p class="details" data-v-5219619b>Run a drop-in replacement for the OpenAI chat completion endpoints (streaming & non-streaming).</p><!----></article><!--]--></div></div><div class="grid-4 item" data-v-a6181336><div class="VPLink no-icon VPFeature" data-v-a6181336 data-v-5219619b><!--[--><article class="box" data-v-5219619b><!----><h2 class="title" data-v-5219619b>Tool calling & streaming</h2><p class="details" data-v-5219619b>Supports tool-calling metadata and SSE streaming to integrate with existing tooling.</p><!----></article><!--]--></div></div><div class="grid-4 item" data-v-a6181336><div class="VPLink no-icon VPFeature" data-v-a6181336 data-v-5219619b><!--[--><article class="box" data-v-5219619b><!----><h2 class="title" data-v-5219619b>Easy to self-host</h2><p class="details" data-v-5219619b>Run locally or deploy to cloud host providers.</p><!----></article><!--]--></div></div><!--]--></div></div></div><!--[--><!--]--><div class="vp-doc container" style="" data-v-8b561e3d data-v-8e2d4988><!--[--><div style="position:relative;" data-v-8b561e3d><div></div></div><!--]--></div></div></div><!----><!--[--><!--]--></div></div>
|
|
22
|
+
<script>window.__VP_HASH_MAP__=JSON.parse("{\"configuration.md\":\"DanKHGkj\",\"index.md\":\"D1fgr_Mo\",\"quickstart.md\":\"mGNzdQVa\"}");window.__VP_SITE_DATA__=JSON.parse("{\"lang\":\"en-US\",\"dir\":\"ltr\",\"title\":\"Unified AI Router\",\"description\":\"OpenAI-compatible router with multi-provider fallback.\",\"base\":\"/Unified-AI-Router/\",\"head\":[],\"router\":{\"prefetchLinks\":true},\"appearance\":true,\"themeConfig\":{\"nav\":[{\"text\":\"Home\",\"link\":\"/\"},{\"text\":\"Quickstart\",\"link\":\"/quickstart\"},{\"text\":\"Configuration\",\"link\":\"/configuration\"}],\"sidebar\":[{\"text\":\"Guide\",\"items\":[{\"text\":\"Quickstart\",\"link\":\"/quickstart\"},{\"text\":\"Configuration\",\"link\":\"/configuration\"}]}],\"socialLinks\":[{\"icon\":\"github\",\"link\":\"https://github.com/mlibre/Unified-AI-Router\"}]},\"locales\":{},\"scrollOffset\":134,\"cleanUrls\":false,\"additionalConfig\":{}}");</script>
|
|
23
23
|
|
|
24
24
|
</body>
|
|
25
25
|
</html>
|
|
@@ -13,18 +13,18 @@
|
|
|
13
13
|
<link rel="preload" href="/Unified-AI-Router/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
|
|
14
14
|
<link rel="modulepreload" href="/Unified-AI-Router/assets/chunks/theme.h95WUA9L.js">
|
|
15
15
|
<link rel="modulepreload" href="/Unified-AI-Router/assets/chunks/framework.DLCvNBTH.js">
|
|
16
|
-
<link rel="modulepreload" href="/Unified-AI-Router/assets/quickstart.md.
|
|
16
|
+
<link rel="modulepreload" href="/Unified-AI-Router/assets/quickstart.md.mGNzdQVa.lean.js">
|
|
17
17
|
<script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
|
|
18
18
|
<script id="check-mac-os">document.documentElement.classList.toggle("mac",/Mac|iPhone|iPod|iPad/i.test(navigator.platform));</script>
|
|
19
19
|
</head>
|
|
20
20
|
<body>
|
|
21
|
-
<div id="app"><div class="Layout" data-v-1df9f90f><!--[--><!--]--><!--[--><span tabindex="-1" data-v-0b0ada53></span><a href="#VPContent" class="VPSkipLink visually-hidden" data-v-0b0ada53>Skip to content</a><!--]--><!----><header class="VPNav" data-v-1df9f90f data-v-9f75dce3><div class="VPNavBar" data-v-9f75dce3 data-v-2a96a3d0><div class="wrapper" data-v-2a96a3d0><div class="container" data-v-2a96a3d0><div class="title" data-v-2a96a3d0><div class="VPNavBarTitle has-sidebar" data-v-2a96a3d0 data-v-1e38c6bc><a class="title" href="/Unified-AI-Router/" data-v-1e38c6bc><!--[--><!--]--><!----><span data-v-1e38c6bc>Unified AI Router</span><!--[--><!--]--></a></div></div><div class="content" data-v-2a96a3d0><div class="content-body" data-v-2a96a3d0><!--[--><!--]--><div class="VPNavBarSearch search" data-v-2a96a3d0><!----></div><nav aria-labelledby="main-nav-aria-label" class="VPNavBarMenu menu" data-v-2a96a3d0 data-v-39714824><span id="main-nav-aria-label" class="visually-hidden" data-v-39714824> Main Navigation </span><!--[--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/Unified-AI-Router/" tabindex="0" data-v-39714824 data-v-e56f3d57><!--[--><span data-v-e56f3d57>Home</span><!--]--></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink active" href="/Unified-AI-Router/quickstart.html" tabindex="0" data-v-39714824 data-v-e56f3d57><!--[--><span data-v-e56f3d57>Quickstart</span><!--]--></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/Unified-AI-Router/
|
|
21
|
+
<div id="app"><div class="Layout" data-v-1df9f90f><!--[--><!--]--><!--[--><span tabindex="-1" data-v-0b0ada53></span><a href="#VPContent" class="VPSkipLink visually-hidden" data-v-0b0ada53>Skip to content</a><!--]--><!----><header class="VPNav" data-v-1df9f90f data-v-9f75dce3><div class="VPNavBar" data-v-9f75dce3 data-v-2a96a3d0><div class="wrapper" data-v-2a96a3d0><div class="container" data-v-2a96a3d0><div class="title" data-v-2a96a3d0><div class="VPNavBarTitle has-sidebar" data-v-2a96a3d0 data-v-1e38c6bc><a class="title" href="/Unified-AI-Router/" data-v-1e38c6bc><!--[--><!--]--><!----><span data-v-1e38c6bc>Unified AI Router</span><!--[--><!--]--></a></div></div><div class="content" data-v-2a96a3d0><div class="content-body" data-v-2a96a3d0><!--[--><!--]--><div class="VPNavBarSearch search" data-v-2a96a3d0><!----></div><nav aria-labelledby="main-nav-aria-label" class="VPNavBarMenu menu" data-v-2a96a3d0 data-v-39714824><span id="main-nav-aria-label" class="visually-hidden" data-v-39714824> Main Navigation </span><!--[--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/Unified-AI-Router/" tabindex="0" data-v-39714824 data-v-e56f3d57><!--[--><span data-v-e56f3d57>Home</span><!--]--></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink active" href="/Unified-AI-Router/quickstart.html" tabindex="0" data-v-39714824 data-v-e56f3d57><!--[--><span data-v-e56f3d57>Quickstart</span><!--]--></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/Unified-AI-Router/configuration.html" tabindex="0" data-v-39714824 data-v-e56f3d57><!--[--><span data-v-e56f3d57>Configuration</span><!--]--></a><!--]--><!--]--></nav><!----><div class="VPNavBarAppearance appearance" data-v-2a96a3d0 data-v-6c893767><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title aria-checked="false" data-v-6c893767 data-v-5337faa4 data-v-1d5665e3><span class="check" data-v-1d5665e3><span class="icon" data-v-1d5665e3><!--[--><span class="vpi-sun sun" data-v-5337faa4></span><span class="vpi-moon moon" data-v-5337faa4></span><!--]--></span></span></button></div><div class="VPSocialLinks VPNavBarSocialLinks social-links" data-v-2a96a3d0 data-v-0394ad82 data-v-d07f11e6><!--[--><a class="VPSocialLink no-icon" href="https://github.com/mlibre/Unified-AI-Router" aria-label="github" target="_blank" rel="me noopener" data-v-d07f11e6 data-v-591a6b30><span class="vpi-social-github"></span></a><!--]--></div><div class="VPFlyout VPNavBarExtra extra" data-v-2a96a3d0 data-v-bb2aa2f0 data-v-42cb505d><button type="button" class="button" aria-haspopup="true" aria-expanded="false" aria-label="extra navigation" data-v-42cb505d><span class="vpi-more-horizontal icon" data-v-42cb505d></span></button><div class="menu" data-v-42cb505d><div class="VPMenu" data-v-42cb505d data-v-25a6cce8><!----><!--[--><!--[--><!----><div class="group" data-v-bb2aa2f0><div class="item appearance" data-v-bb2aa2f0><p class="label" data-v-bb2aa2f0>Appearance</p><div class="appearance-action" data-v-bb2aa2f0><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title aria-checked="false" data-v-bb2aa2f0 data-v-5337faa4 data-v-1d5665e3><span class="check" data-v-1d5665e3><span class="icon" data-v-1d5665e3><!--[--><span class="vpi-sun sun" data-v-5337faa4></span><span class="vpi-moon moon" data-v-5337faa4></span><!--]--></span></span></button></div></div></div><div class="group" data-v-bb2aa2f0><div class="item social-links" data-v-bb2aa2f0><div class="VPSocialLinks social-links-list" data-v-bb2aa2f0 data-v-d07f11e6><!--[--><a class="VPSocialLink no-icon" href="https://github.com/mlibre/Unified-AI-Router" aria-label="github" target="_blank" rel="me noopener" data-v-d07f11e6 data-v-591a6b30><span class="vpi-social-github"></span></a><!--]--></div></div></div><!--]--><!--]--></div></div></div><!--[--><!--]--><button type="button" class="VPNavBarHamburger hamburger" aria-label="mobile navigation" aria-expanded="false" aria-controls="VPNavScreen" data-v-2a96a3d0 data-v-e5dd9c1c><span class="container" data-v-e5dd9c1c><span class="top" data-v-e5dd9c1c></span><span class="middle" data-v-e5dd9c1c></span><span class="bottom" data-v-e5dd9c1c></span></span></button></div></div></div></div><div class="divider" data-v-2a96a3d0><div class="divider-line" data-v-2a96a3d0></div></div></div><!----></header><div class="VPLocalNav has-sidebar empty" data-v-1df9f90f data-v-8acdfeb5><div class="container" data-v-8acdfeb5><button class="menu" aria-expanded="false" aria-controls="VPSidebarNav" data-v-8acdfeb5><span class="vpi-align-left menu-icon" data-v-8acdfeb5></span><span class="menu-text" data-v-8acdfeb5>Menu</span></button><div class="VPLocalNavOutlineDropdown" style="--vp-vh:0px;" data-v-8acdfeb5 data-v-0bf0e06f><button data-v-0bf0e06f>Return to top</button><!----></div></div></div><aside class="VPSidebar" data-v-1df9f90f data-v-e7c6e512><div class="curtain" data-v-e7c6e512></div><nav class="nav" id="VPSidebarNav" aria-labelledby="sidebar-aria-label" tabindex="-1" data-v-e7c6e512><span class="visually-hidden" id="sidebar-aria-label" data-v-e7c6e512> Sidebar Navigation </span><!--[--><!--]--><!--[--><div class="no-transition group" data-v-8d50c081><section class="VPSidebarItem level-0 has-active" data-v-8d50c081 data-v-d81de50c><div class="item" role="button" tabindex="0" data-v-d81de50c><div class="indicator" data-v-d81de50c></div><h2 class="text" data-v-d81de50c>Guide</h2><!----></div><div class="items" data-v-d81de50c><!--[--><div class="VPSidebarItem level-1 is-link" data-v-d81de50c data-v-d81de50c><div class="item" data-v-d81de50c><div class="indicator" data-v-d81de50c></div><a class="VPLink link link" href="/Unified-AI-Router/quickstart.html" data-v-d81de50c><!--[--><p class="text" data-v-d81de50c>Quickstart</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-d81de50c data-v-d81de50c><div class="item" data-v-d81de50c><div class="indicator" data-v-d81de50c></div><a class="VPLink link link" href="/Unified-AI-Router/configuration.html" data-v-d81de50c><!--[--><p class="text" data-v-d81de50c>Configuration</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><!--]--><!--[--><!--]--></nav></aside><div class="VPContent has-sidebar" id="VPContent" data-v-1df9f90f data-v-aff0b8d7><div class="VPDoc has-sidebar has-aside" data-v-aff0b8d7 data-v-7011f0d8><!--[--><!--]--><div class="container" data-v-7011f0d8><div class="aside" data-v-7011f0d8><div class="aside-curtain" data-v-7011f0d8></div><div class="aside-container" data-v-7011f0d8><div class="aside-content" data-v-7011f0d8><div class="VPDocAside" data-v-7011f0d8 data-v-3f215769><!--[--><!--]--><!--[--><!--]--><nav aria-labelledby="doc-outline-aria-label" class="VPDocAsideOutline" data-v-3f215769 data-v-60d5052e><div class="content" data-v-60d5052e><div class="outline-marker" data-v-60d5052e></div><div aria-level="2" class="outline-title" id="doc-outline-aria-label" role="heading" data-v-60d5052e>On this page</div><ul class="VPDocOutlineItem root" data-v-60d5052e data-v-2d0bdf9b><!--[--><!--]--></ul></div></nav><!--[--><!--]--><div class="spacer" data-v-3f215769></div><!--[--><!--]--><!----><!--[--><!--]--><!--[--><!--]--></div></div></div></div><div class="content" data-v-7011f0d8><div class="content-container" data-v-7011f0d8><!--[--><!--]--><main class="main" data-v-7011f0d8><div style="position:relative;" class="vp-doc _Unified-AI-Router_quickstart" data-v-7011f0d8><div><h1 id="quickstart-—-run-locally-in-minutes" tabindex="-1">Quickstart — Run locally in minutes <a class="header-anchor" href="#quickstart-—-run-locally-in-minutes" aria-label="Permalink to “Quickstart — Run locally in minutes”"></a></h1><p>This page walks you through running the OpenAI-compatible server locally and calling the <code>/v1/chat/completions</code> endpoint.</p><h2 id="_1-install" tabindex="-1">1) Install <a class="header-anchor" href="#_1-install" aria-label="Permalink to “1) Install”"></a></h2><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;" tabindex="0" dir="ltr"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">git</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> clone</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> https://github.com/mlibre/Unified-AI-Router.git</span></span>
|
|
22
22
|
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">cd</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> Unified-AI-Router</span></span>
|
|
23
23
|
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">npm</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> install</span></span></code></pre></div><h2 id="_2-configure-api-keys" tabindex="-1">2) Configure API keys <a class="header-anchor" href="#_2-configure-api-keys" aria-label="Permalink to “2) Configure API keys”"></a></h2><p>Copy the example env file and populate the keys for the providers you want to use:</p><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;" tabindex="0" dir="ltr"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">cp</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> .env.example</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> .env</span></span>
|
|
24
24
|
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># edit .env and add keys (OPENAI_API_KEY, GEMINI_API_KEY, etc.)</span></span></code></pre></div><p>Edit <code>provider.js</code> to enable or reorder providers (the router tries them in array order).</p><h2 id="_3-start-the-server" tabindex="-1">3) Start the server <a class="header-anchor" href="#_3-start-the-server" aria-label="Permalink to “3) Start the server”"></a></h2><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;" tabindex="0" dir="ltr"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">npm</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> start</span></span></code></pre></div><p>By default the server listens on <code>http://localhost:3000</code> and supports these OpenAI-compatible endpoints:</p><ul><li><code>POST /v1/chat/completions</code> — streaming & non-streaming chat completions</li><li><code>POST /chat/completions</code> — same as above (alternate path)</li><li><code>GET /v1/models</code> & <code>GET /models</code> — lists models available from providers</li><li><code>GET /health</code> — health check</li></ul><h2 id="_4-quick-test-non-streaming" tabindex="-1">4) Quick test (non-streaming) <a class="header-anchor" href="#_4-quick-test-non-streaming" aria-label="Permalink to “4) Quick test (non-streaming)”"></a></h2><p>Use <code>curl</code> or your HTTP client to test a simple chat completion:</p><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;" tabindex="0" dir="ltr"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">curl</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -s</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -X</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> POST</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> http://localhost:3000/v1/chat/completions</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \</span></span>
|
|
25
25
|
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -H</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> "Content-Type: application/json"</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> \</span></span>
|
|
26
|
-
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -d</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> '{ "messages": [{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Say hello." }], "model":"gpt-3.5-turbo" }'</span></span></code></pre></div><h2 id="_5-next-steps" tabindex="-1">5) Next steps <a class="header-anchor" href="#_5-next-steps" aria-label="Permalink to “5) Next steps”"></a></h2><ul><li>Configure additional providers in <code>provider.js</code> and set env keys.</li><li>Try streaming by setting <code>stream: true</code> when calling the endpoint.</li><li>See <code>tests/</code> for example scripts that exercise streaming, non-streaming, and tools.</li></ul></div></div></main><footer class="VPDocFooter" data-v-7011f0d8 data-v-e257564d><!--[--><!--]--><!----><nav class="prev-next" aria-labelledby="doc-footer-aria-label" data-v-e257564d><span class="visually-hidden" id="doc-footer-aria-label" data-v-e257564d>Pager</span><div class="pager" data-v-e257564d><!----></div><div class="pager" data-v-e257564d><a class="VPLink link pager-link next" href="/Unified-AI-Router/
|
|
27
|
-
<script>window.__VP_HASH_MAP__=JSON.parse("{\"
|
|
26
|
+
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -d</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> '{ "messages": [{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Say hello." }], "model":"gpt-3.5-turbo" }'</span></span></code></pre></div><h2 id="_5-next-steps" tabindex="-1">5) Next steps <a class="header-anchor" href="#_5-next-steps" aria-label="Permalink to “5) Next steps”"></a></h2><ul><li>Configure additional providers in <code>provider.js</code> and set env keys.</li><li>Try streaming by setting <code>stream: true</code> when calling the endpoint.</li><li>See <code>tests/</code> for example scripts that exercise streaming, non-streaming, and tools.</li></ul></div></div></main><footer class="VPDocFooter" data-v-7011f0d8 data-v-e257564d><!--[--><!--]--><!----><nav class="prev-next" aria-labelledby="doc-footer-aria-label" data-v-e257564d><span class="visually-hidden" id="doc-footer-aria-label" data-v-e257564d>Pager</span><div class="pager" data-v-e257564d><!----></div><div class="pager" data-v-e257564d><a class="VPLink link pager-link next" href="/Unified-AI-Router/configuration.html" data-v-e257564d><!--[--><span class="desc" data-v-e257564d>Next page</span><span class="title" data-v-e257564d>Configuration</span><!--]--></a></div></nav></footer><!--[--><!--]--></div></div></div><!--[--><!--]--></div></div><!----><!--[--><!--]--></div></div>
|
|
27
|
+
<script>window.__VP_HASH_MAP__=JSON.parse("{\"configuration.md\":\"DanKHGkj\",\"index.md\":\"D1fgr_Mo\",\"quickstart.md\":\"mGNzdQVa\"}");window.__VP_SITE_DATA__=JSON.parse("{\"lang\":\"en-US\",\"dir\":\"ltr\",\"title\":\"Unified AI Router\",\"description\":\"OpenAI-compatible router with multi-provider fallback.\",\"base\":\"/Unified-AI-Router/\",\"head\":[],\"router\":{\"prefetchLinks\":true},\"appearance\":true,\"themeConfig\":{\"nav\":[{\"text\":\"Home\",\"link\":\"/\"},{\"text\":\"Quickstart\",\"link\":\"/quickstart\"},{\"text\":\"Configuration\",\"link\":\"/configuration\"}],\"sidebar\":[{\"text\":\"Guide\",\"items\":[{\"text\":\"Quickstart\",\"link\":\"/quickstart\"},{\"text\":\"Configuration\",\"link\":\"/configuration\"}]}],\"socialLinks\":[{\"icon\":\"github\",\"link\":\"https://github.com/mlibre/Unified-AI-Router\"}]},\"locales\":{},\"scrollOffset\":134,\"cleanUrls\":false,\"additionalConfig\":{}}");</script>
|
|
28
28
|
|
|
29
29
|
</body>
|
|
30
30
|
</html>
|
package/docs/index.md
CHANGED
|
@@ -3,7 +3,7 @@ layout: home
|
|
|
3
3
|
|
|
4
4
|
hero:
|
|
5
5
|
name: "Unified AI Router"
|
|
6
|
-
text: "A lightweight OpenAI-compatible
|
|
6
|
+
text: "A lightweight OpenAI-compatible server in Nodejs"
|
|
7
7
|
tagline: "OpenAI-compatible endpoints, automatic fallback, streaming support, and tool-calling — all in one lightweight package."
|
|
8
8
|
actions:
|
|
9
9
|
- theme: brand
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unified-ai-router",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.2",
|
|
4
4
|
"description": "A unified interface for multiple LLM providers with automatic fallback. This project includes an OpenAI-compatible server and a deployable Telegram bot with a Mini App interface. It supports major providers like OpenAI, Google, Grok, and more, ensuring reliability and flexibility for your AI applications.",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "mlibre",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e,c as t,o as a}from"./chunks/framework.DLCvNBTH.js";const m=JSON.parse('{"title":"","description":"","frontmatter":{"layout":"home","hero":{"name":"Unified AI Router","text":"A lightweight OpenAI-compatible router that provides unified, high-availability access to multiple LLM providers.","tagline":"OpenAI-compatible endpoints, automatic fallback, streaming support, and tool-calling — all in one lightweight package.","actions":[{"theme":"brand","text":"Quickstart","link":"/quickstart"},{"theme":"alt","text":"Docs (API & Examples)","link":"/overview"}]},"features":[{"title":"Multi-provider fallback","details":"If one provider fails, requests automatically fall back to the next available provider."},{"title":"OpenAI-compatible API","details":"Run a drop-in replacement for the OpenAI chat completion endpoints (streaming & non-streaming)."},{"title":"Tool calling & streaming","details":"Supports tool-calling metadata and SSE streaming to integrate with existing tooling."},{"title":"Easy to self-host","details":"Run locally or deploy to Render, Vercel, or GitHub Pages for docs."}]},"headers":[],"relativePath":"index.md","filePath":"index.md"}'),i={name:"index.md"};function o(l,n,r,s,c,p){return a(),t("div")}const u=e(i,[["render",o]]);export{m as __pageData,u as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e,c as t,o as a}from"./chunks/framework.DLCvNBTH.js";const m=JSON.parse('{"title":"","description":"","frontmatter":{"layout":"home","hero":{"name":"Unified AI Router","text":"A lightweight OpenAI-compatible router that provides unified, high-availability access to multiple LLM providers.","tagline":"OpenAI-compatible endpoints, automatic fallback, streaming support, and tool-calling — all in one lightweight package.","actions":[{"theme":"brand","text":"Quickstart","link":"/quickstart"},{"theme":"alt","text":"Docs (API & Examples)","link":"/overview"}]},"features":[{"title":"Multi-provider fallback","details":"If one provider fails, requests automatically fall back to the next available provider."},{"title":"OpenAI-compatible API","details":"Run a drop-in replacement for the OpenAI chat completion endpoints (streaming & non-streaming)."},{"title":"Tool calling & streaming","details":"Supports tool-calling metadata and SSE streaming to integrate with existing tooling."},{"title":"Easy to self-host","details":"Run locally or deploy to Render, Vercel, or GitHub Pages for docs."}]},"headers":[],"relativePath":"index.md","filePath":"index.md"}'),i={name:"index.md"};function o(l,n,r,s,c,p){return a(),t("div")}const u=e(i,[["render",o]]);export{m as __pageData,u as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as o,c as t,o as r,af as i}from"./chunks/framework.DLCvNBTH.js";const v=JSON.parse('{"title":"Overview & API","description":"","frontmatter":{},"headers":[],"relativePath":"overview.md","filePath":"overview.md"}'),s={name:"overview.md"};function a(n,e,p,d,l,c){return r(),t("div",null,[...e[0]||(e[0]=[i('<h1 id="overview-api" tabindex="-1">Overview & API <a class="header-anchor" href="#overview-api" aria-label="Permalink to “Overview & API”"></a></h1><p>This section collects the most important docs for the project: provider configuration, API compatibility notes, deployment tips, and examples.</p><ul><li><strong>Provider configuration</strong> — Edit <code>provider.js</code> to add/remove providers or change model selections.</li><li><strong>Compatibility</strong> — The server exposes OpenAI-compatible endpoints but routes requests through multiple providers.</li><li><strong>Deploy</strong> — Use Render, Vercel, or GitHub Actions for docs. See <code>readme.md</code> for deployment examples.</li></ul><p>For examples, testing scripts and inline usage see the <code>/tests</code> folder in the repo.</p>',4)])])}const _=o(s,[["render",a]]);export{v as __pageData,_ as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as o,c as t,o as r,af as i}from"./chunks/framework.DLCvNBTH.js";const v=JSON.parse('{"title":"Overview & API","description":"","frontmatter":{},"headers":[],"relativePath":"overview.md","filePath":"overview.md"}'),s={name:"overview.md"};function a(n,e,p,d,l,c){return r(),t("div",null,[...e[0]||(e[0]=[i("",4)])])}const _=o(s,[["render",a]]);export{v as __pageData,_ as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as i,c as a,o as e,af as t}from"./chunks/framework.DLCvNBTH.js";const c=JSON.parse('{"title":"Quickstart — Run locally in minutes","description":"","frontmatter":{},"headers":[],"relativePath":"quickstart.md","filePath":"quickstart.md"}'),n={name:"quickstart.md"};function l(h,s,r,o,p,d){return e(),a("div",null,[...s[0]||(s[0]=[t("",17)])])}const u=i(n,[["render",l]]);export{c as __pageData,u as default};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en-US" dir="ltr">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
-
<title>Overview & API | Unified AI Router</title>
|
|
7
|
-
<meta name="description" content="OpenAI-compatible router with multi-provider fallback.">
|
|
8
|
-
<meta name="generator" content="VitePress v2.0.0-alpha.12">
|
|
9
|
-
<link rel="preload stylesheet" href="/Unified-AI-Router/assets/style.CVX7x1tQ.css" as="style">
|
|
10
|
-
<link rel="preload stylesheet" href="/Unified-AI-Router/vp-icons.css" as="style">
|
|
11
|
-
|
|
12
|
-
<script type="module" src="/Unified-AI-Router/assets/app.BKyBzHbv.js"></script>
|
|
13
|
-
<link rel="preload" href="/Unified-AI-Router/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
|
|
14
|
-
<link rel="modulepreload" href="/Unified-AI-Router/assets/chunks/theme.h95WUA9L.js">
|
|
15
|
-
<link rel="modulepreload" href="/Unified-AI-Router/assets/chunks/framework.DLCvNBTH.js">
|
|
16
|
-
<link rel="modulepreload" href="/Unified-AI-Router/assets/overview.md.CBO-d9uK.lean.js">
|
|
17
|
-
<script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
|
|
18
|
-
<script id="check-mac-os">document.documentElement.classList.toggle("mac",/Mac|iPhone|iPod|iPad/i.test(navigator.platform));</script>
|
|
19
|
-
</head>
|
|
20
|
-
<body>
|
|
21
|
-
<div id="app"><div class="Layout" data-v-1df9f90f><!--[--><!--]--><!--[--><span tabindex="-1" data-v-0b0ada53></span><a href="#VPContent" class="VPSkipLink visually-hidden" data-v-0b0ada53>Skip to content</a><!--]--><!----><header class="VPNav" data-v-1df9f90f data-v-9f75dce3><div class="VPNavBar" data-v-9f75dce3 data-v-2a96a3d0><div class="wrapper" data-v-2a96a3d0><div class="container" data-v-2a96a3d0><div class="title" data-v-2a96a3d0><div class="VPNavBarTitle has-sidebar" data-v-2a96a3d0 data-v-1e38c6bc><a class="title" href="/Unified-AI-Router/" data-v-1e38c6bc><!--[--><!--]--><!----><span data-v-1e38c6bc>Unified AI Router</span><!--[--><!--]--></a></div></div><div class="content" data-v-2a96a3d0><div class="content-body" data-v-2a96a3d0><!--[--><!--]--><div class="VPNavBarSearch search" data-v-2a96a3d0><!----></div><nav aria-labelledby="main-nav-aria-label" class="VPNavBarMenu menu" data-v-2a96a3d0 data-v-39714824><span id="main-nav-aria-label" class="visually-hidden" data-v-39714824> Main Navigation </span><!--[--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/Unified-AI-Router/" tabindex="0" data-v-39714824 data-v-e56f3d57><!--[--><span data-v-e56f3d57>Home</span><!--]--></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/Unified-AI-Router/quickstart.html" tabindex="0" data-v-39714824 data-v-e56f3d57><!--[--><span data-v-e56f3d57>Quickstart</span><!--]--></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink active" href="/Unified-AI-Router/overview.html" tabindex="0" data-v-39714824 data-v-e56f3d57><!--[--><span data-v-e56f3d57>Overview</span><!--]--></a><!--]--><!--]--></nav><!----><div class="VPNavBarAppearance appearance" data-v-2a96a3d0 data-v-6c893767><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title aria-checked="false" data-v-6c893767 data-v-5337faa4 data-v-1d5665e3><span class="check" data-v-1d5665e3><span class="icon" data-v-1d5665e3><!--[--><span class="vpi-sun sun" data-v-5337faa4></span><span class="vpi-moon moon" data-v-5337faa4></span><!--]--></span></span></button></div><div class="VPSocialLinks VPNavBarSocialLinks social-links" data-v-2a96a3d0 data-v-0394ad82 data-v-d07f11e6><!--[--><a class="VPSocialLink no-icon" href="https://github.com/mlibre/Unified-AI-Router" aria-label="github" target="_blank" rel="me noopener" data-v-d07f11e6 data-v-591a6b30><span class="vpi-social-github"></span></a><!--]--></div><div class="VPFlyout VPNavBarExtra extra" data-v-2a96a3d0 data-v-bb2aa2f0 data-v-42cb505d><button type="button" class="button" aria-haspopup="true" aria-expanded="false" aria-label="extra navigation" data-v-42cb505d><span class="vpi-more-horizontal icon" data-v-42cb505d></span></button><div class="menu" data-v-42cb505d><div class="VPMenu" data-v-42cb505d data-v-25a6cce8><!----><!--[--><!--[--><!----><div class="group" data-v-bb2aa2f0><div class="item appearance" data-v-bb2aa2f0><p class="label" data-v-bb2aa2f0>Appearance</p><div class="appearance-action" data-v-bb2aa2f0><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title aria-checked="false" data-v-bb2aa2f0 data-v-5337faa4 data-v-1d5665e3><span class="check" data-v-1d5665e3><span class="icon" data-v-1d5665e3><!--[--><span class="vpi-sun sun" data-v-5337faa4></span><span class="vpi-moon moon" data-v-5337faa4></span><!--]--></span></span></button></div></div></div><div class="group" data-v-bb2aa2f0><div class="item social-links" data-v-bb2aa2f0><div class="VPSocialLinks social-links-list" data-v-bb2aa2f0 data-v-d07f11e6><!--[--><a class="VPSocialLink no-icon" href="https://github.com/mlibre/Unified-AI-Router" aria-label="github" target="_blank" rel="me noopener" data-v-d07f11e6 data-v-591a6b30><span class="vpi-social-github"></span></a><!--]--></div></div></div><!--]--><!--]--></div></div></div><!--[--><!--]--><button type="button" class="VPNavBarHamburger hamburger" aria-label="mobile navigation" aria-expanded="false" aria-controls="VPNavScreen" data-v-2a96a3d0 data-v-e5dd9c1c><span class="container" data-v-e5dd9c1c><span class="top" data-v-e5dd9c1c></span><span class="middle" data-v-e5dd9c1c></span><span class="bottom" data-v-e5dd9c1c></span></span></button></div></div></div></div><div class="divider" data-v-2a96a3d0><div class="divider-line" data-v-2a96a3d0></div></div></div><!----></header><div class="VPLocalNav has-sidebar empty" data-v-1df9f90f data-v-8acdfeb5><div class="container" data-v-8acdfeb5><button class="menu" aria-expanded="false" aria-controls="VPSidebarNav" data-v-8acdfeb5><span class="vpi-align-left menu-icon" data-v-8acdfeb5></span><span class="menu-text" data-v-8acdfeb5>Menu</span></button><div class="VPLocalNavOutlineDropdown" style="--vp-vh:0px;" data-v-8acdfeb5 data-v-0bf0e06f><button data-v-0bf0e06f>Return to top</button><!----></div></div></div><aside class="VPSidebar" data-v-1df9f90f data-v-e7c6e512><div class="curtain" data-v-e7c6e512></div><nav class="nav" id="VPSidebarNav" aria-labelledby="sidebar-aria-label" tabindex="-1" data-v-e7c6e512><span class="visually-hidden" id="sidebar-aria-label" data-v-e7c6e512> Sidebar Navigation </span><!--[--><!--]--><!--[--><div class="no-transition group" data-v-8d50c081><section class="VPSidebarItem level-0 has-active" data-v-8d50c081 data-v-d81de50c><div class="item" role="button" tabindex="0" data-v-d81de50c><div class="indicator" data-v-d81de50c></div><h2 class="text" data-v-d81de50c>Guide</h2><!----></div><div class="items" data-v-d81de50c><!--[--><div class="VPSidebarItem level-1 is-link" data-v-d81de50c data-v-d81de50c><div class="item" data-v-d81de50c><div class="indicator" data-v-d81de50c></div><a class="VPLink link link" href="/Unified-AI-Router/quickstart.html" data-v-d81de50c><!--[--><p class="text" data-v-d81de50c>Quickstart</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-d81de50c data-v-d81de50c><div class="item" data-v-d81de50c><div class="indicator" data-v-d81de50c></div><a class="VPLink link link" href="/Unified-AI-Router/overview.html" data-v-d81de50c><!--[--><p class="text" data-v-d81de50c>Overview & API</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><!--]--><!--[--><!--]--></nav></aside><div class="VPContent has-sidebar" id="VPContent" data-v-1df9f90f data-v-aff0b8d7><div class="VPDoc has-sidebar has-aside" data-v-aff0b8d7 data-v-7011f0d8><!--[--><!--]--><div class="container" data-v-7011f0d8><div class="aside" data-v-7011f0d8><div class="aside-curtain" data-v-7011f0d8></div><div class="aside-container" data-v-7011f0d8><div class="aside-content" data-v-7011f0d8><div class="VPDocAside" data-v-7011f0d8 data-v-3f215769><!--[--><!--]--><!--[--><!--]--><nav aria-labelledby="doc-outline-aria-label" class="VPDocAsideOutline" data-v-3f215769 data-v-60d5052e><div class="content" data-v-60d5052e><div class="outline-marker" data-v-60d5052e></div><div aria-level="2" class="outline-title" id="doc-outline-aria-label" role="heading" data-v-60d5052e>On this page</div><ul class="VPDocOutlineItem root" data-v-60d5052e data-v-2d0bdf9b><!--[--><!--]--></ul></div></nav><!--[--><!--]--><div class="spacer" data-v-3f215769></div><!--[--><!--]--><!----><!--[--><!--]--><!--[--><!--]--></div></div></div></div><div class="content" data-v-7011f0d8><div class="content-container" data-v-7011f0d8><!--[--><!--]--><main class="main" data-v-7011f0d8><div style="position:relative;" class="vp-doc _Unified-AI-Router_overview" data-v-7011f0d8><div><h1 id="overview-api" tabindex="-1">Overview & API <a class="header-anchor" href="#overview-api" aria-label="Permalink to “Overview & API”"></a></h1><p>This section collects the most important docs for the project: provider configuration, API compatibility notes, deployment tips, and examples.</p><ul><li><strong>Provider configuration</strong> — Edit <code>provider.js</code> to add/remove providers or change model selections.</li><li><strong>Compatibility</strong> — The server exposes OpenAI-compatible endpoints but routes requests through multiple providers.</li><li><strong>Deploy</strong> — Use Render, Vercel, or GitHub Actions for docs. See <code>readme.md</code> for deployment examples.</li></ul><p>For examples, testing scripts and inline usage see the <code>/tests</code> folder in the repo.</p></div></div></main><footer class="VPDocFooter" data-v-7011f0d8 data-v-e257564d><!--[--><!--]--><!----><nav class="prev-next" aria-labelledby="doc-footer-aria-label" data-v-e257564d><span class="visually-hidden" id="doc-footer-aria-label" data-v-e257564d>Pager</span><div class="pager" data-v-e257564d><a class="VPLink link pager-link prev" href="/Unified-AI-Router/quickstart.html" data-v-e257564d><!--[--><span class="desc" data-v-e257564d>Previous page</span><span class="title" data-v-e257564d>Quickstart</span><!--]--></a></div><div class="pager" data-v-e257564d><!----></div></nav></footer><!--[--><!--]--></div></div></div><!--[--><!--]--></div></div><!----><!--[--><!--]--></div></div>
|
|
22
|
-
<script>window.__VP_HASH_MAP__=JSON.parse("{\"index.md\":\"BEq0uQr4\",\"overview.md\":\"CBO-d9uK\",\"quickstart.md\":\"CcVBvYS-\"}");window.__VP_SITE_DATA__=JSON.parse("{\"lang\":\"en-US\",\"dir\":\"ltr\",\"title\":\"Unified AI Router\",\"description\":\"OpenAI-compatible router with multi-provider fallback.\",\"base\":\"/Unified-AI-Router/\",\"head\":[],\"router\":{\"prefetchLinks\":true},\"appearance\":true,\"themeConfig\":{\"nav\":[{\"text\":\"Home\",\"link\":\"/\"},{\"text\":\"Quickstart\",\"link\":\"/quickstart\"},{\"text\":\"Overview\",\"link\":\"/overview\"}],\"sidebar\":[{\"text\":\"Guide\",\"items\":[{\"text\":\"Quickstart\",\"link\":\"/quickstart\"},{\"text\":\"Overview & API\",\"link\":\"/overview\"}]}],\"socialLinks\":[{\"icon\":\"github\",\"link\":\"https://github.com/mlibre/Unified-AI-Router\"}]},\"locales\":{},\"scrollOffset\":134,\"cleanUrls\":false,\"additionalConfig\":{}}");</script>
|
|
23
|
-
|
|
24
|
-
</body>
|
|
25
|
-
</html>
|