Skip to content

[FEATURE]: Support explicit proxy configuration in opencode config #24981

@zhangmuwuge

Description

@zhangmuwuge

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

OpenCode currently supports proxy configuration through standard environment variables such as HTTPS_PROXY,
HTTP_PROXY, and NO_PROXY. This works for simple terminal usage, but it is hard to scope safely when different
developer tools on the same machine need different proxy routes.

In my setup, OpenCode needs a dedicated proxy entrypoint, while other tools use another proxy. Using global
environment variables affects unrelated tools, and using shell wrapper scripts is awkward for Windows, desktop app,
IDE, and corporate VPN setups.

I would like OpenCode to support explicit proxy configuration in opencode.json / opencode.jsonc, for example:

{
  "$schema": "https://opencode.ai/config.json",
  "network": {
    "proxy": {
      "http": "http://127.0.0.1:7890",
      "https": "http://127.0.0.1:7890",
      "all": "socks5://127.0.0.1:7890",
      "noProxy": ["localhost", "127.0.0.1", "::1"]
    }
  }
}

Expected behavior:

- Keep existing environment variable support.
- Define clear precedence between config-based proxy settings and proxy environment variables.
- Apply the resolved proxy settings consistently to provider requests, plugin installs, MCP/network requests, and
  other OpenCode-managed HTTP clients.
- Show resolved proxy settings in opencode debug config, with credentials redacted.
- Support existing config variable substitution, so credentials can be kept in env vars or files instead of hardcoded.

This would make OpenCode easier to use in enterprise/VPN environments and would avoid relying on global environment
variables or per-shell wrapper scripts.

Related but different issue: #21098 reports a plugin install failure when proxy environment variables are present.
This request is about adding first-class, scoped proxy configuration in OpenCode config.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions