AI LabActive BuildSovereign AI Chat Application

SB Chat: The Sovereign AI Chat

SB Chat is a sovereign, Next.js-native AI chat workspace for people who want one private interface for local models, hosted AI APIs, document chat, realtime voice, web search, guardrails, authentication, workspaces, folders, token usage, and local-first persistence.

Suhas BhairavPublished July 23, 2026 · Updated July 23, 2026 · 5 min read
View project repo
Next.jsReactJavaScriptBetter AuthSQLiteOllamaOpenAIOpenRouterClaudeGrokSarvam AIOpenAI RealtimeOpenAI Web SearchRAGLocal EmbeddingsOpenAI EmbeddingsJSON PersistenceMarkdown RenderingInternationalization
SB Chat homepage for a sovereign AI chat workspace built with Next.js

Use Cases

Private AI chat workspace for local and hosted modelsOpen WebUI alternative for Next.js and JavaScript teamsOllama chat UI for local modelsOpenAI, OpenRouter, Claude, Grok, and Sarvam AI chat interfaceDocument chat over PDFs, text files, CSVs, spreadsheets, and DOCX filesRealtime voice chat using OpenAI RealtimeWeb search inside the chat composerGuardrailed AI chat with temporary conversationsWorkspaces, folders, searchable chat history, and import/exportLocal-first AI product with Better Auth and JSON data files

SB Chat is a sovereign AI chat application built as a full Next.js product rather than a thin prompt demo. It is designed for users who want one private workspace for local models, hosted model APIs, document chat, web search, realtime voice, guardrails, chat history, workspaces, folders, and portable JSON data.

The product direction is simple: keep the interface familiar for non-technical users, keep the architecture understandable for builders, and let the user decide where intelligence runs. SB Chat can talk to local Ollama models, OpenAI-compatible servers, OpenAI, OpenRouter, Claude, Grok, Sarvam AI, and custom provider endpoints from one consistent chat surface.

SB Chat sovereign AI chat homepage
SB Chat presents a clean private AI workspace entry point for people who want a polished AI chat product without giving up model choice or local-first control.

Why SB Chat exists

Most AI chat tools force a tradeoff. Some are powerful but heavy. Some are local but rough. Some are beautiful but tied to a single provider. SB Chat is built around a different promise: a serious, ChatGPT-style experience that remains sovereign, extensible, and portable.

The app uses local JSON files for chat history and token usage, Better Auth with SQLite for local accounts, and server-side routes for provider calls. API keys can come from environment variables or runtime settings, while saved chat data deliberately avoids storing provider API keys.

Core capabilities

  • Multi-provider chat: Use Ollama, OpenAI, OpenRouter, Claude, Grok, Sarvam AI, and custom OpenAI-compatible endpoints from one workspace.
  • Streaming responses: Assistant output streams into the UI instead of appearing as a single delayed block.
  • Document chat: Upload PDFs, TXT, Markdown, JSON, LOG, CSV, XLS, XLSX, and DOCX files, then enable document-grounded answers.
  • Local and OpenAI embeddings: Choose local hashed embeddings for offline/private indexing or OpenAI embeddings for semantic retrieval.
  • Voice chat: Use OpenAI Realtime for voice conversations, transcription, and spoken assistant replies.
  • Web search: Enable OpenAI hosted web search from the composer when current external knowledge is needed.
  • Guardrails: Toggle comprehensive guardrails for safer assistant behavior, prompt-extraction resistance, and high-risk request screening.
  • Temporary chat: Start a conversation that is clearly marked temporary and does not get saved to history.
  • Workspaces and folders: Organize chat history, move chats between folders, search saved conversations, and continue old chats.
  • Import and export: Export one chat or the full chat library, and import portable JSON chat archives into another SB Chat installation.
  • Token usage ledger: Track input and output tokens across provider calls in a local JSON usage file.
  • Internationalized interface: The app supports English, German, Spanish, Chinese, Hindi, and Kannada across major screens.

SB Chat alternatives

Open WebUI is an alternative when you want a broader self-hosted AI dashboard instead of a compact Next.js-first SB Chat codebase.

Ollama and llama.cpp are alternatives or companion layers when local model execution is the main requirement.

LM Studio, Jan, and Msty are alternatives when a desktop AI app is preferred over a browser-based workspace.

AnythingLLM and Onyx are alternatives when document Q&A or enterprise search is the main product focus.

LibreChat and Dify are alternatives when multi-provider chat or workflow building is more important than SB Chat's local-first Next.js structure.

ChatGPT, Claude, Gemini, and Grok are alternatives when a provider-owned hosted AI product is preferred.

vLLM and LiteLLM are adjacent alternatives when model serving, routing, or gateway infrastructure is the primary need.

Architecture choices

SB Chat intentionally avoids hiding the product behind complex infrastructure. The app uses Next.js API routes for provider requests, JSON files for chat and token usage persistence, SQLite for Better Auth sessions, and clear reusable components for layout, chat messages, composer controls, settings, token usage, documents, and documentation.

This makes the application useful as both a product and a reference architecture. A team can read the code, replace providers, add new model catalogs, change persistence, or adapt the UI without first untangling a large distributed system.

SEO and answer-engine fit

SB Chat is especially relevant for searches such as Open WebUI alternative, Next.js AI chat app, Ollama chat UI, sovereign AI chat, self-hosted AI chat UI, OpenAI-compatible chat interface, Claude chat UI, Grok API chat app, Sarvam AI chat app, RAG document chat app, and ChatGPT clone with local models. The project is built to answer the practical question behind those searches: how can one person or team run a serious AI chat product without surrendering model choice, data portability, or application control?

FAQ

Is SB Chat an Open WebUI alternative?

Yes. SB Chat is a Next.js-native Open WebUI alternative for people who want multi-provider chat, Ollama support, document chat, voice, web search, guardrails, auth, and local-first persistence in a JavaScript codebase.

Does SB Chat only work with OpenAI?

No. SB Chat supports Ollama, OpenAI, OpenRouter, Claude, Grok, Sarvam AI, and custom OpenAI-compatible endpoints. OpenAI is used for specific optional capabilities such as hosted web search, embeddings, and Realtime voice.

Does SB Chat store API keys in chat history?

No. Runtime API keys are kept out of persisted chat JSON. Server-side environment variables can also be used for provider keys.

Can SB Chat talk to local documents?

Yes. SB Chat has a Documents page for uploading, listing, downloading, deleting, and reindexing files. Document Chat can be enabled from the top bar when the user wants answers grounded in indexed files.

Who created SB Chat?

SB Chat was created by Suhas Bhairav as part of the AI Lab collection.