How to configure resilient clusters of LLM providers.
When running LLM applications in production, you cannot rely on a single upstream provider. Rate limits, regional outages, and quota expirations highlight the need for robust HA (High Availability) strategies.Open Next Router includes a powerful balance directive that lets you handle these failovers dynamically, right from your DSL configs.
The balance Block
The balance block allows you to instruct ONR on how to route incoming requests when multiple credentials or upstream targets are available for a given path.
Priority Failover (Active-Passive)
The most common technique is Priority Failover. You set up a primary credential and multiple backups. The system routes exclusively to the primary, but instantly falls back to the backups if the primary responds with an HTTP error code (like 429 Too Many Requests or 500 Internal Server Error).
# config/providers/openai.confprovider openai { mapper = "openai"}model "gpt-4" { provider = "openai" balance { strategy = "priority" # Using credential arrays. They are attempted in order. # If the first fails, it falls back to the second. credentials = [ "sk-proj-primary...", "sk-proj-backup-1...", "sk-proj-backup-for-backups..." ] }}
Round Robin (Active-Active)
If you merely want to distribute traffic evenly across multiple keys or instances to maximize your concurrency layout, use the round_robin strategy.
A true Multi-LLM gateway shines when it can fall back across entirely different providers.Suppose your API client requests gpt-4o. If OpenAI APIs are completely down, you can configure ONR to rewrite the request seamlessly to Anthropic’s claude-3-5-sonnet. By the time the response hits the client, ONR will have transformed Anthropic’s response back into the OpenAI gpt-4o structure.
# Map a virtual model to a primary providermodel "virtual-gpt-4o" { provider = "openai" # When the client requests "gpt-4o", ONR proxies to real "gpt-4o" req_map { model = "gpt-4o" } balance { strategy = "priority" # 1. First, try OpenAI target { provider = "openai" credential = "sk-openai..." } # 2. If OpenAI completely fails, failover to Anthropic target { provider = "anthropic" credential = "sk-ant..." # We override the model inside the target block specifically for Anthropic req_map { model = "claude-3-5-sonnet-20241022" } } }}
Retry and Error Configurations
You can further control exactly how many times ONR should retry, and which HTTP status codes count as failures invoking the fallback.
balance { strategy = "priority" retry = 3 # Status codes that trigger the failover (default usually includes 429 and 50x) retry_status_codes = [429, 500, 502, 503, 504] credentials = [ "sk-primary...", "sk-backup..." ]}
When tracing fallback journeys in the TUI (onr-admin tui) or access logs, you will notice ONR records exactly which targets were attempted and failed before finally returning a successful stream to the client.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Open Next Router","description":"A lightweight, DSL-driven LLM gateway for routing, compatibility transforms, and streaming normalization across providers.","colors":{"primary":"#0B5FFF","light":"#3B82F6","dark":"#1D4ED8"},"favicon":"https://mintcdn.com/onr/U2NfwB9j8fCK5Fwa/favicon.svg?fit=max\u0026auto=format\u0026n=U2NfwB9j8fCK5Fwa\u0026q=85\u0026s=c357fc88f1aeff7737232daa0fc071f5","background":{"decoration":"gradient"},"navbar":{"links":[{"href":"https://github.com/r9s-ai/open-next-router","type":"github"},{"href":"https://t.me/opennextrouter","label":"Telegram"},{"href":"https://discord.gg/HBM67dP8","type":"discord"}]},"contextual":{"options":["copy","view","chatgpt","claude"],"display":"header"},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"onr","hasAudioNarration":false,"actualSubdomain":"onr","customDomains":[],"gitSource":{"type":"github","owner":"r9s-ai","repo":"onr-docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":"","_id":"6b10d4759ffae5051c40c878"},"entitlements":{},"buildId":"6b1252cb8b151dfd160e514a","clientVersion":"0.0.4453","searchFilterCounts":[{"language":"default","tag":"Documentation","count":49},{"language":"default","tag":"DSL","count":15},{"language":"default","tag":"Blocks","count":9},{"language":"default","tag":"Guides \u0026 Cookbooks","count":7},{"language":"default","tag":"Core Flow","count":6},{"language":"default","tag":"Concepts \u0026 Design","count":5},{"language":"default","tag":"API","count":4},{"language":"default","tag":"Configuration","count":4},{"language":"default","tag":"Community \u0026 Contributing","count":4},{"language":"default","tag":"Start","count":4}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"treatment","enabled":true,"payload":{"type":"string","value":"treatment"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"auth-vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":false},"customCss":[]}
{"page":{"pagePath":"guides/load-balancing","slug":"/guides/load-balancing","pageMetadata":{"title":"Load Balancing \u0026 Fallbacks","description":"How to configure resilient clusters of LLM providers.","href":"/guides/load-balancing"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"How to configure resilient clusters of LLM providers.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={code:`code`,em:`em`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,..._provideComponents(),...props.components},{CodeBlock,Heading,Tip}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Tip)_missingMdxReference(`Tip`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`When running LLM applications in production, you cannot rely on a single upstream provider. Rate limits, regional outages, and quota expirations highlight the need for robust HA (High Availability) strategies.`}),`\n`,_jsxs(_components.p,{children:[`Open Next Router includes a powerful `,_jsx(_components.code,{children:`balance`}),` directive that lets you handle these failovers dynamically, right from your DSL configs.`]}),`\n`,_jsxs(Heading,{level:`2`,id:`the-balance-block`,children:[`The `,_jsx(_components.code,{children:`balance`}),` Block`]}),`\n`,_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`balance`}),` block allows you to instruct ONR on how to route incoming requests when multiple credentials or upstream targets are available for a given path.`]}),`\n`,_jsx(Heading,{level:`3`,id:`priority-failover-active-passive`,children:`Priority Failover (Active-Passive)`}),`\n`,_jsxs(_components.p,{children:[`The most common technique is `,_jsx(_components.strong,{children:`Priority Failover`}),`. You set up a primary credential and multiple backups. The system routes exclusively to the primary, but instantly falls back to the backups if the primary responds with an HTTP error code (like `,_jsx(_components.code,{children:`429 Too Many Requests`}),` or `,_jsx(_components.code,{children:`500 Internal Server Error`}),`).`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`20`,language:`nginx`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`nginx`,children:_jsxs(_components.code,{language:`nginx`,numberOfLines:`20`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# config/providers/openai.conf`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`provider`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` openai {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` mapper`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` = `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"openai\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`model`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"gpt-4\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` provider`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` = `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"openai\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` balance`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` strategy`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` = `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"priority\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # Using credential arrays. They are attempted in order.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # If the first fails, it falls back to the second.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` credentials`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` = [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` \"sk-proj-primary...\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` \"sk-proj-backup-1...\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` \"sk-proj-backup-for-backups...\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`round-robin-active-active`,children:`Round Robin (Active-Active)`}),`\n`,_jsxs(_components.p,{children:[`If you merely want to distribute traffic evenly across multiple keys or instances to maximize your concurrency layout, use the `,_jsx(_components.code,{children:`round_robin`}),` strategy.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`12`,language:`nginx`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`nginx`,children:_jsxs(_components.code,{language:`nginx`,numberOfLines:`12`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`model`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"gpt-4o\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` provider`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` = `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"openai\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` balance`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` strategy`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` = `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"round_robin\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` credentials`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` = [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` \"sk-key-A...\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` \"sk-key-B...\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`cross-provider-fallbacks`,children:`Cross-Provider Fallbacks`}),`\n`,_jsxs(_components.p,{children:[`A true Multi-LLM gateway shines when it can fall back `,_jsx(_components.em,{children:`across entirely different providers`}),`.`]}),`\n`,_jsxs(_components.p,{children:[`Suppose your API client requests `,_jsx(_components.code,{children:`gpt-4o`}),`. If OpenAI APIs are completely down, you can configure ONR to rewrite the request seamlessly to Anthropic’s `,_jsx(_components.code,{children:`claude-3-5-sonnet`}),`. By the time the response hits the client, ONR will have transformed Anthropic’s response back into the OpenAI `,_jsx(_components.code,{children:`gpt-4o`}),` structure.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`30`,language:`nginx`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`nginx`,children:_jsxs(_components.code,{language:`nginx`,numberOfLines:`30`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Map a virtual model to a primary provider`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`model`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"virtual-gpt-4o\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` provider`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` = `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"openai\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # When the client requests \"gpt-4o\", ONR proxies to real \"gpt-4o\"`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` req_map`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` model`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` = `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"gpt-4o\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` balance`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` strategy`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` = `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"priority\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # 1. First, try OpenAI`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` target`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` provider`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` = `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"openai\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` credential`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` = `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"sk-openai...\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # 2. If OpenAI completely fails, failover to Anthropic`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` target`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` provider`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` = `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"anthropic\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` credential`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` = `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"sk-ant...\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # We override the model inside the target block specifically for Anthropic`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` req_map`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` model`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` = `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"claude-3-5-sonnet-20241022\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`retry-and-error-configurations`,children:`Retry and Error Configurations`}),`\n`,_jsxs(_components.p,{children:[`You can further control exactly `,_jsx(_components.em,{children:`how many times`}),` ONR should retry, and `,_jsx(_components.em,{children:`which HTTP status codes`}),` count as failures invoking the fallback.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`12`,language:`nginx`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`nginx`,children:_jsxs(_components.code,{language:`nginx`,numberOfLines:`12`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`balance`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` strategy`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` = `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"priority\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` retry`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` = 3`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # Status codes that trigger the failover (default usually includes 429 and 50x)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` retry_status_codes`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` = [429, 500, 502, 503, 504]`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` credentials`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` = [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` \"sk-primary...\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` \"sk-backup...\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`When tracing fallback journeys in the TUI (`,_jsx(_components.code,{children:`onr-admin tui`}),`) or access logs, you will notice ONR records exactly which targets were attempted and failed before finally returning a successful stream to the client.`]})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Load Balancing \u0026 Fallbacks","description":"How to configure resilient clusters of LLM providers.","href":"/guides/load-balancing"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"The balance Block","slug":"the-balance-block","depth":2,"children":[{"title":"Priority Failover (Active-Passive)","slug":"priority-failover-active-passive","depth":3,"children":[]},{"title":"Round Robin (Active-Active)","slug":"round-robin-active-active","depth":3,"children":[]}]},{"title":"Cross-Provider Fallbacks","slug":"cross-provider-fallbacks","depth":2,"children":[]},{"title":"Retry and Error Configurations","slug":"retry-and-error-configurations","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"onr","siteName":"Open Next Router","title":"Load Balancing \u0026 Fallbacks - Open Next Router","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-02-27T04:07:23.342Z","originalFileLocation":"guides/load-balancing.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"How to configure resilient clusters of LLM providers.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Open Next Router\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/onr/CeTW9W2B1vDDPTKQ/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/onr/CeTW9W2B1vDDPTKQ/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/onr/CeTW9W2B1vDDPTKQ/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/onr/CeTW9W2B1vDDPTKQ/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/onr/CeTW9W2B1vDDPTKQ/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/onr/CeTW9W2B1vDDPTKQ/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/onr/CeTW9W2B1vDDPTKQ/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/onr/CeTW9W2B1vDDPTKQ/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/onr/CeTW9W2B1vDDPTKQ/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Load Balancing \u0026amp; Fallbacks - Open Next Router\">\u003cmeta data-mint-head property=\"og:description\" content=\"How to configure resilient clusters of LLM providers.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Open Next Router\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://onr.mintlify.app/guides/load-balancing\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://onr.mintlify.site/_mintlify/api/og/v2?division=Guides+%26+Cookbooks\u0026amp;title=Load+Balancing+%26+Fallbacks\u0026amp;description=How+to+configure+resilient+clusters+of+LLM+providers.\u0026amp;theme=ccef3d9a380b30756f0f5b4b\u0026amp;signature=13b9c98410948c3d27e7598b7a5d6109ed354f45c8c406ac8e628fd262f2ffd4\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Load Balancing \u0026amp; Fallbacks - Open Next Router\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"How to configure resilient clusters of LLM providers.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://onr.mintlify.site/_mintlify/api/og/v2?division=Guides+%26+Cookbooks\u0026amp;title=Load+Balancing+%26+Fallbacks\u0026amp;description=How+to+configure+resilient+clusters+of+LLM+providers.\u0026amp;theme=ccef3d9a380b30756f0f5b4b\u0026amp;signature=13b9c98410948c3d27e7598b7a5d6109ed354f45c8c406ac8e628fd262f2ffd4\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/onr/CeTW9W2B1vDDPTKQ/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Open Next Router\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#0B5FFF\">\u003clink data-mint-head rel=\"canonical\" href=\"https://onr.mintlify.app/guides/load-balancing\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/guides/load-balancing.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://onr.mintlify.app/#organization\",\"name\":\"Open Next Router\",\"url\":\"https://onr.mintlify.app\"},{\"@type\":\"WebSite\",\"@id\":\"https://onr.mintlify.app#website\",\"name\":\"Open Next Router\",\"url\":\"https://onr.mintlify.app\",\"publisher\":{\"@id\":\"https://onr.mintlify.app/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://onr.mintlify.app/guides/load-balancing#webpage\",\"url\":\"https://onr.mintlify.app/guides/load-balancing\",\"name\":\"Load Balancing \u0026 Fallbacks\",\"description\":\"How to configure resilient clusters of LLM providers.\",\"dateModified\":\"2026-02-27T04:07:23.342Z\",\"isPartOf\":{\"@id\":\"https://onr.mintlify.app#website\"},\"breadcrumb\":{\"@id\":\"https://onr.mintlify.app/guides/load-balancing#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://onr.mintlify.app/guides/load-balancing#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Open Next Router\",\"item\":\"https://onr.mintlify.app\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Load Balancing \u0026 Fallbacks\",\"item\":\"https://onr.mintlify.app/guides/load-balancing\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://onr.mintlify.app/guides/load-balancing#article\",\"headline\":\"Load Balancing \u0026 Fallbacks\",\"name\":\"Load Balancing \u0026 Fallbacks\",\"description\":\"How to configure resilient clusters of LLM providers.\",\"url\":\"https://onr.mintlify.app/guides/load-balancing\",\"mainEntityOfPage\":{\"@id\":\"https://onr.mintlify.app/guides/load-balancing#webpage\"},\"dateModified\":\"2026-02-27T04:07:23.342Z\",\"publisher\":{\"@id\":\"https://onr.mintlify.app/#organization\"},\"isPartOf\":{\"@id\":\"https://onr.mintlify.app#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Open Next Router\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Open Next Router\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/guides/load-balancing.md","siteName":"Open Next Router","nav":{"global":null,"tabs":[{"tab":"Documentation","groups":[{"group":"Start","icon":"rocket","expanded":true,"pages":[{"title":"Open Next Router","href":""},{"title":"Quickstart","href":"/getting-started/quickstart"},{"title":"Installation","href":"/getting-started/install"},{"title":"Run From Source","href":"/getting-started/run-from-source"}]},{"group":"Updates","icon":"rss","expanded":false,"pages":[{"title":"Changelog","description":"Product and documentation updates for Open Next Router.","href":"/changelog"}]},{"group":"Guides \u0026 Cookbooks","icon":"book-open-reader","expanded":false,"pages":[{"title":"Load Balancing \u0026 Fallbacks","href":"/guides/load-balancing"},{"title":"Authentication Setup","description":"Securely route traffic and exchange tokens across various upstream providers.","href":"/guides/auth-setup"},{"title":"Request/Response Rewriting","href":"/guides/request-response-rewriting"},{"title":"Logging and Masking","href":"/guides/logging-masking"},{"title":"Client Attribution","href":"/guides/client-attribution"},{"title":"Meterry Billing Integration","href":"/guides/meterry-billing"},{"title":"Distributed Deployment with Redis","href":"/guides/distributed-deployment"}]},{"group":"Ecosystem \u0026 Tools","icon":"toolbox","expanded":false,"pages":[{"title":"ONR Admin \u0026 CLI Tools","href":"/ecosystem/admin-panel"},{"title":"ONR Language Server (LSP)","href":"/ecosystem/onr-lsp"},{"title":"Observability Stack","href":"/ecosystem/observability"}]},{"group":"Configuration","icon":"sliders","expanded":false,"pages":[{"title":"onr.yaml","href":"/configuration/onr-yaml"},{"title":"keys.yaml","href":"/configuration/keys-yaml"},{"title":"models.yaml","href":"/configuration/models-yaml"},{"title":"Reload","href":"/configuration/reload"}]},{"group":"API","icon":"plug","expanded":false,"pages":[{"title":"API Overview","href":"/api/overview"},{"title":"Token Key (onr:v1?)","href":"/api/token-key"},{"title":"OpenAI-Compatible Endpoints","href":"/api/openai-compatible"},{"title":"Gemini Native API (v1beta)","href":"/api/gemini-native"}]},{"group":"DSL","icon":"code","expanded":false,"pages":[{"title":"DSL Overview","href":"/dsl/overview"},{"title":"Conventions","href":"/dsl/conventions"},{"title":"Include Directive","href":"/dsl/include"},{"title":"Top-Level Structure","href":"/dsl/top-level"},{"title":"Match Rules","href":"/dsl/match"},{"title":"Expressions \u0026 Variables","href":"/dsl/expressions"},{"group":"Blocks","icon":"layer-group","expanded":false,"pages":[{"group":"Core Flow","icon":"route","expanded":false,"pages":[{"title":"Upstream Config Block","href":"/dsl/blocks/upstream-config"},{"title":"Auth Block","href":"/dsl/blocks/auth"},{"title":"Request Block","href":"/dsl/blocks/request"},{"title":"Upstream Block","href":"/dsl/blocks/upstream"},{"title":"Response Block","href":"/dsl/blocks/response"},{"title":"Error Block","href":"/dsl/blocks/error"}]},{"group":"Data \u0026 Metadata","icon":"chart-line","expanded":false,"pages":[{"title":"Metrics Block","href":"/dsl/blocks/metrics"},{"title":"Models Block","href":"/dsl/blocks/models"},{"title":"Balance Block","href":"/dsl/blocks/balance"}]}]}]},{"group":"Concepts \u0026 Design","icon":"lightbulb","expanded":false,"pages":[{"title":"Why ONR","href":"/concepts/why-onr"},{"title":"Architecture","href":"/concepts/architecture"},{"title":"Request Lifecycle","href":"/concepts/request-lifecycle"},{"title":"Observability","href":"/concepts/observability"},{"title":"Dashboards","href":"/concepts/dashboards"}]},{"group":"Reference","icon":"book-open","expanded":false,"pages":[{"title":"CLI Reference","href":"/reference/cli"},{"title":"Access Log Fields","href":"/reference/access-log-fields"}]},{"group":"Community \u0026 Contributing","icon":"users","expanded":false,"pages":[{"title":"Development Guide","href":"/contributing/development-guide"},{"title":"Testing Guide","href":"/contributing/testing-guide"},{"title":"Release Process","href":"/contributing/release-process"},{"title":"Writing Providers","href":"/contributing/writing-providers"}]}]}]},"basePath":"","title":"Load Balancing \u0026 Fallbacks - Open Next Router","deploymentId":"dpl_BLZw3QngerHodH9E8mGgC4v752y3","buildId":"dpl_BLZw3QngerHodH9E8mGgC4v752y3","dynamics":[],"chunks":[]}