Skip to content

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

Open

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.

Activity

  1. added
    discussion
    on Apr 29, 2026
  2. added
    core
    on Apr 29, 2026
  3. github-actions commented on Apr 29, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If your request is distinct from these (e.g., scoped specifically to config-file-based proxy with per-tool precedence), please clarify the difference so maintainers can evaluate accordingly.

  4. removed
    discussion
    core
    on May 3, 2026
  5. github-actions commented on Jul 5, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

  6. erikdemarco commented on Oct 18, 2026

    @erikdemarco

    No update?

  7. rekram1-node commented on Oct 18, 2026

    @rekram1-node
    Member

    not a bad idea, ill take a look

  8. opencodejr commented on Oct 29, 2026

    @opencodejr
    Contributor

    Thanks for the detailed request! To summarize: you'd like proxy settings (http/https/all, including socks5, and noProxy) to be configurable in opencode.json, with clear precedence over the HTTP(S)_PROXY/NO_PROXY environment variables, applied to every outbound request OpenCode makes, and shown with credentials redacted in opencode debug config. That would let you scope a proxy to OpenCode alone instead of setting global env vars or using wrapper scripts.

    Right now OpenCode only reads the standard proxy environment variables (see the network docs), so this is a new feature. Maintainers will consider it.

    Related issues:

  9. itsarunkj commented on Oct 29, 2026

    @itsarunkj

    Looking forward to this @rekram1-node !

  10. mosinnik commented on Nov 13, 2026

    @mosinnik

    @rekram1-node any news? I need proxy settings

  11. rodi4eg commented on Nov 18, 2026

    @rodi4eg

    Would be useful to have proxy at the provider level, the way settings.tls already scopes a client certificate to one provider's requests only.

    "providers": {
      "upstream-a": {
        "package": "@opencode/ai/providers/openai-compatible",
        "settings": {
          "baseURL": "https://api.example.com/v1",
          "proxy": "http://127.0.0.1:1080"
        }
      }
    }

    Env vars can't express this. They apply to the whole process, so my own tools, webfetch and remote MCP servers get routed too, and a long-lived serve --service keeps whatever environment it started with. A provider-level proxy (http/https/socks5, winning over env for that provider only, userinfo redacted in opencode debug config) would let one provider use a tunnel while everything else connects directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions