AI Studio recreates the playground interface and interaction experience of Google AI Studio as a fully self-hosted web application. You can configure any Gemini or OpenAI-compatible endpoint (custom Base URL, API key, proxy), and all your data is stored in a local embedded SQLite (libsql) database — nothing ever leaves your machine except the requests you send to your own API endpoint.
This project is an unofficial, educational open-source recreation of the Google AI Studio interface, built with Next.js 14. It is for learning and research purposes only — it is not affiliated with, endorsed by, or sponsored by Google, and it involves no commercial interests whatsoever.
- 💬 Streaming (SSE) and non-streaming chat completions
- 🔌 Custom Base URL / API key, switchable protocol (Gemini or OpenAI-compatible), optional HTTP proxy
- 🤖 Model selector with live model listing (append-only sync with the endpoint's catalog — new models are added, known ones never removed), plus custom model registration (custom context window, category, description)
- 💭 Thinking bubbles: readable thought summaries rendered as markdown
- 🔎 Search citations: Google-Search-grounded answers show footnote markers at the cited spans with a collapsible source list
- 📋 Paste-to-attach: paste images / PDF / audio / video / text files straight from the clipboard into the input box
- ✏️ Regenerate a response from any point without affecting later turns
- 🔀 Conversation branching / duplication, context JSON import & export
- 📜 Lazy-loaded history with automatic pagination on scroll-to-top
- 🧠 RAG (Retrieval-Augmented Generation): when the sliding window trims older messages out of the context window, the trimmed messages are embedded into vectors and stored in the local database, then semantically retrieved and re-injected into the request — so the model keeps access to early conversation history that no longer fits the window
- 🔌 Two embedding providers: API (your endpoint's OpenAI-compatible
/v1/embeddingsor Gemini embeddings) or Local (on-device ONNX model via@huggingface/transformers) — the Local provider works even when your relay/gateway offers no embedding channel at all - 🛡️ RAG cooperates with the sliding window (never replaces it) and degrades gracefully: if embedding or retrieval fails, the chat simply falls back to plain sliding-window behavior
- ⚙️ Configurable in Run settings → Advanced settings: enable/disable, provider, embedding model, retrieval Top-K (1–20)
- Structured outputs (with a JSON Schema editor)
- Function calling (with a declarations editor)
- Code execution
- Grounding with Google Search / Google Maps
- URL context
- 🎛️ Run settings panel: system instructions, temperature, top-p / top-k, max output tokens, max context tokens cap, media resolution, thinking level, safety thresholds per harm category
- 🗂️ System instruction templates (save / apply / manage)
- 🌗 Theme: dark / light / system
- 🔒 Password protection with lock screen (optional, stored locally)
- 📊 Per-message and per-conversation token usage statistics
- 🗄️ Local SQLite (libsql) database — conversations, messages, settings and usage are all persisted on disk; the Dashboard shows DB size and contents
- 🗣️ Edge-TTS speech synthesis: multiple voices, adjustable volume / rate / pitch, per-message playback and auto-read mode for AI responses
- 📱 Fully responsive — desktop sidebar and mobile drawer layouts
Representative views of the application (all images live in
Pictures/):
![]() |
![]() |
| Playground — dark theme | Playground — light theme |
![]() |
![]() |
| Dashboard — database & usage | History — conversation list |
🖼️ Full screenshot gallery (click to expand)
![]() |
![]() |
| Home — mobile | Sidebar — mobile |
![]() |
![]() |
| Chat interface — dark | Chat interface — light |
![]() |
![]() |
| Settings window | API configuration |
![]() |
![]() |
| Tool selection | System instruction templates |
![]() |
![]() |
| Model selection | Add custom model |
![]() |
![]() |
| Structured output Schema editor | Function declarations editor |
![]() |
![]() |
| Password lock screen | Clear password |
git clone https://github.com/SRInternet-Studio/AIStudio.git
cd AIStudio
npm install
npm run devOpen http://localhost:3000, click the Settings button at the bottom-left of the input box, choose a protocol, enter your Base URL and API key, then select or add a custom model in the run settings panel (right side) to start chatting.
| Item | Where | Notes |
|---|---|---|
| Base URL / API key / protocol / proxy | Bottom input box → Settings button (bottom-left) → API configuration | Persisted locally |
| System instructions & templates | Run settings panel (right side) | Templates saved to DB |
| RAG long-term memory | Run settings panel → Advanced settings | On by default; use the Local provider when your endpoint has no embedding channel |
| Password protection | Settings window | Optional lock screen |
| Theme | Settings window | dark / light / system |
├── src/
│ ├── app/ # Next.js App Router pages + API routes
│ │ └── api/ # force-dynamic backend endpoints
│ ├── components/ # chat, layout, settings, dashboard, documentation
│ ├── lib/ # db (libsql), api-client, context manager, RAG, models
│ ├── store/ # Zustand global state
│ └── types/ # Shared TypeScript types
├── public/ # Static assets (logo)
├── Pictures/ # Demo screenshots
├── Docs/ # Chinese documentation
└── data/ # Local SQLite database (auto-created)
| Command | Description |
|---|---|
npm run dev |
Start the development server |
npm run build |
Production build |
npm run start |
Serve the production build |
npm run lint |
Run ESLint |
In-app documentation is available under Manage → Documentation (English /
中文 switchable). Source files: WELCOME ·
DEVELOPMENT · SECURITY ·
CONTRIBUTING · CODE_OF_CONDUCT ·
DISCLAIMER — Chinese versions in Docs/.
This project is an open-source educational recreation of Google AI Studio. It is not affiliated with Google and involves no commercial interests.
AI models may make mistakes, so double-check outputs. See DISCLAIMER for details.
.png)
.png)


.png)
.png)
.png)
.png)









.png)