NeMo Switchyard क्या है?
NeMo Switchyard हर LLM कॉल को वही सबसे सस्ता मॉडल भेजता है जो काम अब भी कर सके, बिना आपका agent बदले. यह Evaluation & Production Ops टूल्स की Gateways & Routing श्रेणी में आता है; ओपन सोर्स है, Python में लिखा गया है और Apache-2.0 लाइसेंस के तहत है।
सारांश
Switchyard, NVIDIA का LLM ट्रैफ़िक के लिए रूटिंग कॉम्पोनेंट है: यह तय करता है कि हर अलग कॉल को कौन-सा मॉडल सर्व करे, न कि एप्लिकेशन को किसी एक मॉडल से बांधे। यह NVIDIA-NeMo organisation के अंतर्गत Apache-2.0 project के रूप में आता है, जिसमें कई algorithms हैं — staged router, escalation router और classifier-based routers — और यह native OpenAI और Anthropic API compatibility बनाए रखता है, ताकि कॉल करने वाले एप्लिकेशन को बदलना न पड़े।
इसे अपनाने के तीन तरीके हैं, और repository इन्हें स्वतंत्र रास्तों के रूप में पेश करती है। इसे पहले से चल रहे gateway के भीतर चलाया जा सकता है: NeMo Relay के लिए एक native plugin routes.toml deployment लोड करता है, और LiteLLM के Router और proxy के लिए एक routing plugin मौजूद है। इसे library के रूप में embed किया जा सकता है (pip install nemo-switchyard, या Rust के लिए switchyard-libsy), ऐसे में Switchyard मॉडल चुनता है और आपका harness हर call खुद करता है, जिससे आपके transport, retries और credentials अछूते रहते हैं। या इसे किसी agent के आगे standalone OpenAI- और Anthropic-compatible proxy के रूप में चलाया जा सकता है। Claude Code, Codex CLI या किसी भी SDK client को इसी की ओर पॉइंट करें, और Switchyard हर turn पर तय करता है कि request को कौन-सा मॉडल सर्व करेगा।
यह प्रोजेक्ट स्पष्ट रूप से 1.0 से पहले का है और अपने घटकों की स्थिरता की रेटिंग खुद देता है: switchyard-libsy beta है, switchyard-llm-client और switchyard-runner alpha हैं, और switchyard-server को demo लेबल दिया गया है, जो केवल मूल्यांकन के लिए है, production के लिए नहीं। APIs, configuration और routing व्यवहार रिलीज़ के बीच बदल सकते हैं, इसलिए जिस version को आप integrate करें उसे पिन कर लें। README यह भी बताता है कि repository की मौजूदा library API, PyPI पर प्रकाशित nemo-switchyard 0.2.0 से आगे है, और अगली रिलीज़ तक repository से install करने को कहता है।
यह क्या करता है
- कई models और providers के बीच हर call पर मॉडल का चुनाव, और native OpenAI व Anthropic API compatibility बनी रहती है
- कई routing algorithms — staged, escalation और classifier-based — जिन्हें version-1 routes.toml से कॉन्फ़िगर किया जाता है
- तीन integration रास्ते: NeMo Relay plugin, LiteLLM Router/proxy plugin, या embedded library
- Embedded mode, जिसमें Switchyard केवल मॉडल चुनता है और transport, retries व credentials पर नियंत्रण आपके harness के पास रहता है
- एक ही codebase से Python और Rust libraries (nemo-switchyard / switchyard-libsy)
- Claude Code या Codex CLI जैसे clients के लिए standalone OpenAI- और Anthropic-compatible proxy
- हर component की प्रकाशित stability रेटिंग, ताकि पता रहे कि कौन-से हिस्से केवल demo हैं
शुरू करें
वह रास्ता चुनें जो बताता है कि routing कहां रहनी चाहिए। ध्यान दें कि repository की library API, PyPI पर मौजूद 0.2.0 रिलीज़ से नई है, इसलिए Step/LlmResponse API के लिए फ़िलहाल source से build करना ही documented रास्ता है; इसके लिए Rust toolchain ज़रूरी है।
Source से library install करें
प्रकाशित nemo-switchyard 0.2.0 wheel एक पुराना LlmTarget-आधारित interface देता है; इसलिए README अगली रिलीज़ तक repository से install करने को कहता है।
pip install git+https://github.com/NVIDIA-NeMo/Switchyard.gitअपने harness में कोई algorithm बनाएं
टार्गेट के नाम वही होते हैं जो आपका harness अपने models को कहता है। Stage router वही है जो repository के benchmark में इस्तेमाल हुआ है; random, llm_task_classifier और llm_classifier भी इसी तरह बनते हैं।
from switchyard.libsy import LlmResponse, Step
from switchyard.libsy.algorithms import stage_routerया इसे standalone proxy के रूप में चलाएं
केवल demo/evaluation के लिए रेटेड। किसी भी OpenAI- या Anthropic-compatible client को proxy की ओर पॉइंट करें, और Switchyard हर turn पर तय करता है कि उसे कौन-सा मॉडल सर्व करे।
cargo install --locked switchyard-server
switchyard-server --config routes.toml --port 4000या NeMo Relay में plugin लोड करें
Plugin build और register करें, deployment को /etc/switchyard/routes.toml पर लिखें, plugin को उसी की ओर पॉइंट करें, फिर enable और validate करें। इसके लिए NeMo Relay >=0.8.1,<0.9.0 और एक Rust toolchain ज़रूरी है।
nemo-relay plugins enable nvidia.switchyard
nemo-relay plugins validate nvidia.switchyardया LiteLLM से इस्तेमाल करें
LiteLLM के Router और proxy के लिए एक routing plugin repository की examples directory में मौजूद है।
examples/litellm/README.mdकमांड और कोड प्रोजेक्ट के अपने दस्तावेज़ों से लिए गए हैं — हमेशा जांचें आधिकारिक repo ताज़ा जानकारी के लिए।
कब इस्तेमाल करें
- ऐसा agent जो हर step को frontier model भेजता है, भले ही ज़्यादातर steps को उसकी ज़रूरत न हो, उसके inference खर्च में कटौती करें
- एप्लिकेशन code बदले बिना मौजूदा NeMo Relay या LiteLLM deployment में हर call के लिए routing जोड़ें
- असली HTTP calls पर नियंत्रण रखते हुए अपने gateway या harness में मॉडल चयन embed करें
- किसी model mix पर फ़ैसला करने से पहले अलग-अलग routing policies के लिए cost बनाम accuracy का benchmark करें
How NeMo Switchyard compares
NeMo Switchyard alongside other open-source gateways & routing tools AI/TLDR tracks, ranked by GitHub stars.
| टूल | स्टार | यह क्या करता है |
|---|---|---|
| OmniRoute | ★ 91.8k | सैकड़ों प्रोवाइडर को एक OpenAI-compatible endpoint के पीछे लाने वाला लोकल-फ़र्स्ट AI gateway |
| Free Claude Code | ★ 75.9k | Claude Code और नौ अन्य एजेंट CLI को मुफ़्त, पेड या लोकल मॉडल प्रोवाइडर से जोड़ें |
| LiteLLM | ★ 64.4k | एक OpenAI-compatible API के ज़रिए 100+ LLM प्रोवाइडर को कॉल करें |
| magpie | ★ 44.8k | एक लोकल गेटवे और मेन्यू बार ऐप, जो हर coding agent के लिए कोई भी मॉडल चुनने देता है |
| Kong Gateway | ★ 44.4k | API गेटवे जो आपके LLM और MCP ट्रैफ़िक को भी संभालता है |
| 9Router | ★ 33.1k | कोडिंग CLI के लिए लोकल राउटर, जिसमें quota ट्रैकिंग, tiered fallback और token compression शामिल है |
| Experiential | ★ 20.6k | होस्टेड, BYOK, लोकल और कस्टम मॉडल्स के लिए एक OpenAI-compatible control plane |
| NeMo Switchyard | ★ 3.8k | हर LLM कॉल को वही सबसे सस्ता मॉडल भेजता है जो काम अब भी कर सके, बिना आपका agent बदले |
