Skip to content

[FEATURE]: Built-in proxy support with auto-start/stop for restricted network environments #37993

Description

@tianshan233

Feature hasn't been suggested before.

  • I have verified this feature hasn't been suggested before.

Describe the enhancement you want to request

OpenCode relies heavily on network access (webfetch, package installs, git clone, etc.), but many developers work behind network restrictions that require proxy access. Currently there is no built-in proxy support.

Proposal: Add built-in proxy configuration and auto-start/stop capabilities to OpenCode.

Suggested Implementation

// opencode.jsonc
{
  proxy: {
    enabled: true,
    host: 127.0.0.1,
    port: 7890,
    protocol: http,
    // Optional: auto-start a local proxy core
    auto_start: {
      core_path: C:\\path\\to\\mihomo.exe,
      subscription_url: https://...
    }
  }
}

Use Case

  1. Agent runs webfetch → times out due to network restriction
  2. OpenCode auto-starts the configured proxy core
  3. Network requests go through proxy → succeeds
  4. After task completion, proxy auto-shuts down

This would be especially helpful for developers in regions with internet restrictions.

Reference Implementation

We built a small PowerShell tool that does exactly this for OpenCode agents: https://github.com/tianshan233/auto-proxy

It demonstrates the full workflow: download subscription → start Mihomo core → set proxy → work → auto cleanup.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

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