- Added API key authentication via
X-API-KeyorAuthorization: Bearer <key>. - Protected sensitive endpoints:
POST /api/v1/generateGET /api/v1/userGET /api/v1/memory- provider listing and config endpoints.
- Added proper authentication error handling:
401for missing credentials.403for invalid credentials.
- Added async rate-limiting middleware.
- Enforces per-client quotas using token-bucket logic.
- Supports optional Redis-backed counters when
REDIS_URLis configured. - Returns
429withRetry-Afterheader when quota is exceeded.
- Implemented provider instance registry.
- Tracks text and image provider clients created during request processing.
- Added graceful async cleanup during app shutdown.
- Implemented rate limiter shutdown cleanup for Redis connections.
- Standardized language detection on
fast-langdetect. - Added robust fallback path for restricted networks or model download failures.
- Added offline heuristic fallback (Arabic vs English baseline) to prevent crashes.
- Updated
.env.examplewith auth, rate-limit, Redis, and version settings. - Added
redisdependency for optional distributed rate limiting. - Removed legacy README guidance for
langdetect; now referencesfast-langdetectonly. - Added graceful warnings for missing provider API keys and missing auth key configuration.
- Added automated tests for:
- Health endpoint (
/api/health). - Config loading without provider keys.
- Language detection fallback behavior.
- Generate endpoint validation and auth enforcement.
- Health endpoint (
- Bumped application version from
1.0.0to1.1.0in runtime configuration and API metadata.