Model routing in gpt-5-codex: <https://x.com/swyx/...
# proj-agent
l
Model routing in gpt-5-codex: https://x.com/swyx/status/1967651870018838765 @full-greece-2387 do we have instructions about how to use model routing in OpenHands yet?
👀 1
f
Yep, we have some instructions here: https://github.com/All-Hands-AI/OpenHands/tree/main/openhands/llm/router -- right now we only have a rule-based router, but it's easy to extend with different router implementations
👍 1
b
@full-greece-2387 is there any auto-discovery or ability to add by just config.toml - right now ROUTER_LLM_REGISTRY entries require router class to be imported and that requires explicit import in /app/services/oh/openhands/llm/router/__init__.py
f
Could you elaborate what you're trying to achieve? Is that to add a new router implementation and configure it via
config.toml
?
b
yeah 1) added my own router and i want to put it under [model_routing] 2) but router_name= are not python class names - they are keys from ROUTER_LLM_REGISTRY 3) in order to add ROUTER_LLM_REGISTRY key my class needs to be imported somehow which requires code modification to add it to init?
f
Yeah without code modification I imagine it's a bit tricky, initially I expected the router implementation to be in the OH code base and then we can select it via
config.toml
. If possible I think the easiest path is to open a PR adding your router under
openhands/llm/router
, so it can be imported and referenced via
config.toml
b
i guess another option is do it in custom config loader, specify it in OPENHANDS_CONFIG_CLS and import it there.... my router is proprietary to my app so it wont make sense to PR it into main app... maybe there could be try/catch that tries to import class specified in config before looking it up in registry....
🤔 1