Oko/Docs

Command reference

oko proxy serve

The local Brama proxy: a listener on this machine's loopback address that a harness talks to as if it were a model provider. Each request must present the listener's capability token as Authorization: Bearer or x-api-key; the proxy relays /v1/chat/completions, /v1/messages, /v1/responses and GET /v1/models to Brama with Oko's bearer and body-bound signature, and Brama's streams, tool events, usage and refusals come back byte for byte.

Invocation#

Command
oko proxy serve [--port N] [--router URL]

Inputs and options#

  • --port, an ephemeral one when omitted; --router overrides the origin Stado resolves.

Output and state effect#

  • Prints `proxy listening on http://<loopback>:<port>/v1/chat/completions`, `<loopback>` being the loopback address it bound, and serves until stopped.
  • A streamed reply is relayed as chunks while it arrives. When Brama's reply breaks off mid-stream the caller is not sent the final chunk, so it reads a broken reply rather than a shorter complete one, and the proxy's stderr says `oko proxy: the upstream reply broke off: <error>; the caller is not sent the final chunk, so it reads the reply as broken`. A caller that stops reading is named the same way: `oko proxy: the caller was not sent <part>: <error>`. The real journey `tests/proxy/relay.rs` runs the built proxy with `--router` pointed at a loopback peer that breaks off after its first chunk, and at one that ends its body, and reads what the caller is left with.
  • A request's body is framed by its headers, never by its method: `Content-Length` names its length and a request carrying no framing header has no body.

Refusals and safe exits#

  • `invalid --port <text>`; `the local Brama proxy cannot listen on <loopback>:<port>: <error>`; the reach refusals of `oko gateway check`.
  • A request is answered 400 with `a request body sent with Transfer-Encoding <coding> is not read; send Content-Length`, `Content-Length "<text>" is not a byte count: <error>`, or `connection closed after <n> of the <length> body bytes Content-Length named`.

CLI reference#