Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

AI Studio logo AI Studio

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.

Features

Core Playground

  • 💬 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

Long-term memory (RAG)

  • 🧠 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/embeddings or 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)

Tools

  • Structured outputs (with a JSON Schema editor)
  • Function calling (with a declarations editor)
  • Code execution
  • Grounding with Google Search / Google Maps
  • URL context

Configuration & Personalization

  • 🎛️ 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

Data & Voice

  • 🗄️ 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

Demo Screenshots

Representative views of the application (all images live in Pictures/):

Home page (dark) Home page (light)
Playground — dark theme Playground — light theme
Dashboard History
Dashboard — database & usage History — conversation list
🖼️ Full screenshot gallery (click to expand)

Interface & Themes

Mobile home Mobile sidebar
Home — mobile Sidebar — mobile
Chat interface (dark) Chat interface (light)
Chat interface — dark Chat interface — light

Settings & Tools

Settings window API configuration
Settings window API configuration
Tool selection System instructions
Tool selection System instruction templates

Models & Structured Output

Model selection Add custom model
Model selection Add custom model
Structured output editor Function declarations editor
Structured output Schema editor Function declarations editor

Security

Lock screen Clear password
Password lock screen Clear password

Installation

git clone https://github.com/SRInternet-Studio/AIStudio.git
cd AIStudio
npm install
npm run dev

Open 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.

Configuration

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

Project Structure

├── 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)

Scripts

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

Documentation

In-app documentation is available under Manage → Documentation (English / 中文 switchable). Source files: WELCOME · DEVELOPMENT · SECURITY · CONTRIBUTING · CODE_OF_CONDUCT · DISCLAIMER — Chinese versions in Docs/.

Disclaimer

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.

License

Apache License v2.0.

About

An open-source, self-hosted recreation of the Google AI Studio playground — local SQLite storage, RAG, Edge-TTS voice, Gemini & OpenAI-compatible endpoints. 一个开源的自托管版本,复刻了 Google AI Studio 的操练场功能——本地 SQLite 存储、检索增强生成、Edge-TTS 语音、兼容 Gemini 和 OpenAI 的端点。

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages