Feature hasn't been suggested before.
Describe the enhancement you want to request
Problem
OpenCode doesn't support HTTP/HTTPS or SOCKS5 proxies. Users behind corporate firewalls can't use it with LLM providers, the webfetch tool, or any other outbound feature. The existing proxy-env.ts reads HTTP_PROXY but only applies it to WebSocket connections.
Solution
Add proxy support to opencode.json (fallback to env vars):
{
"proxy": {
"url": "http://proxy:8080",
// or "socks5://proxy:1080"
"noProxy": ["localhost", "*.internal.com"]
}
}
Wire it into all outbound paths via a single proxy-aware fetch wrapper:
- LLM API calls (both AI SDK and native runtime) — via options.fetch / FetchHttpClient
- webfetch tool, config fetching, session instructions — via HttpClient
- WebSocket connections — extend existing proxy-env.ts with SOCKS5
- Direct fetch() calls (LSP downloads, auth, CLI) — via global fetch wrapper
- MCP servers — pass proxy env vars to child processes
Implementation
- proxy-fetch.ts — proxy-aware fetch wrapper (HTTP via undici, SOCKS5 via socks-proxy-agent)
- Add proxy field to config schema
- Inject proxy fetch into provider options and FetchHttpClient service
- Extend proxy-env.ts with SOCKS5 parsing
- Pass proxy env to MCP child processes
No new deps for HTTP proxy. SOCKS5 is optional.
Feature hasn't been suggested before.
Describe the enhancement you want to request
Problem
OpenCode doesn't support HTTP/HTTPS or SOCKS5 proxies. Users behind corporate firewalls can't use it with LLM providers, the
webfetchtool, or any other outbound feature. The existingproxy-env.tsreadsHTTP_PROXYbut only applies it to WebSocket connections.Solution
Add proxy support to
opencode.json(fallback to env vars):{ "proxy": { "url": "http://proxy:8080", // or "socks5://proxy:1080" "noProxy": ["localhost", "*.internal.com"] } }Wire it into all outbound paths via a single proxy-aware fetch wrapper:
Implementation
No new deps for HTTP proxy. SOCKS5 is optional.