gianni-dalerta
b2ac1dc0cd
Add API key authentication system (Telegram-style)
...
Auth features:
- Token generation with ocv_ prefix
- Rate limiting per minute
- Monthly minute quotas
- Usage tracking
- Key revocation
- Pricing tiers: free (60min), pro (500min), enterprise (unlimited)
API endpoints:
- POST /api/keys - Create new API key (requires master key)
- GET /api/usage - Check usage stats
WebSocket auth:
- Pass api_key as query param or x-api-key header
- Error codes: 4001 (key required), 4002 (invalid), 4003 (rate limited)
Client updates:
- Reads API key from URL params or localStorage
- Shows auth errors clearly
Tests: 25 passing (12 new auth tests)
2026-01-30 13:39:19 -05:00
gianni-dalerta
409173a510
Add comprehensive test suite
...
Unit tests (13):
- WhisperSTT: init, transcribe silence, transcribe noise
- ChatterboxTTS: init, synthesize
- AIBackend: init, system prompt, clear history, chat (live API)
- VAD: init, is_speech
- Integration: STT→TTS round trip
Server tests (5):
- HTTP index page loads
- WebSocket connect, ping/pong
- Start/stop listening cycle
- Audio flow with transcript
All tests pass with faster-whisper on CPU.
Python 3.12 required (faster-whisper not yet on 3.14).
2026-01-30 13:35:47 -05:00