How verdgard/intergate works
InterGate is a self-hosted AI API relay and management console. Client requests enter the gateway, which authenticates and routes them through provider-specific upstream forwarding, applying Key selection, rate limits, caching, failover, and usage/quota accounting. Operators use the Web console to manage Keys, settings, models, and logs; scheduled synchronization refreshes model data, while SQLite preserves operational state. The README documents several capabilities whose implementation was not sampled; those branches are represented at their documented module paths, with uncertain internal wiring omitted.
Main entry points: gateway.py API gateway · database.py SQLite store · webapp.py Web management API · main.py Runtime coordinator
Components 23
Entry points
- API gateway
gateway.py - Web management API
webapp.py - Web console
web/index.html - Runtime coordinator
main.py
Request routing
- Provider routing
providers/registry.py - Upstream forwarding
providers/upstream.py - Key load balancing
services/load_balancer.py - Response cache
services/cache.py - Rate limiting
services/rate_limiter.py
Management
- Key lifecycle
services/key_manager.py - Key encryption
crypto/aes.py - Model synchronization
services/sync.py - Model records
db/database.py - Runtime settings
config/settings.py
Persistent state
- SQLite store
db/database.py - Request logs
models/request_log.py
Usage and operations
- Quota monitoring
services/quota.py - Usage accounting
services/usage.py - Health and metrics
services/health.py - Alert delivery
services/webhook.py
Other components
- AI client
- Operator browser
- AI providers
Connections 28
- AI client → API gateway: sends API requests
- Operator browser → Web console: opens console
- Web console → Web management API: calls management API
- Runtime coordinator → API gateway: starts server
- Runtime coordinator → Web management API: starts server
- Runtime coordinator → Model synchronization: schedules sync
- Runtime coordinator → SQLite store: prunes logs
- API gateway → Provider routing: identifies provider
- API gateway → Key load balancing: selects Key
- API gateway → Key lifecycle: loads Key state
- API gateway → Rate limiting: checks limits
- API gateway → Response cache: checks response cache
- API gateway → Upstream forwarding: forwards request
- Upstream forwarding → AI providers: sends API request
- API gateway → Quota monitoring: records quota usage
- API gateway → Usage accounting: records usage
- API gateway → SQLite store: writes request data
- Web management API → Key lifecycle: manages Keys
- Web management API → Runtime settings: updates settings
- Web management API → SQLite store: reads management data
- Key lifecycle → Key encryption: encrypts and decrypts
- Key lifecycle → SQLite store: loads and saves Keys
- Model synchronization → Upstream forwarding: fetches model data
- Model synchronization → SQLite store: stores model cache
- SQLite store → Model records: stores model records
- SQLite store → Request logs: stores request records
- Quota monitoring → Alert delivery: sends alerts
- Health and metrics → SQLite store: reads operational data