Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
G

GPTPortal

> AI 编程
Open source

A feature-rich portal to chat with GPT-4, Claude, Gemini, Mistral, & OpenAI Assistant APIs via a lightweight Node.js web app; supports customizable multimodalit

398 stars0 likes2 views
WebsiteGitHub

About

A feature-rich portal to chat with GPT-4, Claude, Gemini, Mistral, & OpenAI Assistant APIs via a lightweight Node.js web app; supports customizable multimodalit

GPTPortal

GPTPortal is a self-hosted, local-first web app that gives you one clean chat interface in front of every major LLM provider at once — OpenAI, Anthropic, Google, xAI, DeepSeek, Groq, Moonshot, Mistral, the entire OpenRouter catalog, and any OpenAI-compatible endpoint you run yourself (Ollama, LM Studio, vLLM). You bring your own API keys, run it on your own machine with a single node server.js, and talk to any model from any provider without juggling five different web UIs.

It is deliberately lightweight. There is no build step, no bundler, no frontend framework, and no database. The backend is modular Node/Express; the frontend is hand-written HTML, CSS, and vanilla JavaScript. You can read the whole thing, change it, and restart it in seconds. That constraint is a feature — this is meant to be a tool you own and understand, not a black box you deploy and forget.

This document is long on purpose. It is meant to get a non-technical user from zero to a working portal, and to give a developer enough of the map to extend it confidently. Skim the Table of Contents and jump to what you need.


Table of Contents

  • What GPTPortal is (and what it isn't)
  • Feature overview
  • Architecture
  • Requirements
  • Quick start
  • Installation, step by step
  • Configuration reference (.env)
  • Providers and models
  • Using the portal
  • Custom and local endpoints (Ollama, LM Studio, vLLM)
  • Prompt caching (Claude)
  • Streaming, and how a message actually flows
  • HTTP API reference
  • Extending: adding models and providers
  • Project structure
  • Deployment
  • Security and privacy
  • Cost management
  • Troubleshooting and FAQ
  • Testing
  • Repository documents
  • Glossary
  • Contributing
  • License

What GPTPortal is (and what it isn't)

It is:

  • A local-first application. It runs on your computer (or your own server). Your API keys live in a .env file that is never committed. Your conversations are held in your browser session and, optionally, in files under public/uploads/. Nothing is sent anywhere except the actual API calls to whichever provider you chose for a given message.
  • A single unified interface across many providers. Switch from GPT-5.5 to Claude Opus to Gemini 3 to a local Llama in one dropdown, mid-project, without changing anything else.
  • Pay-as-you-go by design. You are billed directly by each provider for exactly what you use, through your own keys. There is no subscription and no middleman. For heavy users this is dramatically cheaper than paying for several chat subscriptions; for light users it can cost a few dollars a month.

It is not:

  • A hosted, multi-tenant SaaS. There is a single Basic-Auth login gate and per-browser session state. You can expose it on a network, but it is designed for one person (or a trusted household) running it locally.
  • A no-key demo. Every model call goes through a provider API, so you need at least one provider key. Most providers give new accounts some free credit; several models are effectively free through Groq or a local endpoint.
  • A heavyweight "AI platform." There is intentionally no vector database, no RAG pipeline, no agent-orchestration subsystem, no packaged desktop binary. If you want those, this is a good base to build on, but they are out of scope here.

Feature overview

Models and providers

  • Curated core catalog of current models across OpenAI, Anthropic, Google, xAI, DeepSeek, Groq, Moonshot (Kimi), and Mistral, defined in a single JSON file.
  • The entire OpenRouter catalog (hundreds of models) loaded live and cached, so anything OpenRouter serves is one click away.
  • Your own OpenAI-compatible endpoints — Ollama, LM Studio, vLLM, LocalAI, or a remote gateway — added through environment variables with no code, auto-discovered into the model picker.
  • A searchable, categorized model picker with per-provider logos, so you can find a model by name or family instead of scrolling.

Conversation

  • Token streaming end to end. Answers appear as they are generated, and models that expose their reasoning stream that separately from the final answer.
  • Markdown rendering with syntax-highlighted code blocks (highlight.js), math (KaTeX), and per-code-block copy buttons. Output is sanitized before it touches the DOM.
  • Reasoning and verbosity controls for models that support them, plus temperature and max-token sliders, all wired through to the request.
  • Vision: attach an image and ask a vision-capable model about it.
  • File uploads: attach text-based files; their name and contents are added to your prompt.
  • Voice: dictate a message (speech-to-text) and have replies read back to you (text-to-speech).
  • Image generation: prefix a message with Generate: to produce an image inline.
  • Assistants mode (OpenAI): a stateful, tool-using assistant with a persistent thread and code execution, for people who want that workflow.

Workflow

  • Compare view: send one prompt to several models at once and read the answers side by side, each with its own cost.
  • Presets: save and reapply bundles of system prompt + temperature + max tokens + reasoning effort + verbosity.
  • Context, token, and cost tracking: a live indicator of how full the context window is and what the conversation has cost.
  • Export the conversation to a self-contained HTML file.
  • Edit the system prompt and your .env from inside the browser.
  • Prompt caching for Claude, to cut the cost of long, stable system prompts.

Interface

  • A fully redesigned, token-driven UI with light and dark themes (auto-detected from your OS, with a manual toggle that persists).
  • A semantic, responsive shell: collapsible chat-history rail, main chat column, and a docked composer. It works on a laptop and degrades gracefully to a phone.
  • Keyboard shortcuts for every common action.

Architecture

The point of the 2.0 rewrite was to make the codebase legible. Here is the whole map.

…

A few design decisions worth knowing up front, because they explain how everything else behaves:

  • The model catalog is the source of truth. public/js/data/models.json defines every core model. Routing, pricing, context windows, and capability flags are read from it. providerFactory consults each model's provider field first when deciding which handler to use, and only falls back to string-pattern matching for ids that aren't in the catalog (like OpenRouter's vendor/model ids). This means adding a model to an existing provider is usually a one-file change.
  • Handlers share one contract. Every provider handler exposes handleRequest(payload) (non-streaming) and, where the provider supports it, async *streamCompletion(payload) that yields a small set of event types (thinking, text, usage, error). The rest of the system doesn't care which provider it's talking to.
  • State is per-session, not global. Conversation history, the current image, and upload state live in req.session.chat, not in module-level variables, so two browsers don't step on each other.
  • The frontend has no framework. Modules attach to window and coordinate through a handful of well-known objects (window.chatManager, window.dynamicModelManager, and so on). It is old-fashioned on purpose and easy to trace.

If you want to add a provider or model, read Extending and the dedicated MODEL_UPDATE.md.


Requirements

  • Node.js 18 or newer. The current LTS is recommended. Download it from nodejs.org. Check your version with node --version.
  • npm, which ships with Node. Check with npm --version.
  • Git (optional but recommended) to clone and update the repository. You can also download the repo as a ZIP.
  • At least one provider API key. Which one is up to you — see Providers and models. If you only have an OpenAI key, everything OpenAI works; the other providers simply stay disabled until you add their keys.
  • A modern browser. Chrome, Edge, Firefox, Brave, Arc, and other Chromium/Firefox browsers all work well. Safari works for text but cannot do the voice features because WebKit lacks the audio codecs the recorder needs — use a Chromium browser or Firefox if you want voice.

Quick start

If you already know your way around a terminal:

bash
git clone https://github.com/Zaki-1052/GPTPortal.git
cd GPTPortal
npm install
cp .env.example .env      # then edit .env: set USER_USERNAME, USER_PASSWORD, and at least one API key
node server.js

Open http://localhost:3000/portal, sign in with the username and password you set, pick a model, and start typing. That's the whole thing.

If you'd rather not touch a text editor, you can instead run node server.js first and visit http://localhost:3000/setup, which gives you a browser form to enter your keys and writes the .env for you.


Installation, step by step

This section assumes no prior experience. If you've done this kind of thing before, the Quick start above is all you need.

1. Install Node.js

Go to nodejs.org and install the LTS build for your operating system. This also installs npm, the package manager the project uses. When it's done, open a terminal — Terminal on macOS, Command Prompt or PowerShell on Windows — and confirm it worked:

bash
node --version
npm --version

Both should print a version number.

2. Get the code

With Git:

bash
git clone https://github.com/Zaki-1052/GPTPortal.git
cd GPTPortal

Without Git: download the repository as a ZIP from GitHub, unzip it somewhere you'll remember, and cd into that folder in your terminal. Note that you must run the server from the project's root folder (the one containing server.js), so if you move or rename the folder, cd into its new location first.

3. Install dependencies

bash
npm install

This reads package.json and downloads the handful of libraries the server needs (Express, the OpenAI and Google SDKs, a Markdown renderer, tokenizers, and so on). It only needs to be run once, or again after an update that changes dependencies.

4. Configure your keys and login

You have two options.

Option A — the setup page (easiest). Start the server with node server.js and open http://localhost:3000/setup in your browser. Fill in the form — a login username and password of your choosing, plus whichever provider keys you have — and save. It writes the .env file for you. Restart the server so it picks up the new values.

Option B — edit .env directly. Copy the template and open the copy in any text editor:

bash
cp .env.example .env

On macOS, hidden files starting with a dot may not appear in Finder; press Cmd + Shift + . to reveal them, or just edit the file from your terminal or editor. At minimum, set:

env
USER_USERNAME=pick_a_username
USER_PASSWORD=pick_a_password
OPENAI_API_KEY=sk-...           # and/or any other provider key you have

The username and password are yours to invent — they gate access to the portal and are checked locally. See the full Configuration reference for every option.

Issues· 3 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

JavaScriptaiapiassistants-apichatbot

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
CategoryAI 编程
PricingOpen source

> Related tools

G
GitHub Copilot
GitHub 官方 AI 编程助手,覆盖补全、Chat 与 Agent 模式。
C
Cursor
AI 原生代码编辑器,对话改代码、多文件 Agent 与规则体系是其核心。
S
skills
Skills for Real Engineers. Straight from my .agents directory.