Skip to content

openrot v0.4.0

Choose a tag to compare

@github-actions github-actions released this 19 Oct 21:45
· 2 commits to main since this release

What's New

Free-tier gateway normalization

Every upstream request is now reshaped into the exact form the free gateway accepts — the same rules as the official opencode client:

  • The four session headers (X-Opencode-Session, X-Opencode-Session-Id, X-Session-Affinity, X-Session-Id) are set to one canonical ses_ id. A client-provided canonical session is kept for prompt-cache affinity; any other value is deterministically re-encoded into a canonical one.
  • Recognized tool names are replaced with their genuine opencode definitions (shipped as package data), and missing core tools (shell, edit, glob, grep, read) are appended — the gateway rejects stubs that merely reuse a recognized name. Unknown client tools pass through untouched.
  • opencode's title-generation system prompt is swapped for a reworded equivalent. The gateway fingerprints the original by its task/rules/examples markers together and answers 403 FreeTierError, so without the swap the first request of every new chat fails. The replacement is idempotent and leaves unrelated system prompts untouched.
  • Chat bodies are forced to streaming with stream_options.include_usage; missing Authorization falls back to Bearer public, missing X-Opencode-Project/X-Opencode-Client are added, and a non-opencode User-Agent is replaced.
  • The legacy X-Opencode-Request header is stripped instead of injected, and the default upstream moved to https://opencode.ai/inference.

Direct mode (no WARP)

New bridge_direct config flag (OPENROT_BRIDGE_DIRECT=1) turns the bridge into a plain pass-through: WARP is not started, requests go upstream from the host's own address, and every request/response is still logged. Useful when you only want to observe opencode's traffic — IP rotation and 429 self-rotation are unavailable in this mode (a usage-limit 429 is treated like any other rate limit: wait out Retry-After and retry).

Full error visibility

Non-200 response bodies are now logged verbatim (quota, validation, ...), and unexpected handler errors produce a JSON 502 to the client plus a full traceback in the log instead of a silent hang. OPENROT_DEBUG_REQ=1 additionally dumps raw request bodies to debug/ for offline diffing.

Docs

README (EN/RU) updated for the gateway contract, direct mode, and the new env override OPENROT_BRIDGE_DIRECT.