CodexRiver - a small OpenAI-compatible gateway in pure Elixir/OTP

Hi everyone!

This is my first public Elixir repo, so I’d really appreciate any feedback.

The background: I have a Codex subscription that I wanted to reuse across different tools — both my own scripts and third-party apps. The main obstacle was always the same: most of those tools just want to point at an OpenAI-compatible endpoint with an API key, and there was no clean way to put my Codex subscription behind one.

CodexRiver is my answer to that. It’s a standalone Elixir/OTP application that speaks the OpenAI API and delegates generation to a local codex app-server process. A few design choices I ended up liking:

  • No frontend and no web framework — HTTP/1.1 is served directly over :gen_tcp.
  • Routes: GET /health, GET /v1/models, POST /v1/chat/completions (JSON, SSE streaming, and function tools), and POST /v1/responses.
  • Auth is by bearer token. Each API key gets its own supervised client and its own codex app-server process, and every request starts a fresh ephemeral thread — so different keys can’t share hidden Codex context, and requests don’t leak into your Codex history. The raw key is never used as a process name or written to logs.
  • It ships as a single-file Burrito executable (macOS/Linux/Windows targets), so the target machine only needs the codex binary and its credentials, not an Elixir toolchain.

Right now I’m using it successfully with Zed (generating PR text, open code review) and natively from the Warp console.

Repo: GitHub - npolevara/river: a pipe from binary to api · GitHub

It’s early (3 commits, zero stars :slightly_smiling_face:), so I’d love comments, critique, and suggestions — especially on the raw :gen_tcp HTTP handling and the per-key supervision/isolation design. Happy to answer any questions!