How to Connect OmniRoute with OpenCode (Complete Setup Guide)
If you’re using OpenCode as your AI coding assistant and want to access multiple AI models through a single endpoint, OmniRoute makes the setup incredibly simple.
In this guide, I’ll walk you through the entire process—from installing the required dependencies to configuring OpenCode with OmniRoute.
Let’s get started.
Prerequisites
Before installing OpenCode and OmniRoute, make sure you have Node.js and npm installed.
You can verify the installation by running:
node -v
npm -v
If both commands return version numbers, you’re ready to continue.
If they aren’t installed yet, follow the steps below.
Install Node.js & npm
macOS
Using Homebrew:
brew install node
Verify the installation:
node -v npm -v
Install OpenCode
Install OpenCode globally:
npm install -g opencode-ai
Verify the installation:
opencode --version
Install OmniRoute
Install OmniRoute globally:
npm install -g omniroute
After installation, start the server:
omniroute
By default, OmniRoute runs on:
http://localhost:20128
Keep this terminal running while using OpenCode.
Configure OpenCode
Now we’ll connect OpenCode to OmniRoute.
Add a new provider named omniroute without removing or modifying any of your existing configuration (such as mcp, plugin, or any other settings).
Add the following configuration:
Edit the file ~/.config/opencode/opencode.json. Add a new entry under “provider” called “omniroute” with this exact structure, without removing or changing any existing keys (like “mcp” or “plugin”):
{
"npm": "@ai-sdk/openai-compatible",
"name": "OmniRoute",
"options": {
"baseURL": " http://localhost:20128/v1",
"apiKey": "Your api key"
},
"models": {
"auto": { "name": "auto" },
"auto/coding": { "name": "auto/coding" },
"auto/fast": { "name": "auto/fast" },
"auto/cheap": { "name": "auto/cheap" },
“kr/claude-sonnet-4.5”: { "name": "kr/claude-sonnet-4.5" },
“oc/deepseek-v4-flash-free”: { "name": "oc/deepseek-v4-flash-free" },
}
}
Show me the full updated file afterward so I can verify nothing else was changed.
Replace:
your api key
with your own OmniRoute API key.
Important: Only add the new provider. Don’t delete or modify any of your existing configuration.
After saving the file, restart OpenCode.
For Manual Configuration
Open the configuration file:
code ~/.config/opencode/opencode.json
If you’re not using VS Code, open the same file with any text editor.
Inside the file, locate the "provider" section.
Verify Your Configuration
Once everything is configured:
- OmniRoute should be running locally.
- OpenCode should detect the new provider.
- You can now choose OmniRoute from the available providers.
- All supported models will be available through the same configuration.
If the provider doesn’t appear immediately, simply restart OpenCode.
Why Use OmniRoute?
Using OmniRoute has several advantages:
- One API endpoint for multiple AI models.
- Easy switching between coding, fast, and budget-friendly models.
- Local routing for better flexibility.
- Simple OpenAI-compatible integration.
- No need to manually configure every provider individually.





