How bookang869/plexon works
Plexon is a FastAPI LLM gateway: team clients submit OpenAI-compatible chat requests, which are authenticated, rate- and budget-checked, enriched, routed to a provider, and returned with spend reconciliation. Operators also manage teams and limits. README capabilities include streaming, fallback and circuit breaking, health checks, hot configuration, and observability. The graph includes those documented branches; unsampled implementation links are omitted or marked unverified. External telemetry destinations are shown only where the README identifies them.
Main entry points: gateway/routes.py Chat API · loader.py Gateway configuration · orchestrator.py Retry and fallback · admin/routes.py Admin API
Components 29
Request gateway
- Chat API
gateway/routes.py - Team authentication
gateway/auth/team_auth.py - Chat schemas
gateway/schemas.py - Request enrichment
gateway/enrichment/enrich.py - Content filtering
gateway/enrichment/content_filter.py - Streaming delivery
gateway/streaming.py
Provider execution
- Provider selection
gateway/providers/registry.py - Provider adapters
gateway/providers - Retry and fallback
gateway/resilience/orchestrator.py - Circuit breaker
gateway/resilience/circuit_breaker.py - Fallback chains
gateway/resilience/fallback.py - Provider health checks
gateway/resilience/health_check.py
State and policy
- Rate limiting
gateway/ratelimit/limiter.py - Token bucket
gateway/ratelimit/token_bucket.py - Budget enforcement
gateway/ratelimit/budget.py - Redis state
gateway/redis_client.py - PostgreSQL pool
gateway/db.py - Gateway configuration
gateway/config/loader.py
Administration
- Admin authentication
gateway/auth/admin_auth.py - Admin API
gateway/admin/routes.py
Observability
- Tracing
gateway/observability/tracing.py - Metrics
gateway/observability/metrics.py - Alert evaluation
gateway/observability/alert_evaluator.py - Alert delivery
gateway/observability/alerts.py - Tempo
- Prometheus
- Slack
Other components
- Team client
- Operator
Connections 38
- Team client → Chat API: submits request
- Chat API → Team authentication: authenticates via
gateway/routes.py - Team authentication → PostgreSQL pool: looks up key
gateway/auth/team_auth.py - Chat API → Rate limiting: checks limits
gateway/routes.py - Rate limiting → Token bucket: consumes tokens
gateway/ratelimit/limiter.py - Rate limiting → Redis state: uses state
gateway/ratelimit/limiter.py - Chat API → Budget enforcement: checks and records spend
gateway/routes.py - Budget enforcement → Redis state: reads and updates
gateway/ratelimit/budget.py - Budget enforcement → PostgreSQL pool: writes ledger
gateway/ratelimit/budget.py - Chat API → Request enrichment: enriches request
gateway/routes.py - Request enrichment → Content filtering: applies rules
gateway/enrichment/enrich.py - Chat API → Provider selection: resolves provider
gateway/routes.py - Provider selection → Provider adapters: selects adapter
gateway/providers/registry.py - Chat API → Retry and fallback: dispatches call
gateway/routes.py - Retry and fallback → Circuit breaker: checks and records
gateway/resilience/orchestrator.py - Retry and fallback → Fallback chains: resolves candidates
gateway/resilience/orchestrator.py - Retry and fallback → Provider adapters: attempts provider
gateway/resilience/orchestrator.py - Chat API → Streaming delivery: delivers stream
gateway/routes.py - Chat API → Chat schemas: accepts and returns
gateway/routes.py - Gateway configuration → Provider selection: configures providers
gateway/providers/registry.py - Retry and fallback → Gateway configuration: uses policy
gateway/resilience/orchestrator.py - Rate limiting → Gateway configuration: reads tier settings
gateway/ratelimit/limiter.py - Request enrichment → Gateway configuration: reads defaults
- Provider health checks → Provider adapters: checks health
gateway/resilience/health_check.py - Provider health checks → Redis state: stores status
gateway/resilience/health_check.py - Operator → Admin API: manages gateway
- Admin API → Admin authentication: authenticates via
gateway/admin/routes.py - Admin API → PostgreSQL pool: reads and updates
gateway/admin/routes.py - Admin API → Redis state: checks live limits
gateway/admin/routes.py - Admin API → Gateway configuration: reloads settings
gateway/admin/routes.py - Chat API → Tracing: records spans
gateway/routes.py - Chat API → Metrics: records metrics
gateway/routes.py - Alert evaluation → Gateway configuration: reads thresholds
gateway/observability/alert_evaluator.py - Alert evaluation → Alert delivery: sends alerts
gateway/observability/alert_evaluator.py - Budget enforcement → Alert delivery: sends budget warning
gateway/ratelimit/budget.py - Tracing → Tempo: exports traces
- Prometheus → Metrics: scrapes endpoint
- Alert delivery → Slack: notifies