opencode-proxy
v2.0.5
Published
Per-provider proxy configuration for OpenCode - Route different AI providers through different proxies
Maintainers
Readme
OpenCode Proxy
Per-provider proxy configuration for OpenCode.
{
"google": "http://127.0.0.1:20171",
"openai": "socks5://127.0.0.1:1080"
}Unconfigured providers connect directly — no direct array needed.
Install
For Humans
Option A: Let an LLM do it
Paste this into any LLM agent:
Install and configure opencode-proxy by following: https://raw.githubusercontent.com/Chongyao/opencode-proxy/main/README.mdOption B: Manual
npm install opencode-proxyAdd to ~/.config/opencode/opencode.json:
{
"plugin": ["opencode-proxy"]
}Create ~/.config/opencode/proxy.json:
{
"google": "http://127.0.0.1:20171"
}Done.
For AI Agents
Fetch this README and follow the configuration section. Key points:
- Install
opencode-proxynpm package - Add
"opencode-proxy"to thepluginarray in~/.config/opencode/opencode.json - Create
~/.config/opencode/proxy.jsonwith provider-to-proxy URL mapping - Unconfigured providers connect directly (no explicit
directlist needed)
Config
File: ~/.config/opencode/proxy.json
{
"debug": true,
"google": "http://127.0.0.1:20171",
"anthropic": "socks5://user:[email protected]:1080",
"openai": "https://proxy.example.com:8443"
}| Key | Type | Description |
|-----|------|-------------|
| debug | boolean | Enable debug logging |
| <provider> | string | Proxy URL: protocol://[user:pass@]host:port |
Supported Protocols
http://host:porthttps://host:portsocks5://host:portsocks4://host:port
Providers
google, anthropic, openai, azure, amazon-bedrock, moonshot, kimi, deepseek, groq, mistral, cohere, together, perplexity, openrouter, github-copilot, xai, cerebras, fireworks
Examples
Single provider:
{
"google": "http://127.0.0.1:20171"
}With auth:
{
"google": "http://user:[email protected]:8080"
}Debug mode:
{
"debug": true,
"google": "http://127.0.0.1:20171"
}How It Works
The plugin patches fetch to route configured providers through their specified proxy. Unconfigured providers connect directly.
License
MIT
