Skip to main content

Module proxy

Module proxy 

Source
Expand description

LLM reverse proxy — the core of the Gateway pillar.

Intercepts Anthropic, OpenAI, Gemini and ChatGPT traffic, compresses prompts, meters usage, and optionally translates request shapes.

§TLS Requirements

The proxy does NOT terminate TLS. For production/multi-tenant deployments, place behind a TLS-terminating reverse proxy (nginx, caddy, traefik). For mTLS, configure the reverse proxy with client certificates. See: https://github.com/yvgude/lean-ctx/issues/1371

§Org gateway coupling (ADR-023)

The self-hosted org gateway (lean-ctx-enterprise) extends this proxy with admin/usage-store routes. In the OSS build the proxy runs standalone.

Modules§

adaptive_policy
Adaptive compression policy (OSS stub).
anthropic
auto_routing
Legacy model=auto wire types, kept for compatibility only.
bedrock
Amazon Bedrock Runtime request validation and AWS Signature Version 4.
break_even
cache_aligner
Cache-aligner (#940 detect, #974 relocate) — Headroom “cache aligner” port.
cache_attribution
Prompt-cache miss attribution (#986, cache-economics telemetry).
cache_breakpoint
Active prompt-cache breakpoint injection (#939, Headroom “cache aligner” adjacent).
cache_policy
Net-cost policy for cache-busting rewrites (#986, cache-economics).
cache_safety
Cache-preservation telemetry for the proxy’s frozen-region prose rewrites (#710).
ccr
Content-addressed recovery (CCR) for the proxy’s lossy rewrites (#482).
chatgpt
chatgpt_cookies
chatgpt_ws
WebSocket passthrough for ChatGPT’s /backend-api rail (#597).
circuit_breaker
Public deterministic circuit-breaker reference.
cold_prefix
Big-gap cold-prefix repack prediction (#480).
compress
compress_api
POST /v1/compress — deterministic messages-in / messages-out compression.
compress_shared
Provider-neutral classification for content blocks compressed in place.
compression_savings
Input-compression savings from the [proxy] compression_holdout (#1905).
connector_schedule
Connector scheduling through the provider registry — the OCLA scheduler’s half of the universal provider framework. Kept apart from the HTTP routes in providers so builds without http-server schedule connectors too (#586).
cost
Per-model proxy savings accounting.
counterfactual
Counterfactual savings metering (#701) — provider-authoritative receipts.
dedup
Request-local, lossless deduplication of repeated tool output.
determinism_guard
Formal, verifiable prompt-cache safety for proxy request rewrites.
effort
Cache-safe, cross-provider reasoning-effort control (#834).
eligibility
Static eligibility evaluation for the public proxy boundary.
forward
Shared upstream forward path for OpenAI-compatible providers.
google
history_prune
holdout
Deterministic output-savings holdout (#895 Track B).
introspect
live_zone
Live-zone-aware request compression preserves provider-cached prefixes.
metrics
models_api
GET /v1/models — the org’s model catalog, served on the proxy port (enterprise#63).
ocla_cache_bridge
Adapter between proxy request fields and the OCLA response cache.
openai
openai_responses
openai_responses_ws
WebSocket bridge for the OpenAI/Codex Responses transport (#440).
outbound_model_policy
Outbound model policy — the last check on which model a request may reach.
output_savings
Output-token savings reporting (#895 Track B).
pii
Person pseudonymization (enterprise#39, GDPR/DSGVO).
pipeline_bench
End-to-end, deterministic workloads for the proxy compression pipeline.
pre_optimize
prefix_cache_stats
Structured prefix-cache statistics for the /status endpoint.
prefix_replay
Append-only delta detection and forwarded-byte replay for provider prefix cache stability.
prose
Frozen-region prose compression for the proxy (#710).
prose_compress
Markdown-aware normalization and task-relevance filtering.
prose_patterns
Deterministic, loss-conscious compression for repetitive prose.
prose_ranker
Cache-safe wire prose squeeze (#895).
providers
Universal provider routes — the request-path half of the universal-provider-framework (enterprise#7).
quality_lab_api
POST /v1/quality-lab — run Quality Lab analysis on a text pair.
response_optimizer
Response Optimizer (P9 / DIM 2 — Output-Optimierung).
rollout
Public rollout cohort schema and deterministic assignment reference.
routing
Explicit model targets — operator-written aliases in the forward path.
shape_xlat
Cross-shape translation Anthropic ↔ OpenAI (enterprise#16, feature shape-xlat).
sse_keepalive
SSE keepalive injection for proxy-to-client streams.
sticky_tools
Sticky CCR tool injection for provider prefix-cache stability.
tool_kind
Classifies what produced a tool_result so the proxy never lossy-compresses a file/source-code read the model still needs (e.g. mid-refactor).
tool_output
usage
Real provider-reported token usage extraction.
usage_accounting
Measured-cost plumbing: request-side opt-in (#1179) and response-header extraction (#1189).
usage_meter
Measured per-model spend meter.
usage_parity
Proxy-to-kernel provider and usage conversion.
usage_sink
Process-wide usage event sink (enterprise#17).
value_gate_proxy
Per-session value metrics for proxied completions.
verbosity
Cache-safe wire verbosity steer (#895 Track B).
web_app

Structs§

ProviderStats
ProxyState
ProxyStats

Functions§

start_proxy
start_proxy_with_token