Problem
The app currently only supports Google Gemini Flash Lite (gemini-flash-lite-latest) for AI-powered browser classification (GeminiClient.kt, line 52). This creates a single point of failure:
- If Gemini is down or rate-limited, detection falls back to the hardcoded browser list (
BrowserDatabase.kt — 52 known packages)
- Users must have a Gemini API key, which requires a Google account and enabling billing
- No alternative providers for users who prefer different services or face regional restrictions
Proposed Solution
Add support for multiple AI service providers, prioritizing free-tier or low-cost options with free model access, then build a unified UI for provider/model selection.
Candidate Providers
| Provider |
Free Tier |
Notes |
| Groq |
Yes (Llama 3 / Mixtral) |
Very fast inference, free tier available |
| OpenRouter |
Varies |
Single API key gateway to many models |
| Together AI |
Free credits |
Multiple open-source models |
| Hugging Face Inference |
Free tier |
Community models |
| OpenAI |
No |
GPT-4o mini, reliable |
Architecture Requirements
- Abstract
AiService interface: Common contract (classifyApp(packageName, metadata): ClassificationResult) so the rest of the app (BrowserDetector.kt, LogsScreen.kt) is provider-agnostic
- Per-provider adapter: Each provider implements the interface with its own API client, prompt format, and error handling
- Fallback chain: Try primary provider first; if it fails, fall through to secondary, then tertiary, then local list
- Provider status tracking: Per-provider daily quota tracking (currently only Gemini has
SettingsManager.tryUseGeminiApi() with a 20/day limit)
UI Requirements
- Provider selection screen: New section in Settings to add/configure providers
- Model picker: Per-provider model selection dropdown
- API key management: Per-provider key input with masked fields (similar to current Gemini key input at
SettingsScreen.kt lines 67-97)
- Active provider ordering: Drag-to-reorder priority list
- Status indicators: Show which providers are configured, which are reachable
Problem
The app currently only supports Google Gemini Flash Lite (
gemini-flash-lite-latest) for AI-powered browser classification (GeminiClient.kt, line 52). This creates a single point of failure:BrowserDatabase.kt— 52 known packages)Proposed Solution
Add support for multiple AI service providers, prioritizing free-tier or low-cost options with free model access, then build a unified UI for provider/model selection.
Candidate Providers
Architecture Requirements
AiServiceinterface: Common contract (classifyApp(packageName, metadata): ClassificationResult) so the rest of the app (BrowserDetector.kt,LogsScreen.kt) is provider-agnosticSettingsManager.tryUseGeminiApi()with a 20/day limit)UI Requirements
SettingsScreen.ktlines 67-97)