HomeQuick StartNextChat

This guide teaches you how to connect NextChat with OpenAI Hub to build a private AI client that can chat with all models using a single key.

What is NextChat

NextChat (formerly ChatGPT Next Web) is an open-source, cross-platform AI chat client that supports major models such as GPT‑4, Claude, and Gemini. It can be deployed to Vercel in one click or self‑hosted with Docker. All chat history is stored locally in the browser by default, ensuring privacy.

Project link: https://github.com/ChatGPTNextWeb/NextChat

NextChat main interface

It pairs perfectly with OpenAI Hub—NextChat is natively compatible with the OpenAI API format, and OpenAI Hub provides a unified API with the same format. You just need to change the Base URL to get it working.

Method 1: One‑click Vercel Deployment

This is the fastest method—no server required.

Step 1: Fork and Deploy

Click the button below, log in to Vercel with your GitHub account, and deploy in one click:

Deploy with Vercel

Step 2: Fill in Environment Variables

During deployment, Vercel will ask you to fill in environment variables. Enter the following:

VariableValueDescription
OPENAI_API_KEYsk-your-api-keyYour API key from OpenAI Hub
BASE_URLhttps://api.openai-hub.comThe API endpoint of OpenAI Hub
CODEA password, e.g. my-password-123Access password to prevent public use of your deployment

Note: Do not include /v1 in BASE_URL. NextChat automatically appends /v1; if you set it as https://api.openai-hub.com/v1, actual requests will hit /v1/v1 and return 404. This is the most common issue.

After filling in, click Deploy. Wait one or two minutes. Vercel will give you a xxx.vercel.app domain—open it to start using NextChat.

Step 3: Verification

Open the deployed page, enter the password you set, and send a message. If you receive a response, everything is working correctly.

Method 2: Docker Deployment

This method is suitable if you want to host it on your own server.

Start with a single command

docker run -d -p 3000:3000 \
  -e OPENAI_API_KEY=sk-your-api-key \
  -e BASE_URL=https://api.openai-hub.com \
  -e CODE=my-password-123 \
  yidadaa/chatgpt-next-web

After it's running, just visit http://localhost:3000.

Note: Again, do not include /v1 in BASE_URL.

Using Docker Compose

If you prefer managing with Compose, create a docker-compose.yml:

version: '3'
services:
  nextchat:
    image: yidadaa/chatgpt-next-web
    ports:
      - "3000:3000"
    environment:
      # OpenAI Hub Key
      OPENAI_API_KEY: sk-your-api-key
      # Without /v1
      BASE_URL: https://api.openai-hub.com
      # Access password — highly recommended
      CODE: my-password-123
    restart: unless-stopped

Then run:

docker compose up -d

Method 3: Update Configuration in Existing Deployment

If you already have NextChat deployed, you don't need to redeploy. Just update the configuration in the UI.

  1. Open NextChat and click Settings in the bottom left corner.
  2. Find the Custom API Endpoint section.
  3. Change the endpoint to: https://api.openai-hub.com.
  4. Change the API Key to the one from OpenAI Hub: sk-your-api-key.

NextChat settings - custom API configuration

Potential issue: In some older versions of NextChat, the field name might be “OpenAI Endpoint” or “API URL.” They refer to the same thing. Likewise, do not include /v1.

After saving, return to the chat page and send a test message.

Switching Models

OpenAI Hub supports multiple model providers, and switching models in NextChat is very easy:

  1. In the chat interface, click the model name at the top (usually gpt-3.5-turbo by default).
  2. Select the model you want from the dropdown, such as gpt-4o, claude-sonnet-4-20250514, or gemini-2.5-pro.

If your desired model isn’t listed, you can manually enter the model name in Settings → Custom Model Name. You can view the full model list on openai-hub.com.

Note: Pricing varies across models. Before using GPT‑4‑level models, check your OpenAI Hub account balance.

Masks (Prompt Templates)

NextChat has a useful feature called Masks, essentially preset System Prompt templates. You can create masks for different use cases:

  • Click the Mask icon in the bottom left corner.
  • Choose a built‑in template or click New to create your own.
  • Configure the System Prompt and default model.

For example, you can create a “Code Review” mask, write your review guidelines in the System Prompt, select the gpt-4o model, and use it each time you perform a code review.

FAQ

Q: After deployment, I get “Failed to fetch” or a network error

Most likely, your BASE_URL is incorrect. Check these two things:

  • Make sure it’s https://api.openai-hub.com, not https://api.openai-hub.com/v1.
  • Ensure there are no extra spaces or slashes.

Q: How do I update the version after deploying on Vercel?

Go to your forked GitHub repository, click Sync fork to pull upstream updates, and Vercel will automatically redeploy.

Q: Can I use multiple API Keys?

Yes. You can specify multiple keys in the OPENAI_API_KEY variable, separated by commas. NextChat will automatically rotate through them.

Q: Are chat logs uploaded to a server?

By default, NextChat stores chat history locally in the browser (localStorage). They are not uploaded anywhere, but the conversation data itself is sent to the API endpoint (OpenAI Hub), which is the same as any other API call.

Next Steps

  • Bind your own domain to NextChat (add it under Vercel → Settings → Domains).
  • Use Masks to create workflow templates like translation assistant or weekly report generator.
  • Try the ChatPDF feature — upload a document and chat with its content.
  • For team usage, set multiple access passwords for simple permission separation.

Contact Us

We usually reply quickly during business hours

Scan WeChat

Support: Hub Assistant

WeChat ID: