文档
English Docs
Network

Network

OpenCode provides configuration for proxies and custom certificates in enterprise network environments.

Proxy Configuration

OpenCode respects standard proxy environment variables:

export HTTPS_PROXY=https://proxy.example.com:8080
export HTTP_PROXY=http://proxy.example.com:8080
export NO_PROXY=localhost,127.0.0.1

Important: The TUI relies on a local HTTP server, so you must exclude localhost and 127.0.0.1 from proxy routing.

Proxy Authentication

For proxies requiring credentials:

export HTTPS_PROXY=http://username:[email protected]:8080

Security Note: Avoid embedding passwords in configuration files. Use environment variables or secure credential management systems.

For advanced authentication (NTLM, Kerberos), consider implementing an LLM Gateway.

Custom Certificates

Enterprise environments using custom Certificate Authorities:

export NODE_EXTRA_CA_CERTS=/path/to/ca-cert.pem

This applies to both proxy connections and direct API communications.