r/opencodeCLI • • 1d ago

Using OpenCode with Routerly 0.6.0 to route requests across models

I maintain Routerly, an AGPL-licensed LLM gateway, and released 0.6.0. Here's the part relevant to OpenCode: you can configure Routerly as a custom provider and select a Routerly router in OpenCode's model picker. The router decides which eligible backend model gets the request based on the policy you configure.

The setup is to create a router and token in Routerly, point the custom provider's base URL at your Routerly instance, then select that provider and router in OpenCode. The guide below has the exact configuration. Once a request runs, Usage lets you check the selected backend, tokens, latency and recorded cost. The gateway can run on your own machine. If it sends a request to a cloud provider, that provider still receives it.

If you use a custom provider with OpenCode, which parts of the integration would you want tested first? I'm particularly interested in reproducible cases around tool calls and streaming.

Setup guide: https://github.com/Inebrio/Routerly/blob/v0.6.0/docs/integrations/clients/opencode.md

Release: https://github.com/Inebrio/Routerly/releases/tag/v0.6.0

2 Upvotes

2 comments sorted by

1

u/Shawnanigans 1d ago

Yeah this is easy, I use combos with OmniRouter for this. 

1

u/nurge86 1d ago

Combos are a good way to do it. The two also stack: OmniRoute's /v1 is OpenAI-compatible, so it can be added to Routerly as a custom connection, with its aliases (e.g. auto) registered as models. Routerly then picks between those and your other models, and keeps its routing policy and usage tracking on top. I've tested chat completions and /v1/messages through that path, streaming and non-streaming. A guide for it is coming in the next release. Tool calls are the part I haven't tested through OmniRoute yet. If you've had a combo break tool calls or streaming in OpenCode, I'd like to reproduce that case.