explaingit

fares-nosair/opencode-agentrouter-support

Analysis updated 2026-06-24

11JavaScriptAudience · developerComplexity · 2/5LicenseSetup · easy

TLDR

Local Node.js proxy that lets the OpenCode coding tool talk to AgentRouter models through an OpenAI-compatible adapter. Ships one server file and an opencode.jsonc config.

Mindmap

mindmap
  root((opencode-agentrouter))
    Inputs
      OpenCode chat requests
      AgentRouter API key
    Outputs
      Streamed model replies
      Proxy on port 4000
    Use Cases
      Use AgentRouter models in OpenCode
      Switch between deepseek and glm
      Run a local OpenAI-shape proxy
    Tech Stack
      Node.js
      Express
      OpenAI SDK
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Wire AgentRouter as a provider inside the OpenCode editor

USE CASE 2

Pick between deepseek v4 pro, deepseek v4 flash, and glm 5.1 from OpenCode

USE CASE 3

Run a local OpenAI-shape proxy on 127.0.0.1:4000 for other tools

USE CASE 4

Test AgentRouter endpoints with a curl command before wiring an editor

What is it built with?

Node.jsExpressOpenAIcors

How does it compare?

fares-nosair/opencode-agentrouter-supportgugao-bug/openart-auto-registeridleprocesscc/co-reading-mcp
Stars111111
LanguageJavaScriptJavaScriptJavaScript
Setup difficultyeasyhardmoderate
Complexity2/53/53/5
Audiencedeveloperdevelopergeneral

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 30min

Needs Node 18+, an AgentRouter API key pasted into the script, and the opencode.jsonc placed in the right per-OS folder.

MIT license, use freely in commercial and personal projects with attribution.

In plain English

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.

Copy-paste prompts

Prompt 1
Walk me through installing express, cors, and openai, pasting my AgentRouter key into agenrouter_server.js, and starting the proxy on Linux
Prompt 2
Copy opencode.jsonc into the right OpenCode config folder for macOS and pick AgentRouter as the provider
Prompt 3
Change the proxy port from 4000 to 4567 in agenrouter_server.js and update opencode.jsonc to match
Prompt 4
Write a curl command that verifies the AgentRouter proxy is serving the chat completions endpoint
Prompt 5
Replace the AgentRouter base URL inside the proxy if the upstream changes their host

Frequently asked questions

What is opencode-agentrouter-support?

Local Node.js proxy that lets the OpenCode coding tool talk to AgentRouter models through an OpenAI-compatible adapter. Ships one server file and an opencode.jsonc config.

What language is opencode-agentrouter-support written in?

Mainly JavaScript. The stack also includes Node.js, Express, OpenAI.

What license does opencode-agentrouter-support use?

MIT license, use freely in commercial and personal projects with attribution.

How hard is opencode-agentrouter-support to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is opencode-agentrouter-support for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.