Wire AgentRouter as a provider inside the OpenCode editor
Pick between deepseek v4 pro, deepseek v4 flash, and glm 5.1 from OpenCode
Run a local OpenAI-shape proxy on 127.0.0.1:4000 for other tools
Test AgentRouter endpoints with a curl command before wiring an editor
Needs Node 18+, an AgentRouter API key pasted into the script, and the opencode.jsonc placed in the right per-OS folder.
This project is a small local helper that lets the OpenCode app use AI models from a service called AgentRouter. OpenCode is a coding tool that expects to talk to AI providers through a specific kind of plugin called the openai compatible adapter. AgentRouter does offer an API in that style, but it does not plug directly into OpenCode. The repository solves the gap with a lightweight Node.js proxy that runs on your own machine and translates between the two. The way the README describes the flow, OpenCode sends a chat request to the proxy on http://127.0.0.1:4000, the proxy forwards it on to AgentRouter, and the streamed reply comes back through the proxy to OpenCode. The proxy is one JavaScript file, agenrouter_server.js, and the OpenCode side is configured by a single config file, opencode.jsonc. The README also includes an ASCII diagram showing this three step path. Setup needs Node.js version 18 or higher and an AgentRouter API key, which the README says has a free tier. You install three npm packages, express, cors, and openai, paste your API key into line 11 of the proxy script, then run the script with node agenrouter_server.js. The expected log line is AgentRouter proxy running on http://127.0.0.1:4000. The opencode.jsonc file goes into the OpenCode config directory, which on Windows is C colon backslash Users backslash your name backslash .opencode and on macOS or Linux is the tilde slash .opencode folder. Once running, you pick AgentRouter as the provider inside OpenCode and choose one of three models the config exposes: deepseek v4 pro, deepseek v4 flash, or glm 5.1. The README provides two curl commands to verify the proxy is up. Customization covers changing the port if 4000 is in use and updating the upstream API base URL if AgentRouter changes their endpoint. The project is released under the MIT license.
Generated 2026-05-22 · Model: sonnet-4-6 · Verify against the repo before relying on details.