Skip to main content

opencode-unlimited

PyPI version Python CI License: MIT Code style: ruff

opencode-unlimited (ocu) is a local HTTP/HTTPS proxy for OpenCode. It sends OpenCode's traffic out through one of several egress "lanes" (direct, Cloudflare WARP, Tor) and moves to the next lane when one fails or, for plain-HTTP traffic, returns 429 Too Many Requests.

Know the limits. Quotas tied to your OpenCode account or API key are counted per account, not per IP address, so changing the egress lane does not reset them. HTTPS traffic is end-to-end encrypted, so ocu can't see 429 responses inside it (see HTTPS and 429s). Follow the terms of the services you use.


Features

  • Local forward proxy on 127.0.0.1:8877 that handles HTTPS CONNECT tunnels and plain HTTP, and streams server-sent events without buffering
  • Egress lanes: direct, Cloudflare WARP, and Tor, with failover when a lane can't connect
  • On plain-HTTP 429: records the event (with Retry-After), rotates to the next lane, and retries once
  • Lanes that are disabled or whose service fails to start are removed from rotation
  • ocu tor install: checks for Tor and installs it (the official Tor Expert Bundle verified by SHA-256 on Windows, your package manager elsewhere), and can add it to your PATH
  • ocu run: finds or installs OpenCode, starts the proxy in the background, and launches OpenCode through it
  • Optional web dashboard (FastAPI)
  • Pure-Python config (stdlib dataclasses + TOML), so it installs cleanly on Termux

Installation

# Recommended (isolated, puts `ocu` on PATH)
pipx install opencode-unlimited

# Or with uv
uv tool install opencode-unlimited

# Or with pip inside a virtual environment
pip install opencode-unlimited

# With the web dashboard
pipx install "opencode-unlimited[dashboard]"

Requires Python 3.10+. Tor is optional and ocu can install it for you. WARP is optional and needs warp-cli.

Platform notes (Windows, Debian/Ubuntu, Termux)

Windows (PowerShell)

python -m pip install --user pipx
python -m pipx ensurepath   # then open a new terminal
pipx install opencode-unlimited

Debian / Ubuntu (externally-managed-environment / PEP 668)

sudo apt update && sudo apt install -y pipx
pipx ensurepath
pipx install opencode-unlimited

Termux (Android)

pkg install python tor
pip install opencode-unlimited

Quick start

ocu run              # start the proxy in the background and launch OpenCode through it
ocu run --desktop    # same, but launch OpenCode Desktop
ocu start -d         # only start the background proxy
ocu status           # proxy, lanes, and account status
ocu tor status       # is Tor installed / on PATH / listening?
ocu stop             # stop the background proxy (and the Tor it started)

To route any other tool through ocu, point it at the proxy:

export HTTPS_PROXY=http://127.0.0.1:8877 HTTP_PROXY=http://127.0.0.1:8877
$env:HTTPS_PROXY = "http://127.0.0.1:8877"; $env:HTTP_PROXY = "http://127.0.0.1:8877"

OpenCode 2.x normally sends work to a long-running background service that does not inherit these variables. ocu run therefore launches OpenCode with --standalone. If you launch OpenCode yourself, pass --standalone too, for example opencode run --standalone "...".


CLI commands

Command Description
ocu run [-- ARGS] Find/install OpenCode, start the proxy in the background, launch OpenCode through it
ocu setup Detect OpenCode CLI/Desktop and install or configure it
ocu start [-d] Start the proxy stack (foreground with live status, or -d for background)
ocu stop Stop the background proxy
ocu status Show proxy status, lane health, and the account pool
ocu logs [-f] [-n N] Show or follow the log file
ocu dashboard [-p PORT] Run the web dashboard (needs the dashboard extra)
ocu config show / set KEY VALUE / reset View, change, or reset the configuration
ocu lanes list Show egress lanes and their health
ocu lanes tor on/off, ocu lanes warp on/off Enable or disable a lane
ocu tor status Show whether Tor is installed, on PATH, and listening
ocu tor install [-y] [--no-path] [--force] Install Tor and (optionally) add it to PATH
ocu tor path Add an installed Tor's folder to your user PATH (Windows)
ocu tor renew Ask the running Tor for a new circuit
ocu accounts list/add/remove/rotate Manage the local account pool
ocu version Print the version

Common options for start and run: --proxy-port, --no-tor, --no-warp, --dashboard.


How it works

  OpenCode (HTTPS_PROXY=http://127.0.0.1:8877)
         |
         v
  +------+--------+   CONNECT host:443  -> tunnel via current lane, fail over on connect error
  |   ZenProxy    |   plain HTTP        -> forward, on 429 rotate + retry once
  +------+--------+
         |  lane selector (ProxyChain)
   +-----+------+---------+
   v            v         v
 direct      WARP       Tor
 (clean)   SOCKS5    SOCKS5
           :40000    :9050
         \     |     /
          v    v    v
       opencode.ai / models.opencode.ai / provider APIs

Full details are in docs/architecture.md.

Lanes

Lane Config name Route
Clean endpoint clean / clean_endpoint Direct connection
Direct direct Direct connection (always available)
WARP warp SOCKS5 127.0.0.1:40000 (WARP must be in proxy mode)
Tor tor SOCKS5 127.0.0.1:9050

The default order is ["clean", "warp", "tor"], followed by any lanes not listed. Change it with:

ocu config set lanes_priority "tor,clean"

HTTPS and 429s

OpenCode uses HTTPS, which reaches ocu as CONNECT tunnels. ocu opens each tunnel through the current lane and tries the next lane if the connection fails. The TLS session runs between OpenCode and the server (ocu does not decrypt it), so a 429 inside the tunnel reaches OpenCode unchanged and does not trigger rotation. 429 handling applies to plain-HTTP requests.

Tor

ocu start and ocu run check for Tor when the Tor lane is on, and offer to install it if it's missing. See docs/tor.md for what the installer does on each OS and how it edits PATH on Windows.


Configuration

Platform Path
Linux ~/.config/opencode-unlimited/config.toml
macOS ~/Library/Application Support/opencode-unlimited/config.toml
Windows %APPDATA%\opencode-unlimited\config.toml
proxy_port = 8877
dashboard_port = 7979
enable_warp = true
enable_tor = true
enable_clean_endpoints = true
auto_resume = true
log_level = "INFO"
lanes_priority = ["clean", "warp", "tor"]
opencode_api_host = "api.opencode.ai"
opencode_cli_path = ""
opencode_desktop_path = ""

Every key is described in docs/configuration.md.


Documentation


Contributing

Contributions are welcome. Start with CONTRIBUTING.md, and please follow the Code of Conduct.

Report security issues privately as described in SECURITY.md, not in public issues.


License

MIT. See LICENSE.

Metadata

Release files for opencode-unlimited 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opencode-unlimited 0.1.0
File Size Uploaded Provenance Actions
opencode_unlimited-0.1.0.tar.gz 76.7 kB With provenance Details for opencode_unlimited-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for opencode-unlimited 0.1.0
File Interpreter ABI Platform Actions
opencode_unlimited-0.1.0-py3-none-any.whl Python 3 none any Details for opencode_unlimited-0.1.0-py3-none-any.whl

Total release size: 144.5 kB

Release files / opencode_unlimited-0.1.0.tar.gz

Download URL opencode_unlimited-0.1.0.tar.gz
Size 76.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b1fc5ce49295e5f79520e3c4afd5831f43cc7c8d1a14eb848a72ad77f37983fc
BLAKE2b-256 checksum
How to use checksums
59417374b19c9177664ba2ab7174efc0de5bd17637970ef0c807332b2fb63e04
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Release files / opencode_unlimited-0.1.0-py3-none-any.whl

Download URL opencode_unlimited-0.1.0-py3-none-any.whl
Size 67.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
861c847d58f36539f2541eedc060627a4f7ac82923a21f11ef290426d2def75e
BLAKE2b-256 checksum
How to use checksums
b729df9ce1027241b581f5b9c1f18d5f3892245e8bdb08356fcbbaf2709cd568
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Security for opencode-unlimited 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for opencode_unlimited-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page