[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-111283":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":14,"stars7d":16,"stars30d":17,"stars90d":15,"forks30d":15,"starsTrendScore":18,"compositeScore":19,"rankGlobal":9,"rankLanguage":9,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":23,"hasPages":21,"topics":24,"createdAt":9,"pushedAt":35,"updatedAt":36,"readmeContent":37,"aiSummary":38,"trendingCount":15,"starSnapshotCount":15,"syncStatus":39,"lastSyncTime":40,"discoverSource":41},111283,"opencode-unlimited-proxy","ebouther\u002Fopencode-unlimited-proxy","ebouther","OpenAI-compatible gateway for the OpenCode free tier. Works around 403 FreeTierError with a de-duplicated pool of rotating egress IPs. No API key, no cost.",null,"Python",90,22,62,1,0,11,27,4,54.23,"MIT License",false,"main",true,[25,26,27,28,29,30,31,32,33,34],"403","free-tier","llm-gateway","openai-compatible","opencode","opencode-zen","proxy","proxy-pool","self-hosted","warp","2026-11-14 01:38:20","2026-11-23 06:00:58","\u003Cp align=\"center\">\n  \u003Cimg src=\"docs\u002Fmedia\u002Fdemo.gif\" alt=\"A direct call to the OpenCode free tier is refused with 403 FreeTierError; the same request through this local gateway answers 42\" width=\"820\">\n\u003C\u002Fp>\n\n# opencode-unlimited-proxy\n\n\u003Cp align=\"center\">A self-hosted, \u003Cstrong>zero-cost\u003C\u002Fstrong> OpenAI-compatible gateway for the OpenCode \u003Cstrong>free tier\u003C\u002Fstrong>, fronted by rotating egress addresses. No API key, no spend.\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Ca href=\"actions\u002Fworkflows\u002Fci.yml\">\u003Cimg alt=\"CI\" src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Factions\u002Fworkflow\u002Fstatus\u002Febouther\u002Fopencode-unlimited-proxy\u002Fci.yml?branch=main&label=CI\">\u003C\u002Fa>\n  \u003Ca href=\"LICENSE\">\u003Cimg alt=\"MIT\" src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flicense\u002Febouther\u002Fopencode-unlimited-proxy\">\u003C\u002Fa>\n\u003C\u002Fp>\n\nBoth halves of that recording are real, not a mockup. The top command goes\nstraight to `opencode.ai\u002Fzen\u002Fv1` and gets the refusal the free tier hands out by\ndefault. The bottom one goes through this gateway and gets an answer, with no\nupstream API key configured anywhere in it. What the gateway removes is the\nrefusal. What the WARP pool removes is the per-egress-block quota ceiling, which\nis a separate problem and a separate cause.\n\n## Get it running\n\n> **Linux, tested path.** The default mode runs the engine in the host network\n> namespace and needs outbound UDP to Cloudflare on port 2408. The legacy\n> external-pool mode additionally needs privileged containers and\n> `\u002Fdev\u002Fnet\u002Ftun`; Docker Desktop on macOS and Windows provides neither.\n> [What that rules out, and what it does not](#on-macos-or-windows).\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Febouther\u002Fopencode-unlimited-proxy.git\ncd opencode-unlimited-proxy\u002Fstack\n\n# Cloudflare's terms apply to the WARP tunnel. Read them first:\n# https:\u002F\u002Fwww.cloudflare.com\u002Fapplication\u002Fterms\u002F\ncp .env.example .env && sed -i 's\u002FWARP_ACCEPT_TOS=0\u002FWARP_ACCEPT_TOS=1' .env\n\n# Strongly recommended: your routed IPv6 \u002F64. Each WARP exit then gets its\n# own egress \u002F64, which is the block the free tier meters.\nip -6 addr show scope global          # find the prefix, e.g. 2001:db8:...::\u002F64\nsed -i 's|^WARP_SOURCE_IPV6=.*|WARP_SOURCE_IPV6=2001:db8:1234:5678::\u002F64|' .env\n\ndocker compose up -d\n```\n\nLinux, Docker Compose v2, outbound UDP 2408, and ideally a routed IPv6 `\u002F64`.\nThe engine image is pulled, not built. The first start takes seconds, then WARP\nregistration adds a little more.\n\n| What | Where |\n|---|---|\n| OpenAI-compatible API | `http:\u002F\u002F127.0.0.1:8080\u002Fv1` |\n| Web dashboard | `http:\u002F\u002F127.0.0.1:8081` (`admin` \u002F `changeme-changeme` — [change it](SECURITY.md)) |\n| WARP pool | engine-managed; `\u002Fhealthz` reports `warp.active` and `warp.standby`, with no local proxy ports |\n\nThen point a client at it. One entry each, written out in full\n[below](#point-your-tools-at-it):\n\n| Client | What to enter |\n|---|---|\n| OpenCode CLI | a provider on `http:\u002F\u002F127.0.0.1:8080\u002Fv1`, key `local-test-key` |\n| 9router | OpenAI-compatible node, base `http:\u002F\u002F127.0.0.1:8080\u002Fv1`, key `local-test-key`, prefix `oc2`, **API type `chat`** |\n| OmniRoute | OpenAI-compatible node on `http:\u002F\u002F127.0.0.1:8080\u002Fv1`, then `\u003Cprefix>\u002F\u003Cmodel>` from a combo |\n\nTwo ways to narrow that down before committing to any of it: the\n[60-second probe](#check-the-claim-in-60-seconds-install-nothing) tests the\nupstream claim with no Docker at all, and if you already have proxies,\n[two services are enough](#variations-verification-and-defaults) — no WARP, no\nCloudflare terms.\n\n## What this does, and what it does not\n\n**Does**\n- Serves OpenCode's anonymous free-tier models through an OpenAI-compatible API,\n  with **no key and no cost** — nine at the time of writing, listed in\n  [OpenCode CLI](#opencode-cli) below.\n- Reproduces the complete client fingerprint the free tier gates on — including\n  the two most people miss: a tool named exactly `read`, and forced\n  `stream: true`. See [`docs\u002Ffree-tier-gates.md`](docs\u002Ffree-tier-gates.md).\n- Multiplies your usable budget across N egress blocks, and fails over\n  automatically when one block is exhausted or unhealthy.\n\n**Does not**\n- Remove the upstream quota. It is metered **per egress block**: a `\u002F64` on\n  IPv6 and a `\u002F32` on IPv4, reset daily at 00:00 UTC. The ceiling is roughly\n  `N × per-block quota`, so `N` is the number of *distinct* blocks you can\n  obtain. Cloudflare's WARP IPv4 egress is one shared NAT address that other\n  users routinely exhaust; a routed IPv6 `\u002F64` lets each exit bind its own\n  source and get its own block. Measured here on 2026-10-27, see\n  [the quota axis](docs\u002Ffree-tier-gates.md#not-a-gate-the-quota-axis).\n- Guarantee that any block has budget. WARP is a shared consumer network:\n  exits repeat, are geolocated unexpectedly, and can be refused or already\n  exhausted. The engine rotates on `429`\u002F`403` until an exit with headroom\n  answers or the attempt budget is spent.\n- Carry a warranty against upstream changes. The free-tier fingerprint is not a\n  published contract and has already changed twice (≈2026-10-11, ≈2026-10-13).\n- Carry any affiliation with OpenCode, Cloudflare, or the upstream projects.\n\n> Rotating egress to reach more of a free tier than a single address allows may\n> breach OpenCode's terms of service. That call is yours, on your own\n> infrastructure, at your own cost.\n\n---\n\n## What it actually is\n\nThe default stack is one engine process and one userspace WARP pool. The engine\n(`opencode2api` v1.4.4+) registers Cloudflare WARP exits itself, keys them by\negress block, and rotates on `429`\u002F`403`. No privileged containers, no TUN, no\nexternal CONNECT proxies.\n\nThe load-bearing detail is the number of **distinct egress blocks**. Usage is\nmetered per `\u002F64` (IPv6) or `\u002F32` (IPv4), with a daily reset at 00:00 UTC.\nThree exits behind one block are one budget, not three. Cloudflare's WARP IPv4\negress is a single shared NAT address that other users routinely exhaust, so\nrotating that address buys nothing. With `warp.stack: ipv6` and a routed\n`source_ipv6` prefix, each exit binds its own outer source address and gets a\ndifferent `\u002F64`, which is why IPv6 is the recommended path.\n\nThe engine's pool is dynamic: `warp.pool_size` is an upper bound, the active\nring follows concurrency, and an exit answered with `429` or `403` is retired\nand re-registered immediately. `retry.max_attempts` controls how many exits one\nrequest may walk before returning the last refusal.\n\nThe legacy external-pool mode (`warp.enabled: false`) is still generated and\ndocumented: it runs one privileged WARP namespace and one tinyproxy per node,\nplus `ofu-dedupe`. It remains useful on hosts without a routed IPv6 `\u002F64`, or\nas a reference for the de-duplication problem. It shares Cloudflare's IPv4 NAT,\nso it is no longer the default.\n\n| Piece | Role |\n|---|---|\n| `ghcr.io\u002Fjasonxu114514\u002Fopencode2api` (GPL-3.0) | The engine. Mints the client identity\u002Fsession headers, serves `\u002Fv1\u002F*`, runs the userspace WARP pool, and rotates exits on `429`\u002F`403`. |\n| `stack\u002Fconfig.json` | `anonymous: true`, `free_only: true`, empty key lists, and the `warp` block. |\n| `WARP_SOURCE_IPV6` in `.env` | The routed `\u002F64` each exit binds its outer source from. Injected by `config-init`, never committed. |\n| `stack\u002Fwarp\u002F`, `stack\u002Ftinyproxy\u002F`, `stack\u002Fdedupe\u002F` | The legacy external pool, used only when `warp.enabled: false`. |\n\n```\nopencode CLI ─┐\n9router ──────┼─► opencode2api :8080 ──► userspace WARP exits ──► opencode.ai\u002Finference\nOmniRoute ────┘   (identity + retry)      one \u002F64 per exit        (free tier, Bearer public)\n```\n\n> Using your own proxies? Set `warp.enabled: false`, put your endpoints in the\n> `proxies` array of `config.json`, and `docker compose up -d config-init\n> opencode-engine` to skip the WARP, `tinyproxy` and `ofu-dedupe` services.\n> That is the way past WARP's address-space ceiling: egress you control.\n\n## Measured results (this repo, 2026-10-15, 6 nodes)\n\n- `\u002Fv1\u002Fmodels` → the live free catalogue (9 models on 2026-10-19). The count is\n  upstream's to change; query the endpoint rather than trusting any number\n  written here.\n- `6*7 ?` → `42`. Re-measured 2026-10-18 through the gateway and through 9router\n  (`oc2\u002Fbeam-free`). Through OmniRoute (`9r\u002Fsnowbuddy-free`) the same request\n  returns HTTP 200.\n- 5\u002F5 consecutive single-turn completions → HTTP 200.\n- Sustained agent session: ~57 `\u002Fv1\u002Fchat\u002Fcompletion` in an hour, 47 × `200`, 11 × `499` (client-side cancellations), 0 upstream `429`.\n\n**Not measured:** multi-day runs, thousands of requests, behaviour under\nsustained saturation. Treat the throughput numbers above as a smoke test, not a\ncapacity guarantee.\n\n---\n\n## Check the claim in 60 seconds, install nothing\n\nThe cheapest way to find out whether this repository is telling the truth is to\nask upstream directly. No Docker, no WARP, no terms to accept, nothing left\nrunning afterwards:\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Febouther\u002Fopencode-unlimited-proxy.git\ncd opencode-unlimited-proxy\n.\u002Fscripts\u002Fgate-probe.py\n```\n\nThat is the load-bearing half of the whole bundle — the conditions the free\ntier refuses requests without, each probed in isolation. The run is paired with\ncontrols: shapes that must be refused, and one that must be accepted. It exits\nnon-zero rather than reporting anything if the baseline itself is refused.\n\nThat is not ceremony. A run where every probe comes back 403 proves nothing,\nand a probe that cannot tell you that is worse than no probe.\n\nIf the baseline comes back `429` where it expects `200`, that is the egress\nblock's quota, not a gate and not a broken install. The `Retry-After` points at\nthe daily reset (00:00 UTC). The default stack has no local proxy ports; check\n`\u002Fhealthz` for the WARP pool and let the engine rotate. In the legacy external\npool you can still pin one node:\n\n```bash\n.\u002Fscripts\u002Fgate-probe.py --proxy http:\u002F\u002F127.0.0.1:18090\n```\n\nIf that passes and you want the rotating pool behind it, carry on.\n\n## Requirements\n\n- **Linux** (native). The default engine-managed WARP mode needs\n  `network_mode: host` and outbound UDP 2408. The legacy external pool\n  additionally needs `\u002Fdev\u002Fnet\u002Ftun` plus `privileged` and `NET_ADMIN`, which\n  Docker Desktop on macOS and Windows does not hand out.\n- **Docker Engine** + **Docker Compose v2** (`docker compose`, not `docker-compose`).\n- A routed IPv6 `\u002F64` for the recommended path. Without one, WARP falls back to\n  its shared IPv4 NAT, which is usually exhausted.\n- Outbound TCP 443 and UDP 2408 to Cloudflare. The legacy pool also uses TCP\n  7844.\n- Roughly 100 MB for the engine; the legacy pool adds ~150 MB per node.\n\n## On macOS or Windows\n\nThere is no supported path today. This section says exactly what stops it,\nrather than suggesting something that will fail on you.\n\nTwo pieces are still Linux-bound:\n\n- **The legacy WARP nodes** (only when `warp.enabled: false`). Each one creates a\n  TUN device and routes through it, which needs `\u002Fdev\u002Fnet\u002Ftun` and privileged\n  containers.\n- **The engine's host networking.** It runs with `network_mode: host` so the\n  userspace WARP tunnel can bind a source address from your routed `\u002F64`. On\n  Docker Desktop that host namespace belongs to the VM, so the prefix and the\n  UDP path are not yours.\n\nThe engine image itself is not the problem: it is published for both `amd64`\nand `arm64`, so it runs natively on Apple Silicon. What does not work is how this\nstack reaches the internet, not the gateway in the middle.\n\n**If you want to close the gap**, the piece to rewrite is the network path, not\nthe engine. Putting the engine on an ordinary bridge network, addressing the pool\nby service name instead of `127.0.0.1`, and listening on `0.0.0.0` inside the\ncontainer while publishing to `127.0.0.1` on the host: that configuration was\nbuilt and measured end to end on Linux, answering correctly through the pool with\nthe loopback-only binding preserved. It has never been run on Docker Desktop, and\nthat is the honest gap.\n\nUntil someone runs it there, your realistic options are a Linux host, or a remote\nproxy reachable by hostname — `proxies` accepts any URL, so\n`http:\u002F\u002Fuser:pass@your-proxy:3128` is a valid entry. That path is untested here,\nso treat it as a lead rather than a recipe.\n\n## Variations, verification and defaults\n\nThe commands in [get it running](#get-it-running) bring up the default\nengine-managed WARP pool. This section is everything that varies from that.\n\n**A larger WARP pool**: raise `warp.pool_size` in `stack\u002Fconfig.json` (1-32).\nThe active ring follows concurrency, so a quiet deployment stays small. Raise\nit when several users share the gateway:\n\n```json\n\"warp\": { \"enabled\": true, \"pool_size\": 8, \"stack\": \"ipv6\", \"source_ipv6\": \"\" }\n```\n\n**The legacy external pool** is still generated. Set `\"warp\": { \"enabled\":\nfalse }` in `stack\u002Fconfig.json`, then:\n\n```bash\npython3 generate-compose.py --nodes 6\ndocker compose up -d --build\n```\n\n`docker-compose.yml` is generated and CI checks it against\n`generate-compose.py`, so editing that file by hand will fail the\n`generated files are in sync` job.\n\nAlready have your own proxies? Skip WARP entirely: set `warp.enabled: false`,\nput them in the `proxies` array of `config.json`, then start only the two\nservices that do not touch Cloudflare —\n\n```bash\ndocker compose up -d config-init opencode-engine\n```\n\nNo WARP, no `tinyproxy`, no `ofu-dedupe`, and you never touch Cloudflare's\nterms.\n\nThen verify:\n\n```bash\n..\u002Fscripts\u002Fsmoke.sh\n```\n\n`smoke.sh` checks the bundle end to end and exits non-zero if anything is off.\nIn the default mode, `\u002Fhealthz` is the useful signal: `warp.status` must be\n`ready`, and `warp.active` tells you how many exits are in the ring. A request\ncan still take a few attempts when a fresh exit is already at its daily limit;\nthe engine rotates on `429` rather than failing the request immediately.\n\nIn the legacy external pool, a drained node is not a fault: `ofu-dedupe` drains\nthe surplus when WARP cannot give every node its own address, and a drained\nnode stops listening on purpose. `2\u002F2 serving, 4 drained` is a healthy result\nthere, and the check that carries the meaning is that every serving node holds a\ndistinct address.\n\nTo check *upstream* — whether the\nfree-tier fingerprint is still what this repository says it is, independently\nof anything running locally:\n\n```bash\n..\u002Fscripts\u002Fgate-probe.py          # baseline + controls, see --help\n```\n\n**Both listeners bind to `127.0.0.1` by default**, which is every documented use\nof this stack. To reach it from another machine, put it behind your own TLS\nterminator or a VPN rather than widening the bind: the API is anonymous by\ndesign (`anonymous: true`, see above), so anything that can reach `:8080` can\nspend your quota.\n\nTwo defaults in `stack\u002Fconfig.json` are the upstream's and are meant to be\nchanged before this is exposed anywhere:\n\n| Setting | Shipped value | Why it matters |\n|---|---|---|\n| `server_keys` | `[\"local-test-key\"]` | The only thing stopping unbilled traffic |\n| `webui.username` \u002F `webui.password` | `admin` \u002F `changeme-changeme` | The dashboard is the admin surface |\n\nSet both in `stack\u002Fconfig.json`, then `docker compose up -d` — `config-init`\nre-seeds the volume from that file on every start, so an edit that is not\nfollowed by a restart is silently discarded.\n\n## Point your tools at it\n\n### OpenCode CLI\n\n```jsonc\n\u002F\u002F ~\u002F.config\u002Fopencode\u002Fopencode.jsonc\n{\n  \"model\": \"opencode-unlimited-proxy\u002Fbeam-free\",\n  \"provider\": {\n    \"opencode-unlimited-proxy\": {\n      \"npm\": \"@ai-sdk\u002Fopenai-compatible\",\n      \"name\": \"opencode-unlimited-proxy\",\n      \"options\": {\n        \"baseURL\": \"http:\u002F\u002F127.0.0.1:8080\u002Fv1\",\n        \"apiKey\": \"local-test-key\"          \u002F\u002F must match stack\u002Fconfig.json server_keys\n      },\n      \"models\": {\n        \"beam-free\": {},\n        \"big-pickle\": {},\n        \"deepseek-v4.1-flash-free\": {},\n        \"glm-5.3-flash-free\": {},\n        \"longcat-2.5-preview-free\": {},\n        \"mimo-v2.6-flash-free\": {},\n        \"minimax-m3.1-flash-free\": {},\n        \"nemotron-3.5-lightning-free\": {},\n        \"nemotron-3.5-super-vl-free\": {}\n      }\n    }\n  }\n}\n```\n\n**The list above is a snapshot, not a contract.** The engine asks OpenCode for the\nlive catalogue on every request, so `\u002Fv1\u002Fmodels` is always the authoritative answer.\nSee [the model list moves](#the-model-list-moves).\n\n`beam-free` is the default above as a safe starting point: it is the first\nmodel in the live catalogue and answered every probe here. It does reason, so a\ntight `max_tokens` budget may go to thinking rather than the answer — raise\n`max_tokens` if the answer comes back empty, or pick a model whose reasoning\nyou have measured yourself.\n\nWhat I have actually measured, on the anonymous path only:\n\n| | single turn | multi-turn |\n|---|---|---|\n| All nine | answered | — |\n| `ll-alpha-free` | yes | yes, but only at `max_tokens` ≥ 300 |\n| `glm-5.3-flash-free` | yes | one correct answer, then `429`, then `502` on every node |\n| `big-pickle` | yes | spends the budget on reasoning |\n| `beam-free` | yes | not tested; reasoning model, see Troubleshooting |\n\nThe remaining eight are untested on multi-turn, so \"default\" here means a safe\nstarting point and not a ranking. Nothing in this repository tells you which\nmodel is best, and if you find that out it would be worth writing up.\n\n```bash\nopencode run \"23*17 ?\"\n```\n\n### 9router\n\nAdd an OpenAI-compatible connection:\n\n| Field | Value |\n|---|---|\n| Base URL | `http:\u002F\u002F127.0.0.1:8080\u002Fv1` |\n| API key | `local-test-key` |\n| Model prefix | `oc2`, or anything you like |\n| API type | `chat` |\n\nThen reference a model as `\u003Cprefix>\u002F\u003Cmodel>`, so `oc2\u002Fbeam-free`. Measured end\nto end through 9router: HTTP 200, and `6*7 ?` came back `42`.\n\n`API type` is the field lists like this usually skip, and it is not cosmetic. All\nnine free models currently on the tier are chat-native, which is what `chat` is\nfor. (The two `muse-spark-*-contributor-free` models that were `responses`-native\nupstream were retired off the tier on 2026-10-19, so the `responses` case no\nlonger applies to the free catalogue today.)\n\nExpect 9router to mark the connection `unavailable` from its own connectivity test.\nThat was the state of a working node here: `testStatus: unavailable`, a 403 from\nupstream, and ordinary routed use through the same node working fine. The likely\nreason is that the test request does not carry the client fingerprint the free tier\ngates on. Check it with a real request rather than the test badge:\n\n```bash\ncurl -s http:\u002F\u002F127.0.0.1:3000\u002Fv1\u002Fchat\u002Fcompletions \\\n  -H \"Authorization: Bearer \u003Cyour-9router-key>\" -H 'Content-Type: application\u002Fjson' \\\n  -d '{\"model\":\"oc2\u002Fbeam-free\",\"messages\":[{\"role\":\"user\",\"content\":\"23*17 ? Reply with just the number.\"}]}'\n```\n\n### OmniRoute\n\nAdd an OpenAI-compatible node pointing at `http:\u002F\u002F127.0.0.1:8080\u002Fv1`, with\n`local-test-key` as the key, then reference it as `\u003Cnode-prefix>\u002F\u003Cmodel>` from a\ncombo.\n\nThis one is given at the HTTP level only: the base URL, the key and the prefix are\nwhat the gateway speaks, and they are verified. It has not been clicked through\nOmniRoute's own interface, so treat the field names as the ones to look for rather\nthan a screenshot's worth of certainty.\n\n## The model list moves\n\nEvery model name in this file is a snapshot, not a contract. Upstream adds and\nretires anonymous models, and this repository does not control that. During the\nlast round of work here, `cat-jam-free` was retired and `beam-free` appeared on\nthe same afternoon, with no announcement either way. On 2026-10-19\n`space-bunny-free` and the two `muse-spark-*-contributor-free` models were\nmarked `deprecated` upstream and dropped from the free catalogue, so they no\nlonger resolve through this gateway; `minimax-m3.1-flash-free` took their place.\nIf you still have one of them in a client config, switch the name.\n\nSo treat `\u002Fv1\u002Fmodels` as the truth and any list here as a convenience:\n\n```bash\ncurl -s http:\u002F\u002F127.0.0.1:8080\u002Fv1\u002Fmodels -H \"Authorization: Bearer local-test-key\" \\\n  | jq -r '.data[].id'\n```\n\nListing models explicitly in a client config only populates the model picker at\nstartup. It is not a filter. A name upstream has retired will fail to resolve, and\na new one will not appear until you add it yourself.\n\nIf a model you expected is gone, the fix is a different name, not a different\nconfiguration.\n\n## Scaling the address pool\n\nThe default mode is configured in `stack\u002Fconfig.json`, not generated:\n\n```json\n\"warp\": {\n  \"enabled\": true,\n  \"pool_size\": 4,\n  \"stack\": \"ipv6\",\n  \"source_ipv6\": \"\"\n}\n```\n\n- `pool_size` is an upper bound (1-32). The active ring follows concurrency,\n  preloads half of it, and retires idle exits after 60 seconds.\n- `source_ipv6` comes from `WARP_SOURCE_IPV6` in `.env`. Each exit binds a\n  different source address from that routed prefix, so each gets its own\n  egress `\u002F64`.\n- `retry.max_attempts` (6 in the shipped config) is how many exits one request\n  may walk before returning the last `429`. Raise it when more exits are\n  already burned by other WARP users.\n\nMore exits mean more `\u002F64` buckets, but not every block is fresh: WARP exits\nare shared, and a new one can already be at its daily limit. The engine retires\na refused exit and re-registers immediately, so a request may take a few\nattempts before it finds headroom.\n\nThe legacy external pool is still resized with the generator:\n\n```bash\ncd stack\n# first set \"warp\": { \"enabled\": false } in config.json\npython3 generate-compose.py --nodes 10            # ports 18090-18099\npython3 generate-compose.py --nodes 10 --base-port 19090\ndocker compose up -d --build\n```\n\n`generate-compose.py` rewrites both `docker-compose.yml` and the `proxies`\narray in `stack\u002Fconfig.json`. In external mode, `ofu-dedupe` owns rotation and\ndrains nodes that cannot get their own address; see `stack\u002Fdedupe\u002Fdedupe.py`.\nThat mode shares Cloudflare's IPv4 NAT and is capped by what the colo hands\nout, which is why it is no longer the default.\n\n> Using your own proxies? Set `warp.enabled: false`, fill `proxies` (or\n> `proxyfile`) with your endpoints, and start only `config-init` and\n> `opencode-engine`. The WARP, `tinyproxy` and `ofu-dedupe` services are not\n> started at all.\n\n## Monitoring\n\n- **Dashboard** (`http:\u002F\u002F127.0.0.1:8081`): request distribution, upstream health,\n  counters, error rates.\n- **Default mode, WARP pool**:\n  ```bash\n  curl -s http:\u002F\u002F127.0.0.1:8080\u002Fhealthz | jq .warp\n  docker logs ofu-engine | grep -iE 'warp|429|403'\n  ```\n  `\u002Fhealthz` reports `status`, `active`, `standby`, and `cooling`. The engine\n  logs `egress ... ready at \u003Cprefix>` for each registration and\n  `Rotating ... (HTTP 429)` when it retires a block. Some exits are already at\n  their daily limit when they register; that is expected, and the rotation is\n  the fix.\n- **Legacy external pool**:\n  ```bash\n  docker logs ofu-dedupe                     # pool line: live \u002F distinct\n  docker logs ofu-engine | grep -iE 'proxy became|rate limit|unavailable'\n  docker compose -f stack\u002Fdocker-compose.yml logs -f tinyproxy-a\n  ```\n  `ofu-dedupe` prints one line per pass:\n  ```\n  pool: 6\u002F6 nodes live, 6 distinct addresses | alztrk-warp-a=104.28.194.131 ...\n  ```\n  A `\u003C-- collisions` suffix means it is still working on it; `DRAINED` in the\n  log means a node lost its proxy on purpose. A drain is reversible and the\n  arbiter reverses it on its own: each drain records the address the node was\n  holding, and as soon as nobody holds that address any more the node is put\n  back. Watch for `revived, back in the pool holding \u003Cip>` to know it happened.\n- **Probe a single legacy node**:\n  ```bash\n  curl -s -x http:\u002F\u002F127.0.0.1:18090 https:\u002F\u002Fapi.ipify.org; echo\n  ```\n- **Undo a legacy drain by hand** — normally unnecessary, since the arbiter\n  revives a node once its address frees up:\n  ```bash\n  docker exec ofu-dedupe rm \u002Fmarkers\u002Fb && docker logs -f ofu-proxy-b\n  docker exec ofu-dedupe cat \u002Fmarkers\u002Fb\n  ```\n  The marker says which address the node was holding, which is what the next\n  pass compares against.\n\nSigns that a legacy node is exhausted: the engine logs `proxy became\nunavailable`, the dashboard flips it to `Unavailable`, and completions start\nfailing after the configured retries.\n\n## Troubleshooting\n\n| Symptom | Cause \u002F fix |\n|---|---|\n| `proxyconnect tcp: dial tcp 127.0.0.1:1809x: connect: connection refused` | Legacy external pool only: that node's proxy is down. `docker compose ps`, then `docker compose up -d tinyproxy-a`. |\n| `no healthy anonymous proxies available` | Legacy external pool only: every node failed its health check. Check WARP registration with `docker logs ofu-warp-a`. |\n| Edits to `stack\u002Fconfig.json` seem ignored | The engine reads `\u002Fvar\u002Flib\u002Fopencode2api\u002Fconfig.json` from its **named volume** and prefers it over your file. `config-init` re-seeds it on `docker compose up -d`; to force it: `docker compose down && docker volume rm stack_ofu-engine && docker compose up -d`. |\n| `rename … device or resource busy` at startup | You bind-mounted the config path directly; it must be seeded by `config-init` instead. |\n| `SSL_ERROR_RX_RECORD_TOO_LONG` in the browser | You are on `https:\u002F\u002F` and\u002For `localhost`. Use `http:\u002F\u002F127.0.0.1:8081`. |\n| `FreeTierError` (403) | Check the **message**, not just the type — at least four different causes share it. `can only be used from within OpenCode` is a gate and `.\u002Fscripts\u002Fgate-probe.py` says which one. `not available in your country` is a region block that no header fixes. See [the gates doc](docs\u002Ffree-tier-gates.md#not-a-gate-the-region-block). |\n| `warp` is `degraded` or `starting` in `\u002Fhealthz` | WARP registration failed or is rate-limited. Check `docker logs ofu-engine` for `WARP` and `429`. Outbound UDP 2408 must be allowed. |\n| `FreeUsageLimitError` (429) | Not a gate. The egress block ran out of budget, reset daily at 00:00 UTC. Check `Retry-After`; on the default mode, `\u002Fhealthz` shows the WARP pool and `docker logs ofu-engine` shows exits being retired and re-registered. Raise `warp.pool_size` or `retry.max_attempts`, set a routed IPv6 `\u002F64`, or wait for the reset. See [the quota axis](docs\u002Ffree-tier-gates.md#not-a-gate-the-quota-axis). |\n| `[400] … messages[N].reasoning` on multi-turn chats | Known conversion bug in the upstream engine on reasoning models. It was observed on `cat-jam-free`, which has since been retired off the tier, so the model that triggered it is gone but the class of model is not: `ll-alpha-free` and `beam-free` both reason today. I have not seen this 400 reproduce on them, so treat it as a watch item rather than a known outcome. Pick a non-reasoning model for multi-turn if you can (none currently on the free tier), or disable the reasoning field client-side. `space-bunny-free` was the previous recommendation but is now deprecated upstream. |\n| A reasoning model returns **HTTP 200 with empty content** | The budget went to reasoning, not the answer. This is not a gateway fault — the request succeeded. `big-pickle` spent 55 of 60 tokens on reasoning across 4 of 6 probes and returned nothing; at `max_tokens: 200` it was 0 of 4. `ll-alpha-free` on multi-turn returned 200 with empty content at `max_tokens: 120`, and the correct answer at 300. `beam-free` reasons as well. The reasoning tokens are not hidden: `\u002Fv1\u002Fmessages` returns them as explicit `thinking` blocks and `\u002Fv1\u002Fresponses` reports `incomplete_details`. Raise `max_tokens`, or pick a model with lower reasoning overhead. `space-bunny-free` (which reported `reasoning_tokens: 0`) is now deprecated upstream and no longer on the free tier. |\n| Node restarts in a loop, `bind: address already in use` | Something else holds 8080\u002F8081. The engine uses host networking; free the ports. |\n\n## Legal and terms of service\n\n**Publishing this repository is fine. Operating it is where the risk lives.**\nThe two are separate questions, and the second one is not about licences.\n\n### Licences — verified compatible\n`MIT` for this repository's own files. The engine\n(`ghcr.io\u002Fjasonxu114514\u002Fopencode2api`, **GPL-3.0**) is *not* redistributed\nhere, only referenced as a public container image, so no GPL obligation attaches\nto these files. `stack\u002Fwarp\u002F` (legacy external pool) is MIT code from\n`alztrk\u002Fopencode-ip-rotator` with its licence text preserved. `tinyproxy`\n(GPL-2.0) is installed from Alpine at build time, not redistributed. See\n[`NOTICE`](NOTICE).\n\nUsing the name \"opencode\" is nominative, to state compatibility. No affiliation\nwith or endorsement by OpenCode is claimed or implied.\n\n### Cloudflare WARP — read this before running the default pool\nThe default egress is Cloudflare WARP. The engine implements the tunnel itself\n(userspace WireGuard, no TUN), but the traffic still leaves through Cloudflare's\nconsumer network under the [Cloudflare Application Terms of\nService](https:\u002F\u002Fwww.cloudflare.com\u002Fapplication\u002Fterms\u002F), and those terms say\nthings that matter here:\n\n> **§3 — VPN Profile**: \"the Application operates similarly to a VPN product or\n> service, **the Application is not designed to hide your identity** from the\n> Internet properties you access from your device.\"\n\n> **§2 — Scope of License**: use is licensed \"on the device for which it is\n> provided and that you own or control\", is non-transferable, and must not\n> \"create derivative works\".\n\n> **§6 — User Responsibilities**: \"Cloudflare may not be used to **misrepresent**\n> or to act on behalf of others\", and must not \"create an **undue burden** on the\n> Application or the networks\". A complaint to Cloudflare can result in\n> termination \"without notice\".\n\nRotating egress to appear as several different users is outside what §3 says the\nproduct is for. Running several exits against the consumer service sits outside\nthe \"one device you control\" model in §2. Neither is clearly permitted, and\nneither is clearly forbidden — that is the honest reading.\n\nWhat this means in practice: the account can be closed, usage can be limited or\nblocked, and complaints go to a dedicated abuse mailbox\n(`warpabuse@cloudflare.com`). Cloudflare's liability for consumer products is\ncapped, and disputes go to arbitration. A breach of terms is a contract matter,\nnot a criminal one — and publishing this repository is not the breach; running it\nis.\n\nBecause of that, **the WARP terms are never accepted for you**: `config-init`\nrefuses to seed the config unless you set `WARP_ACCEPT_TOS=1` in `stack\u002F.env`,\nwhich is an explicit act of yours. The legacy external nodes enforce the same\ngate.\n\n### The alternative that sidesteps all of it\nThis bundle makes no assumption about where the proxies come from. `config.json`\ntakes any HTTP\u002FSOCKS proxy list. If you have your own egress — a residential\npool, a datacentre fleet, a company gateway — use that and start only\n`docker compose up -d config-init opencode-engine`. Cloudflare's terms then have\nno bearing on your setup, and neither do their rotators' limits.\n\n### OpenCode's own terms\n\n**Not verified here, and this is a real contract question.** OpenCode's terms for\nthe free tier have not been read or checked for this repository, and the honest\nanswer is that only you can decide whether your use complies.\n\nThe distinction this repository draws, so that the reasoning is at least visible\nrather than hidden in the implementation:\n\n| What the bundle does | What it deliberately does not do |\n|---|---|\n| Makes a gateway send the request shape the official client sends, so it is treated as one | Does not forge, replay or otherwise abuse a paid entitlement |\n| Publishes the exact conditions, with a probe that can falsify them | Does not obscure that the point of those conditions is to refuse non-official callers |\n| Ships a pool of distinct egress addresses | Does not pretend those addresses are anything other than what they are |\n\nThe second row is the awkward one and deserves to be said plainly: **the reason\nthe free tier refuses third-party callers is that it is meant for the official\nclient.** Working around that refusal is the whole function of this bundle. Some\noperators in this ecosystem draw the line there — one maintainer declined to help\nwith an essentially identical problem on the grounds that it breaches Anomaly's\nterms. That is a reasonable position and you may hold it too.\n\nThe egress pool is a second, separate question. Quota is *believed* to be\nbucketed per source address (see the quota axis section — inferred, not measured),\nwhich is why several addresses mean more headroom. If it is not, the pool adds\nnothing on that axis and you are left with the request-shape workaround alone.\n\n**Decide for yourself, at the scale you intend to run.** A local single-user\ngateway is a different proposition from a hosted service with many users, and the\nline between them is not one this repository can draw for you.\n\n---\n\n## Known limitations\n\n- The quota is per egress block (`\u002F64` IPv6, `\u002F32` IPv4), reset daily at\n  00:00 UTC. More distinct blocks means more budget, never unlimited budget.\n- Cloudflare's WARP IPv4 egress is one shared NAT address. Without a routed\n  IPv6 `\u002F64`, every exit competes for the same exhausted bucket. That is why\n  `WARP_SOURCE_IPV6` is the recommended path, not an optional extra.\n- WARP exits are shared and not all fresh. A newly registered exit can already\n  be at its daily limit; the engine rotates on `429`\u002F`403`, so a request may\n  take a few attempts and some seconds before it lands on headroom.\n- WARP is a shared consumer network: exits can repeat, be geolocated\n  unexpectedly, or be blocked outright.\n- `config-init` overwrites the engine config in the volume on every `up`.\n  Local edits made through the dashboard are lost on the next `up -d`.\n- The legacy external pool (`warp.enabled: false`) still builds two images and\n  needs privileged containers and `\u002Fdev\u002Fnet\u002Ftun`. `stack\u002Fwarp\u002F` is third-party\n  MIT code; see `NOTICE`.\n\n## Repository layout\n\n```\nstack\u002F\n  docker-compose.yml     generated — do not hand-edit\n  config.json            engine config + WARP pool\n  generate-compose.py    compose generator (engine-WARP and legacy modes)\n  warp\u002F                  legacy external WARP node image (vendored, MIT)\n  tinyproxy\u002F             legacy CONNECT proxy image + drain gate\n  dedupe\u002F                legacy address de-duplicator\nscripts\u002Fsmoke.sh         one-command verification (needs the stack running)\nscripts\u002Fgate-probe.py    isolates each upstream gate; needs no stack running\ntests\u002F                   unit tests, standard library only\ndocs\u002Ffree-tier-gates.md  the four upstream gates, plus the quota axis\ndocs\u002Fgate-timeline.md    dated record of the gates moving, and what it cost\nNOTICE                   third-party attribution\n```\n\n## Development\n\n```bash\npython3 -m unittest discover -s tests -v   # 140 tests, no dependencies, no stack\n```\n\nThe tests cover the pool generator, the de-duplicator's decision logic, and the\nshipped configuration — the three places where a silent mistake costs you a pool\nor exposes something you did not mean to. None of them need Docker, network, or\na running stack.\n\nContributions are welcome; [`CONTRIBUTING.md`](CONTRIBUTING.md) explains the\nconventions and, more importantly, how to tell a measured claim from an inferred\none. [`SECURITY.md`](SECURITY.md) covers the threat model, which is short: this\nis a local single-user gateway and both listeners bind loopback by default.\n\nCI runs the tests, byte-compiles every Python file, parses and shellchecks every\nshell script, validates the compose file, and asserts that `docker-compose.yml`\nstill matches what `generate-compose.py` generates. That last check is why the\ngenerated file is safe to commit: a hand edit fails CI instead of failing on\nyour machine later.\n\nTwo conventions worth knowing before a first patch:\n\n- **`stack\u002Fdocker-compose.yml` is generated.** Change `stack\u002Fgenerate-compose.py`\n  and re-run it. Editing the compose file directly is caught by CI.\n- **A drain writes the address into its marker.** `ofu-dedupe` cannot measure a\n  drained node — stopping its proxy is what draining means — so the marker is the\n  only surviving record of what that node was holding, and therefore the only\n  way the arbiter can notice the address has become free and bring it back. If\n  you touch drain logic, keep that invariant.\n\n## Licenses\n\nThis repository's own files: **MIT** (`LICENSE`).\nVendored\u002Fthird-party: see `NOTICE` — notably `stack\u002Fwarp\u002F` (MIT, © alztrk) and\nthe engine image `ghcr.io\u002Fjasonxu114514\u002Fopencode2api` (**GPL-3.0**).\n","这是一个自托管的零成本 OpenAI 兼容网关，专为绕过 OpenCode 免费层的 403 FreeTierError 限制而设计。核心功能包括自动轮换 Cloudflare WARP 出口 IP、去重 IP 池管理、无需 API 密钥即可转发请求，并提供本地 HTTP 接口（\u002Fv1）与 Web 管理面板。技术上基于 Python 实现，依赖 Docker 和 WARP 隧道，利用 IPv6 \u002F64 前缀实现多出口隔离以规避单 IP 配额限制。适用于个人开发者或小团队在本地环境中免费调用 OpenCode Zen 模型，尤其适合原型验证、自动化脚本及低频但需稳定响应的 LLM 集成场景。",2,"2026-11-24 04:40:40","CREATED_QUERY"]