Expand description
Self-hosted org gateway run-mode (gateway-server feature).
Bundles the proxy (remote bind, enterprise#8), the per-request usage store
(Postgres usage_events, enterprise#17/#18) and — in later waves — the
admin usage API (enterprise#20) into one deployable server.
LOCAL_OPTIONAL by classification (server_capabilities.rs): compiled in or
out, never gated by account/license/plan — an org can self-host its gateway
with cargo build --features gateway-server and full functionality
(Local-Free Invariant; commercial enforcement lives in lean-ctx-enterprise).
Fail-open is the design rule (enterprise#12): the store subscribes to the
usage stream through proxy::usage_sink and persists asynchronously; a slow
or down Postgres degrades metering, never live LLM traffic.
Modules§
- admin_
api - Admin usage API (enterprise#20) — the self-hosted gateway’s spend/savings
breakdown, straight from
usage_events(Doc 08 §3.3). - admin_
status GET /api/admin/status(enterprise#46) — the gateway’s live health/config card for the admin dashboard.- admin_
timeseries GET /api/admin/timeseries(enterprise#46) — per-day usage/savings series for the admin dashboard’s trend charts.- admin_
ui - Embedded admin dashboard (enterprise#45) — the org monitoring console served from the gateway’s admin port.
- doctor
lean-ctx gateway doctor(enterprise#49) — go-live preflight.- evidence
- Signed usage-evidence export (enterprise#36, EU-AI-Act evidence trail).
- init
lean-ctx gateway init(enterprise#47) — plug-and-play gateway setup.- keys_
cli lean-ctx gateway keys(enterprise#48) — per-person key management forgateway-keys.toml, replacing the manualopenssl rand | shasumdance.- report
lean-ctx gateway report(enterprise#50) — the printable CTO/value report.- security
- Admin-port security hardening (#54): response headers + auth throttling.
- serve
lean-ctx gateway serve(enterprise#10) — the self-hosted org gateway.- store
usage_eventsPostgres store (enterprise#17, baseline fields enterprise#18).- user_
api - Personal usage view (
/me, enterprise#64) — served on the proxy port, authenticated by the caller’s own gateway key.