The problem
The dominant AI text-tool apps charge $8 to $30 per month, lock you into one provider, cap usage per tier, and process every request through their server — which means they hold a copy of every prompt and every output. The technically savvy user already has an OpenAI / Anthropic / Gemini API key and would happily pay a one-time fee for an app that just talks to those APIs directly from their phone, without inserting an intermediate server. The non-savvy user wants the same convenience as the cloud apps. We wanted one app that serves both, with the user's API key never leaving the device.
How we built it
- 01Built every API client (`openai_client.dart`, `anthropic_client.dart`, `gemini_client.dart`) behind a single pure-Dart `AiClient` interface and let the user runtime-switch providers. The high-level `ai_tools_service.dart` calls one tool method, which dispatches to whichever client the user picked.
- 02Stored API keys in `flutter_secure_storage` (encrypted, on-device only) and validated each one against its provider on save. No key ever crosses the network except in the user's own request to OpenAI / Anthropic / Google. There is no server to trust because there is no server.
- 03Shipped four tools — Summarizer, Rewriter (6 tones), Translator (15 languages), Grammar Checker — over the same UI shell. Each tool screen has per-tool loading state (no cross-tab interference), text stats (chars / words / tokens) on the input, and a cost estimator that shows the per-request cost for the chosen provider before the user submits.
- 04Wrote a `history_service.dart` that persists every result with corrupt-entry resilience (one bad JSON row does not blow up the history), a `usage_service.dart` for per-tool counts, and a paywall that gates BYOK ($4.99 one-time, user's own key, no ads) vs. Pro ($5.99 / mo, API provided by us, premium models). Free tier subsidises 5 uses / day so the curious user can try every tool before deciding.
- 05Wired the full release surface — RevenueCat entitlement service, AdMob banner ads (test IDs), Material 3 light + dark with `SafeArea` on every screen, store listing copy, privacy policy, release notes, splash + icon configs — so swapping the placeholder credentials for production keys is the entire remaining task.
Outcome
All work packages complete: 102 of 102 tests passing, zero analyzer issues, four tools live across three providers, secure key storage, per-tool loading, history with resilience, cost estimator, paywall with BYOK + Pro tiers, AdMob banner integration, full Material 3 theming, store-submission docs ready. Namespace `com.ninetyninersstudio.ai_wrapper`. The remaining work is human-only: app icon assets, Firebase + `google-services.json`, RevenueCat production keys, AdMob production ad-unit IDs, signing keystore, Play Console upload.
Stack
Flutter 3.x · Dart · Provider (`ChangeNotifier`) for state · `dio` for HTTP with timeouts · `flutter_secure_storage` for encrypted on-device key storage · `share_plus` for output share · `purchases_flutter` (RevenueCat) for entitlements · `google_mobile_ads` for the banner · 5-tab `IndexedStack` bottom nav · pure-Dart per-provider clients behind one `AiClient` interface.
Next up
Asset creation (icon set + screenshots), Firebase project provisioning, RevenueCat + AdMob production credential swap, signing keystore generation, then submission. Future: Phase 5 expansion with code-explainer, email-tone matcher, and meeting-summary tools — each one is an additional `AiTool` enum + a screen + a prompt template.
More case studies
- GamesPoker Platform
Multi-table online poker with real-money-capable risk review, admin tooling, and webhook fan-out.
- Mobile AppsMieter App
German tenant-rights companion. 8-city Mietspiegel, Mietpreischeck, Nebenkostenprüfung, PDF export.
- Web ToolsSEOMAX
Self-hosted SEO intelligence platform. 77 endpoints, DataForSEO-powered, Docker-deployable.