OpenCode model routing: reuse API settings and select a route in /models
Already have an OpenCode provider? Reuse its API in HiRoute, use a fast model for reading code and a stronger one for analysis, then select the route in OpenCode's /models picker alongside your existing models. Use Pi when you want a separate check.
Download HiRoute · Browse Agent guides
1. Scan or sign in to get models · 2. Configure smart routing · 3. Connect your Agent · 4. Explore task delegation
1. Scan or sign in to get models
Open Models → General models → Add models → Scan this device. Select detected OpenCode static providers, model declarations and API key sources, then check and save them.
OpenCode's /models may also include dynamically discovered or OAuth plugin models. If the scan misses a source that provides an API address and key, add them under New API connection, check the connection and save. You can also import Codex or Claude Code models through Connect subscription, or use models you already connected.
2. Configure smart routing
- Open Smart routing → New smart routing, name the plan “OpenCode code review” and choose Difficulty routing.
- Click Add model in Regular models and choose a fast or economical model from step 1 for reading files, finding definitions and gathering facts.
- Add a model to Primary models for complex analysis, planning or changes across several files. Combine available models from different subscriptions, APIs or local connections as needed.
- Start with Heuristic rules under Decision method, then click Enable. The published route becomes available in the Agent settings in the next step.
To adjust routing using execution feedback, select a decision model in the same section for stage scoring and low-score protection. Learn about difficulty decisions
3. Connect your Agent
Open Agent → OpenCode → Model routing, check “OpenCode code review”, choose a compatible protocol and save.
Restart OpenCode and select the new route with /models. Ask it to summarize a small change, then inspect model choices in HiRoute's Sessions → Routing timeline.
4. Explore task delegation
Before renaming an API field, let lightweight Pi find the callers, docs and tests that refer to it. An economical model handles the repository search. OpenCode receives the affected locations and keeps its primary model focused on implementation and verification.
Create a Fixed model route called “Pi rename impact”. Under More settings → Task delegation, allow delegation and choose Pi, describe its purpose and enable it. Then turn on Agent → OpenCode → Task routing.
Use HiRoute to ask “Pi rename impact” where this field is referenced. Group the paths and line numbers by callers, docs and tests.
Start with one field and see whether the report gives your main Agent enough to start editing. Set up lightweight Pi delegation