Router & gateway
The router/gateway pair is OGONG’s marketplace match layer. The router maintains a
registry of providers and answers match queries; the gateway is the OpenAI-compatible
HTTP front door consumers actually call. Both are standalone QUIC binaries in
ogong-router-service with no GUI and no on-chain dependency for pure matching.
Build
cargo build --release -p ogong-router-service --bin ogong-routerd --bin ogong-gatewayd
Router - ogong-routerd
The match engine. Providers register themselves (Upsert); consumers (or the gateway) query
(Route) for a provider that can serve a given ogong/<tier>/<maker>/<model>. It starts
with an empty registry and fills as providers register.
ogong-routerd --bind 0.0.0.0:4544 --cert-out router.der
| Flag | Default | Meaning |
|---|---|---|
--bind <addr> | 0.0.0.0:4544 | UDP address for the QUIC endpoint |
--cert-out <path> | - | write the router’s bootstrap cert (DER) so a gateway can pin it |
--relay | off | put the router on the data path (select and forward) |
Match-only vs relay. By default the router only does matching - consumers Route, then
forward the request themselves (this is what ogong-gatewayd does, which lets it read
provider response headers). With --relay the router sits on the hot path and forwards bytes
to the provider’s endpoint itself. Env equivalents: OGONG_ROUTER_CERT_OUT,
OGONG_ROUTER_RELAY.
Gateway - ogong-gatewayd
The consumer front door. Serves an OpenAI-compatible HTTP API, matches each request through the router, and forwards it to the selected provider.
ogong-gatewayd \
--bind 0.0.0.0:4546 \
--router 127.0.0.1:4544 \
--router-cert router.der \
--max-price 1000000
| Flag | Default | Meaning |
|---|---|---|
--bind <addr> | 0.0.0.0:4546 | TCP address for the HTTP API |
--router <addr> | 127.0.0.1:4544 | the router’s QUIC address |
--router-cert <path> | - | router bootstrap cert to pin (from routerd --cert-out) |
--max-price <u64> | u64::MAX | budget ceiling per 1k tokens (atomic OGONG units) |
Env equivalents: OGONG_ROUTER, OGONG_ROUTER_CERT, OGONG_GATEWAY_MAX_PRICE.
End to end
# 1. router (writes its cert)
ogong-routerd --bind 0.0.0.0:4544 --cert-out router.der &
# 2. gateway (pins that cert)
ogong-gatewayd --bind 0.0.0.0:4546 --router 127.0.0.1:4544 --router-cert router.der &
# 3. a provider registers with the router (see Provider node)
# 4. call the gateway with any OpenAI client
curl http://127.0.0.1:4546/v1/chat/completions \
-H 'content-type: application/json' \
-d '{"model":"ogong/verified/<maker>/<model>","messages":[{"role":"user","content":"hi"}]}'
See the Consumer API for the model-id format and endpoints.