[{"data":1,"prerenderedAt":775},["ShallowReactive",2],{"navigation_docs":3,"-gateway-smart-routing":160,"-gateway-smart-routing-surround":770},[4,21,62,82,103,149],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":20},"Get Started","i-lucide-rocket","\u002Fgetting-started","1.getting-started",[10,15],{"title":11,"path":12,"stem":13,"icon":14},"Introduction","\u002Fgetting-started\u002Fintroduction","1.getting-started\u002F1.introduction","i-lucide-info",{"title":16,"path":17,"stem":18,"icon":19},"Quickstart","\u002Fgetting-started\u002Fquickstart","1.getting-started\u002F2.quickstart","i-lucide-play-circle",false,{"title":22,"icon":23,"path":24,"stem":25,"children":26,"page":20},"Gateway","i-lucide-network","\u002Fgateway","2.gateway",[27,32,37,42,47,52,57],{"title":28,"path":29,"stem":30,"icon":31},"Overview","\u002Fgateway\u002Foverview","2.gateway\u002F1.overview","i-lucide-waypoints",{"title":33,"path":34,"stem":35,"icon":36},"Models and Routing","\u002Fgateway\u002Fmodels-and-routing","2.gateway\u002F2.models-and-routing","i-lucide-brain",{"title":38,"path":39,"stem":40,"icon":41},"Smart Router","\u002Fgateway\u002Fsmart-routing","2.gateway\u002F3.smart-routing","i-lucide-route",{"title":43,"path":44,"stem":45,"icon":46},"Context Engine","\u002Fgateway\u002Fcontext-engine","2.gateway\u002F4.context-engine","i-product-context-engine",{"title":48,"path":49,"stem":50,"icon":51},"Data Integrations","\u002Fgateway\u002Fdata-integrations","2.gateway\u002F5.data-integrations","i-lucide-database",{"title":53,"path":54,"stem":55,"icon":56},"Tools","\u002Fgateway\u002Ftools","2.gateway\u002F6.tools","i-lucide-wrench",{"title":58,"path":59,"stem":60,"icon":61},"Guardrails","\u002Fgateway\u002Fguardrails","2.gateway\u002F7.guardrails","i-lucide-shield-alert",{"title":63,"icon":64,"path":65,"stem":66,"children":67,"page":20},"Compliance","i-lucide-shield-check","\u002Fcompliance","3.compliance",[68,72,77],{"title":69,"path":70,"stem":71,"icon":64},"Data Governance","\u002Fcompliance\u002Fdata-governance","3.compliance\u002F01.data-governance",{"title":73,"path":74,"stem":75,"icon":76},"Network Access","\u002Fcompliance\u002Fnetwork-access","3.compliance\u002F02.network-access","i-lucide-lock",{"title":78,"path":79,"stem":80,"icon":81},"Audit Logs","\u002Fcompliance\u002Faudit-logs","3.compliance\u002F03.audit-logs","i-lucide-scroll-text",{"title":83,"icon":84,"path":85,"stem":86,"children":87,"page":20},"Observability","i-lucide-eye","\u002Fobservability","4.observability",[88,93,98],{"title":89,"path":90,"stem":91,"icon":92},"Organization","\u002Fobservability\u002Forganization","4.observability\u002F1.organization","i-lucide-building-2",{"title":94,"path":95,"stem":96,"icon":97},"Application","\u002Fobservability\u002Fapplication","4.observability\u002F2.application","i-lucide-activity",{"title":99,"path":100,"stem":101,"icon":102},"Metrics","\u002Fobservability\u002Fmetrics","4.observability\u002F3.metrics","i-lucide-bar-chart-2",{"title":104,"icon":105,"path":106,"stem":107,"children":108,"page":20},"Administration","i-lucide-settings","\u002Fadministration","5.administration",[109,114,119,129,144],{"title":110,"path":111,"stem":112,"icon":113},"Organization and Projects","\u002Fadministration\u002Forganizations-and-projects","5.administration\u002F1.organizations-and-projects","i-lucide-box",{"title":115,"path":116,"stem":117,"icon":118},"Members and Access","\u002Fadministration\u002Fmembers-and-access","5.administration\u002F2.members-and-access","i-lucide-shield-user",{"title":120,"path":121,"stem":122,"children":123,"icon":76},"Authentication","\u002Fadministration\u002Fauthentication","5.administration\u002F3.authentication",[124],{"title":125,"path":126,"stem":127,"icon":128},"Connect Model APIs","\u002Fadministration\u002Fauthentication\u002Fconnect-model-apis","5.administration\u002F3.authentication\u002F31.connect-model-apis","i-lucide-cpu",{"title":130,"path":131,"stem":132,"children":133,"icon":143},"Connections","\u002Fadministration\u002Fconnections","5.administration\u002F4.connections",[134,139],{"title":135,"path":136,"stem":137,"icon":138},"Connect MCP Servers","\u002Fadministration\u002Fconnections\u002Fmcp-connections","5.administration\u002F4.connections\u002F42.mcp-connections","i-lucide-plug",{"title":140,"path":141,"stem":142,"icon":51},"Connect Data Sources","\u002Fadministration\u002Fconnections\u002Fdata-sources-connections","5.administration\u002F4.connections\u002F43.data-sources-connections","i-lucide-link",{"title":145,"path":146,"stem":147,"icon":148},"Budgets","\u002Fadministration\u002Fbudgets","5.administration\u002F5.budgets","i-lucide-wallet",{"title":150,"icon":151,"path":152,"stem":153,"children":154,"page":20},"Reference","i-lucide-book-open","\u002Freference","6.reference",[155],{"title":156,"path":157,"stem":158,"icon":159},"Using the API","\u002Freference\u002Fapi-usage","6.reference\u002F1.api-usage","i-lucide-terminal-square",{"id":161,"title":38,"body":162,"description":763,"extension":764,"links":765,"meta":766,"navigation":767,"path":39,"seo":768,"stem":40,"__hash__":769},"docs\u002F2.gateway\u002F3.smart-routing.md",{"type":163,"value":164,"toc":751},"minimark",[165,169,175,180,183,221,228,232,242,359,362,369,375,385,390,396,446,449,453,456,482,499,503,506,538,541,544,581,584,607,622,626,681,694,698,720,726,730,747],[166,167,168],"p",{},"Smart Router chooses a model for each request from the models your application can use. Simple requests go to less expensive models, and harder ones go to more capable models, so you pay for a large model only when a request needs it.",[170,171,174],"who-panel",{":applies-to":172,":roles":173},"[\"LLM requests\"]","[\"Organization Admin\", \"Workspace Admin\", \"Project Admin\", \"App Admin\"]","Admins of an application turn on Smart Router and choose its strategy. The Organization Admin decides which models are available to it, through the organization's model catalog.",[176,177,179],"h2",{"id":178},"why-use-it","Why use it",[166,181,182],{},"Most applications send one model a mix of requests. Many of them don't need the most capable model. Smart Router makes that choice for each request, so the application doesn't have to.",[184,185,186,200,211],"ul",{},[187,188,189,193,194,199],"li",{},[190,191,192],"strong",{},"Lower model costs."," In our evaluations of single-request workloads, Smart Router kept accuracy close to that of the strongest model in its pool at about 30% lower cost. See ",[195,196,198],"a",{"href":197},"#benchmarks","Benchmarks",".",[187,201,202,205,206,210],{},[190,203,204],{},"No routing logic in your code."," Send ",[207,208,209],"code",{},"optiak\u002Fsmart"," as the model. To change how Smart Router decides, change the strategy in the console, not the code.",[187,212,213,216,217,220],{},[190,214,215],{},"The same controls as any request."," Smart Router chooses only from models that the organization and the application allow, and that meet your ",[195,218,219],{"href":70},"data governance"," rules.",[166,222,223,224,227],{},"Smart Router fits best in single-request use: chat, question answering, classification, extraction and summarization. For multi-step agents, results depend on the task and on the models in the pool, so ",[195,225,226],{"href":197},"benchmark it on your own workload"," before you use it in production. For agents with heavy tool use, or for tasks that need the most capable model on every step, call that model directly.",[176,229,231],{"id":230},"how-it-works","How it works",[166,233,234,235,237,238,241],{},"To use Smart Router, send ",[207,236,209],{}," as the model. The short form ",[207,239,240],{},"smart"," also works.",[243,244,249],"pre",{"className":245,"code":246,"language":247,"meta":248,"style":248},"language-json shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","{\n  \"model\": \"optiak\u002Fsmart\",\n  \"messages\": [\n    { \"role\": \"user\", \"content\": \"Summarize this ticket in two sentences.\" }\n  ]\n}\n","json","",[207,250,251,260,287,302,347,353],{"__ignoreMap":248},[252,253,256],"span",{"class":254,"line":255},"line",1,[252,257,259],{"class":258},"sMK4o","{\n",[252,261,263,266,270,273,276,279,282,284],{"class":254,"line":262},2,[252,264,265],{"class":258},"  \"",[252,267,269],{"class":268},"spNyl","model",[252,271,272],{"class":258},"\"",[252,274,275],{"class":258},":",[252,277,278],{"class":258}," \"",[252,280,209],{"class":281},"sfazB",[252,283,272],{"class":258},[252,285,286],{"class":258},",\n",[252,288,290,292,295,297,299],{"class":254,"line":289},3,[252,291,265],{"class":258},[252,293,294],{"class":268},"messages",[252,296,272],{"class":258},[252,298,275],{"class":258},[252,300,301],{"class":258}," [\n",[252,303,305,308,310,314,316,318,320,323,325,328,330,333,335,337,339,342,344],{"class":254,"line":304},4,[252,306,307],{"class":258},"    {",[252,309,278],{"class":258},[252,311,313],{"class":312},"sBMFI","role",[252,315,272],{"class":258},[252,317,275],{"class":258},[252,319,278],{"class":258},[252,321,322],{"class":281},"user",[252,324,272],{"class":258},[252,326,327],{"class":258},",",[252,329,278],{"class":258},[252,331,332],{"class":312},"content",[252,334,272],{"class":258},[252,336,275],{"class":258},[252,338,278],{"class":258},[252,340,341],{"class":281},"Summarize this ticket in two sentences.",[252,343,272],{"class":258},[252,345,346],{"class":258}," }\n",[252,348,350],{"class":254,"line":349},5,[252,351,352],{"class":258},"  ]\n",[252,354,356],{"class":254,"line":355},6,[252,357,358],{"class":258},"}\n",[166,360,361],{},"For each request, Smart Router reads the conversation, predicts which eligible model gives a good answer for the request, and selects one based on the application's strategy. The Gateway then sends the request to that model, like any other request. The application's data governance rules, guardrails, inference defaults and fallback models apply as usual. The response has the same shape as the response of a direct model request.",[166,363,364,365,368],{},"Each request is routed on its own, so turns of the same conversation can go to different models. The application's ",[190,366,367],{},"Requests"," tab shows a Smart routing step in each request's trace.",[166,370,371,372,374],{},"You can use Smart Router and direct model IDs in the same application. The ",[207,373,269],{}," field of each request decides which one is used.",[166,376,377,378,380,381,384],{},"A request that sends ",[207,379,209],{}," is rejected with a ",[207,382,383],{},"400"," error when Smart Router is off for the application, or when your organization's plan doesn't include it.",[386,387,389],"h3",{"id":388},"strategies","Strategies",[166,391,392,393,395],{},"The strategy sets the trade-off between cost and quality for the application's ",[207,394,209],{}," requests.",[397,398,399,415],"table",{},[400,401,402],"thead",{},[403,404,405,409,412],"tr",{},[406,407,408],"th",{},"Strategy",[406,410,411],{},"Behavior",[406,413,414],{},"Use it for",[416,417,418,433],"tbody",{},[403,419,420,427,430],{},[421,422,423,426],"td",{},[190,424,425],{},"Balanced"," (default)",[421,428,429],{},"Balances cost and quality.",[421,431,432],{},"Most workloads. Start here.",[403,434,435,440,443],{},[421,436,437],{},[190,438,439],{},"Cost",[421,441,442],{},"Prefers less expensive models, accepting a small loss of quality on some requests.",[421,444,445],{},"High-volume or simple workloads where cost matters most.",[166,447,448],{},"Requests with images or files don't use the strategy. Smart Router ranks the eligible models by quality benchmarks for that kind of input and picks the highest-ranked one. The same happens if the routing service is unavailable: the request goes to the strongest eligible model.",[386,450,452],{"id":451},"eligible-models","Eligible models",[166,454,455],{},"Smart Router chooses only from models that meet all of these conditions:",[184,457,458,468,473,479],{},[187,459,460,461,464,465,467],{},"The model has the ",[190,462,463],{},"Smart routing"," badge in the model catalog. Use the ",[190,466,463],{}," filter to list these models.",[187,469,470,471,199],{},"The model is enabled for the organization and the application. See ",[195,472,33],{"href":34},[187,474,475,476,478],{},"The model meets your organization's ",[195,477,219],{"href":70}," rules, such as data residency and no-training.",[187,480,481],{},"The model supports what the request uses, such as tool calls, structured output, reasoning or image input.",[166,483,484,485,488,489,492,493,495,496,498],{},"To see the candidates for an application, open the application, then ",[190,486,487],{},"Configuration",", then ",[190,490,491],{},"Savings",". The ",[190,494,452],{}," list on the ",[190,497,38],{}," tab shows the models with the badge that the application has enabled. For each request, Smart Router can exclude more of them: models that break your data governance rules, and models that don't support what the request uses.",[386,500,502],{"id":501},"how-to-choose-the-model-pool","How to choose the model pool",[166,504,505],{},"The eligible models are Smart Router's pool. Two or three models usually work best: one large model for hard requests and one or two much less expensive ones for simple requests.",[184,507,508,514,520,526],{},[187,509,510,513],{},[190,511,512],{},"Mix model sizes."," Smart Router saves cost by sending simple requests to a smaller model. A pool of similar models leaves little to choose between.",[187,515,516,519],{},[190,517,518],{},"Keep the pool small."," Each turn is routed on its own, so the more models in the pool, the more often a conversation can switch between them. Each switch loses the provider's prompt cache from earlier turns, which adds cost and latency to long conversations. With two or three models, consecutive turns switch less often and reuse the cache more.",[187,521,522,525],{},[190,523,524],{},"Use the latest version of each model."," When a model family releases a new version, enable it and disable the older one. Two versions of the same model are similar models: they take up room in the pool and add switches without giving Smart Router a real choice.",[187,527,528,531,532,534,535,537],{},[190,529,530],{},"Check what else the application enables."," Any model with the ",[190,533,463],{}," badge that the application enables joins the pool, even if you enabled it for direct calls. Review the ",[190,536,452],{}," list after you change the application's models.",[176,539,198],{"id":540},"benchmarks",[166,542,543],{},"Smart Router is trained and evaluated on models of different sizes from several providers. We benchmarked it against sending every request to a single model, on single requests, such as questions with known answers, and on multi-step agents that use tools.",[397,545,546,557],{},[400,547,548],{},[403,549,550,553,555],{},[406,551,552],{},"Workload",[406,554,425],{},[406,556,439],{},[416,558,559,570],{},[403,560,561,564,567],{},[421,562,563],{},"Single requests",[421,565,566],{},"Accuracy close to the strongest model, at a lower cost",[421,568,569],{},"Larger savings, with a small loss of accuracy on some workloads",[403,571,572,575,578],{},[421,573,574],{},"Multi-step agents",[421,576,577],{},"Can match a single large model, depending on the task",[421,579,580],{},"Lower cost, especially when routing between a large model and a much less expensive one",[166,582,583],{},"What this means for your application:",[184,585,586,592,601],{},[187,587,588,591],{},[190,589,590],{},"Use it for single requests."," For chat, question answering, classification or extraction, you can expect accuracy close to your strongest model at about 30% lower cost.",[187,593,594,597,598,199],{},[190,595,596],{},"For agents, enable one large model and one small one."," A large model paired with a much less expensive one keeps most of the large model's results at a lower cost. See ",[195,599,502],{"href":600},"#how-to-choose-the-model-pool",[187,602,603,606],{},[190,604,605],{},"Compare with your least expensive model."," For some workloads, it's nearly as accurate as routing, at a fraction of the cost.",[608,609,612,615,616,618,619,621],"callout",{"color":610,"icon":611},"warning","i-lucide-triangle-alert",[190,613,614],{},"Benchmark Smart Router on your own workload first."," Results depend on your requests and on the models you enable, so ours may not carry over. Before you route production traffic, run a representative sample of your requests with ",[207,617,209],{}," and with the model you use today. Compare quality and cost per request in ",[195,620,83],{"href":95},". This matters most for agents.",[176,623,625],{"id":624},"set-it-up","Set it up",[627,628,629,640,672],"ol",{},[187,630,631,634,635,637,638,199],{},[190,632,633],{},"Make eligible models available."," An Organization Admin enables models with the ",[190,636,463],{}," badge in the organization's model catalog. See ",[195,639,33],{"href":34},[187,641,642,645,646,488,648,650,651,653,654,657,658,661,662,664,665,668,669,671],{},[190,643,644],{},"Turn on Smart Router for the application."," It's off by default. In the console, open the application, then ",[190,647,487],{},[190,649,491],{},". On the ",[190,652,38],{}," tab, turn on ",[190,655,656],{},"Enable smart routing"," and choose an ",[190,659,660],{},"Optimization strategy",". Check the ",[190,663,452],{}," list. If it shows a ",[190,666,667],{},"No eligible models"," warning, enable at least one model with the badge for the application; until then, ",[207,670,209],{}," requests fail unless the application has fallback models.",[187,673,674,680],{},[190,675,676,677,679],{},"Send ",[207,678,209],{}," as the model"," in the requests you want to route.",[608,682,684,687,688,690,691,693],{"color":683,"icon":14},"info",[190,685,686],{},"Turning on Smart Router doesn't route your existing requests."," Smart Router routes only the requests that send ",[207,689,209],{}," as the model. Requests that name a model keep going to that model. To route traffic, change the ",[207,692,269],{}," value in your code.",[176,695,697],{"id":696},"limits-and-behavior","Limits and behavior",[184,699,700,706,712],{},[187,701,702,705],{},[190,703,704],{},"Custom provider models"," are not eligible. Call them by their model ID.",[187,707,708,711],{},[190,709,710],{},"Provider-specific request content"," can't be routed between providers: provider-specific tools, encrypted reasoning, and conversation state stored at a provider. Send these requests to a specific model.",[187,713,714,717,718,199],{},[190,715,716],{},"Prompt caching:"," when consecutive turns go to different models, the provider's prompt cache from earlier turns isn't reused. This can reduce savings for long conversations. A small pool limits how often this happens; see ",[195,719,502],{"href":600},[166,721,722,723,199],{},"For error details, see ",[195,724,156],{"href":725},"\u002Freference\u002Fapi-usage#common-errors",[176,727,729],{"id":728},"related","Related",[184,731,732,737,742],{},[187,733,734,736],{},[195,735,33],{"href":34},": enable models and set fallback models.",[187,738,739,741],{},[195,740,69],{"href":70},": the rules that limit which models can be used.",[187,743,744,746],{},[195,745,94],{"href":95},": see which models handle your requests and what they cost.",[748,749,750],"style",{},"html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":248,"searchDepth":262,"depth":262,"links":752},[753,754,759,760,761,762],{"id":178,"depth":262,"text":179},{"id":230,"depth":262,"text":231,"children":755},[756,757,758],{"id":388,"depth":289,"text":389},{"id":451,"depth":289,"text":452},{"id":501,"depth":289,"text":502},{"id":540,"depth":262,"text":198},{"id":624,"depth":262,"text":625},{"id":696,"depth":262,"text":697},{"id":728,"depth":262,"text":729},"Let Optiak choose the model for each request to lower model costs while keeping quality.","md",null,{},{"icon":41},{"title":38,"description":763},"ql-4Sxakbe1NM3UQQlLTma9rpUIR09o_aiC8E6LwS9I",[771,773],{"title":33,"path":34,"stem":35,"description":772,"icon":36,"children":-1},"Choose which models your applications can call and how requests reach them.",{"title":43,"path":44,"stem":45,"description":774,"icon":46,"children":-1},"Reduce the input tokens each request sends to the model, and measure the effect before you apply it.",1795006122038]