A browser-native AI chat application with ReAct-style tool loop, message branching, and multi-provider support. All data stays in your browser — no server-side database required.
- Multi-provider support — OpenAI, Anthropic, OpenAI Responses API, and any compatible endpoint
- Browser-local storage — Messages and settings stored in IndexedDB, nothing leaves your device
- Message branching — Edit messages to create branches, switch between alternatives
- Built-in tools — Web search, code interpreter, image generation, file search (provider-dependent)
- Reasoning effort control — 7-level selector to tune model thinking depth
- ReAct tool loop — Automatic multi-step tool use with streaming
- Config profiles — Multiple provider configurations with one-click switching
- Encrypted API keys — Optional passphrase-based encryption for stored credentials
- Server proxy with access gate — Optional
API_ACCESS_TOKENto protect deployed instances - Dark mode — One Dark Pro inspired theme with system preference detection
git clone https://github.com/mengshouer/LunaChat.git
cd lunachat
npm install
npm run devOpen http://localhost:3000, click Open Settings, and configure your provider (Base URL + Model).
| Variable | Required | Description |
|---|---|---|
API_ACCESS_TOKEN |
No | When set, all /api/* requests must include a matching x-access-token header |
- Next.js 15 (App Router)
- React 19
- TypeScript
- Tailwind CSS 4 + Radix UI
- Dexie (IndexedDB)
- nuqs (URL state)
- Vitest (testing)
Browser ←→ Next.js API routes (thin proxy) ←→ LLM Provider APIs
↕
IndexedDB (messages, threads, config)
- Client mode: Browser calls LLM APIs directly (needs CORS support)
- Server mode: Requests go through
/api/llmproxy (avoids CORS, hides keys from network tab) - Auto mode (default): Tries client first, falls back to server on failure
