How theschoolofai/glc_v2 works
GLC is an LLM and channel gateway. Its primary workflow is an API client request entering the FastAPI app, reaching chat inference and provider selection, then returning a response; channel adapters separately exchange typed messages and replies through the channel endpoints. The repository also exposes transcription and speech, policy and security controls, usage tracking, and multiple channel integrations. Some subsystem wiring is unsampled, so the graph omits uncertain links rather than inferring calls.
Main entry points: main.py FastAPI App · chat.py Chat Routes · channels.py Channel Routes · webhook.py Twilio Webhook
Components 27
Gateway API
- FastAPI App
glc/main.py - Chat Routes
glc/routes/chat.py - Channel Routes
glc/routes/channels.py - Control Routes
glc/routes/control.py - Voice Routes
glc/routes/speak.py - Transcription Route
glc/routes/transcribe.py
LLM Inference
- LLM Providers
glc/providers.py - Provider Routing
glc/routing.py - Embedders
glc/embedders.py - Pricing
glc/pricing.py
Messaging Channels
- Channel Registry
glc/channels/registry.py - Message Envelopes
glc/channels/envelope.py - Channel Adapters
glc/channels/catalogue - Twilio SMS Adapter
glc/channels/catalogue/twilio_sms/adapter.py - Twilio Webhook
glc/channels/catalogue/twilio_sms/webhook.py - Gmail Adapter
glc/channels/catalogue/gmail/adapter.py
Security and State
- Usage Database
glc/db.py - Audit Store
glc/audit/store.py - Cache
glc/cache.py - Configuration
glc/config.py - Policy Engine
glc/policy/engine.py - Pairing Store
glc/security/pairing.py - Request Security
glc/security/allowlists.py
Voice
- Speech Recognition
glc/voice/stt/router.py - STT Provider API
glc/voice/stt/base.py - Speech Synthesis
glc/voice/tts/router.py
Other components
- API Client
Connections 28
- API Client → FastAPI App: requests
README.md - FastAPI App → Chat Routes: mounts route
glc/main.py - FastAPI App → Channel Routes: mounts route
glc/main.py - FastAPI App → Control Routes: mounts route
glc/main.py - FastAPI App → Voice Routes: mounts route
glc/main.py - FastAPI App → Transcription Route: mounts route
glc/main.py - Chat Routes → Provider Routing: selects provider
glc/routes/chat.py - Chat Routes → LLM Providers: invokes inference
glc/routes/chat.py - Chat Routes → Usage Database: logs calls
glc/routes/chat.py - Chat Routes → Embedders: uses embeddings
glc/routes/chat.py - Chat Routes → Pricing: uses pricing
glc/routes/chat.py - Chat Routes → Request Security: guards image fetches
glc/routes/chat.py - Channel Routes → Channel Registry: instantiates adapters
glc/routes/channels.py - Channel Routes → Message Envelopes: exchanges messages
glc/routes/channels.py - Channel Routes → Pairing Store: checks trust
glc/routes/channels.py - Channel Routes → Request Security: checks access
glc/routes/channels.py - Channel Registry → Channel Adapters: loads adapters
glc/channels/catalogue/whatsapp/demo_webhook_server.py - Twilio Webhook → Twilio SMS Adapter: validates inbound
glc/channels/catalogue/twilio_sms/webhook.py - Twilio Webhook → Message Envelopes: parses message
glc/channels/catalogue/twilio_sms/webhook.py - Twilio Webhook → Channel Routes: bridges by WebSocket
- Gmail Adapter → Message Envelopes: creates messages
- FastAPI App → Configuration: loads configuration
glc/main.py - FastAPI App → Policy Engine: loads policy
glc/main.py - FastAPI App → Audit Store: initializes audit
glc/main.py - FastAPI App → Cache: initializes cache
glc/main.py - Transcription Route → Speech Recognition: uses transcription
- Speech Recognition → STT Provider API: routes providers
glc/voice/stt/router.py - Voice Routes → Speech Synthesis: uses synthesis