mirror of
https://github.com/jasonxu114514/opencode2api.git
synced 2026-12-05 16:04:01 +00:00
Both official OpenCode clients (1.x and 2.x) run on Bun, but the gateway reached /zen and /inference through net/http, whose Go ClientHello, HTTP/2 and header layout no Bun client produces. - Add httpx.BunTransport: Bun 1.4.3's BoringSSL ClientHello via uTLS (JA4 t13d1713h1, X25519MLKEM768, http/1.1-only ALPN), HTTP/1.1 with Bun fetch's header order and spelling, and gzip/deflate/br/zstd decoding that streams SSE incrementally. - Support direct, HTTP/HTTPS CONNECT and SOCKS5 proxies with auth; proxy failures keep the net/http proxyconnect / socks connect shape so proxy health classification is unchanged. - Pool idle connections per host, drop ones the server closes while idle, and retry once when a reused connection is dropped before the first response byte. - Route only free-model traffic on the /zen and /inference lanes (anonymous, Zen key and availability probes) through it; /zen/go, paid models and metadata requests keep the regular client.