一个功能丰富的门户,可通过轻量级的 Node.js Web 应用与 GPT-4、Claude、Gemini、Mistral 和 OpenAI 助理 API 进行聊天;支持可自定义的多模态交互。
一个功能丰富的门户,可通过轻量级的 Node.js Web 应用与 GPT-4、Claude、Gemini、Mistral 和 OpenAI 助理 API 进行聊天;支持可自定义的多模态交互。
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.
.env)It is:
.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.It is not:
Models and providers
Conversation
Generate: to produce an image inline.Workflow
.env from inside the browser.Interface
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:
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.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.req.session.chat, not in module-level variables, so two browsers don't step on each other.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.
node --version.npm --version.If you already know your way around a terminal:
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.jsOpen 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.
This section assumes no prior experience. If you've done this kind of thing before, the Quick start above is all you need.
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:
node --version
npm --versionBoth should print a version number.
With Git:
git clone https://github.com/Zaki-1052/GPTPortal.git
cd GPTPortalWithout 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.
npm installThis 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.
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:
cp .env.example .envOn 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:
USER_USERNAME=pick_a_username
USER_PASSWORD=pick_a_password
OPENAI_API_KEY=sk-... # and/or any other provider key you haveThe 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,或尚未同步最近议题。