Your Private, 100% On-Device AI Persona Hub.
Built for the Google Chrome Built-in AI Challenge 2025.
https://swa-ai.vercel.app/ | Link to Demo Video
Note: This demo will ONLY work in a compatible browser (like Chrome Canary) with the required flags enabled. Please see the "How to Test" section below for instructions.
We love the power of modern AI, but we often feel frustrated by the "one-size-fits-all" nature of large cloud models. Every new chat starts from zero, forcing us to re-explain our custom instructions, roles, and context. This "generic AI fatigue" is inefficient and time-consuming.
Furthermore, sending sensitive data—like personal journal entries, private code, or speech practice—to a server just isn't an option for many users.
The Chrome Built-in AI Challenge presented a perfect opportunity. We saw a future where AI isn't just a service you access, but a personal tool you own. Swa-AI (स्व) was born from this vision: to create a truly private, fast, and highly specialized AI hub that adapts to you, not the other way around. We wanted to build an AI that remembers your needs, lives entirely on your device, and works for you, for free, forever.
Modern cloud-based AI models are powerful but come with trade-offs:
- Privacy: Your data is sent to a server for processing.
- Cost: API calls are expensive.
- Connectivity: They require a constant internet connection.
- Context: They are "one-size-fits-all," forcing you to re-explain context and instructions (like persona, tone, and format) in every new chat.
Swa-AI (from the Sanskrit "स्व" meaning "one's own self") is a 100% client-side AI platform. It leverages the built-in Chrome LanguageModel API (powered by Gemini Nano) to provide a completely private, offline-first, and zero-cost AI experience.
The core feature is the Persona Hub: you can create, save, and reuse persistent, specialist AI personas tailored to your exact needs.
``
This project uses experimental Chrome APIs. To run it, you must use a compatible browser and enable specific flags.
- Get Browser: Download and install Chrome Canary (or a recent Beta/Dev build).
- Enable Flags: Copy/paste each URL into your browser's address bar, set the flag to Enabled, and relaunch after enabling all three.
chrome://flags/#prompt-api-for-gemini-nanochrome://flags/#optimization-guide-on-device-model(Select "Enabled Bypass...")chrome://flags/#prompt-api-for-gemini-nano-multimodal-input(Required for Speech Coach)
- Visit Demo: Go to the Live Demo Link using your configured Chrome Canary.
- Model Download: The first time you visit a chat page, the app will show a "Download Model" button. This requires a user click. The on-device model will download in the background (progress is visible at
chrome://on-device-internals). - Hardware Requirements:
- Text Features: Should work on most systems meeting the base requirements (e.g., 8GB RAM).
- Multimodal (Speech Coach): This feature requires significant resources. It will only work on systems with a GPU (>4GB VRAM) or 16GB+ RAM for CPU fallback. On other systems, it will gracefully display a "capability not available" error.
If you want to run this project on your local machine:
-
Clone the Repository:
git clone https://github.com/kaushik0010/Swa-AI.git cd Swa-AI -
Install Dependencies:
npm install
-
Configure Browser (Crucial):
- Follow the "How to Test" steps above to enable all three required flags in
chrome://flagsin your Chrome Canary browser.
- Follow the "How to Test" steps above to enable all three required flags in
-
Run the Development Server:
npm run dev
-
Access the App:
- Open the
http://localhost:5173URL (or as specified in your terminal) in your configured Chrome Canary browser.
- Open the
-
Testing the Image Analyst:
- Create the "Image Analyst" persona (see Prompt Writer demo).
- Navigate to the "Image Analyst" chat.
- Click the
+button and upload the test image located at:/demo-assets/test-image.jpg - Ask a question, such as: "What is this animal?"
- 100% Private: All AI processing and data storage (chats, personas) happen and stay in your browser.
- Zero Cost & Offline: Runs entirely on-device, requiring no API keys or internet connection after the initial model download.
- Persistent Persona Hub: Create, save, and delete custom AI personas stored in your browser's
localStorage. - Chat History: All conversations are saved locally and grouped by persona.
- Automatic Chat Titles: New text chats are automatically titled by the AI for easy reference.
- Pre-built Personas:
- StoryWeaver: A creative collaborator for brainstorming and writing stories, complete with title suggestions.
- Prompt Writer: An expert assistant to help you engineer better, more effective prompts.
- Speech Coach (Multimodal): Analyzes your speech using live audio + video snapshots to give feedback on tone, clarity, and visual cues (requires a capable system).
- In-Chat Media Upload: Attach images or audio files directly into chats for multimodal queries (works with Image Analyst, etc.).
- Rewrite Functionality: Click the rewrite icon on any AI response (text personas only) to get a revised version based on your instructions (e.g., "make this shorter").
- Browser API: Chrome Built-in AI (
LanguageModelAPI / Gemini Nano) - Framework: React (Vite) + TypeScript
- UI: TailwindCSS +
shadcn/ui(Dialog, Sonner, Select, etc.) - Media:
react-media-recorder(for live capture) - State & Storage: React Hooks (
useState,useCallback) &localStorage - Validation:
zod - Deployment: Vercel
- Implement the "Analyze Uploaded Video" feature for the Speech Coach.
- Allow editing of custom-created personas.
- Add a dedicated
Rewriter APIpersona. - Explore
session.append()for even longer conversational context.
- [Kaushik Paykoli]
- github.com/kaushik0010