Use NextChat with Models Hub: Custom Endpoint Setup
Turn on the custom endpoint in NextChat (ChatGPT-Next-Web), on the official site or a self-hosted instance, and point it at Models Hub, with verification and error troubleshooting.
NextChat (also known as ChatGPT-Next-Web) is an open-source cross-platform AI chat client available as a web app, desktop app, or self-hosted deployment. Point its custom endpoint at Models Hub and your chats use your Models Hub balance for whichever model you choose. This page covers two setups — using the official hosted site for a quick try, or a self-hosted instance for long-term use — and nothing else about NextChat.
Three things you need
A Models Hub API key, the base URL https://modelsok.com (see the note below if it errors), and a model name.
Prerequisites
- A Models Hub API key, created on the Tokens page. The token's group must have access to the models you plan to use.
- For a quick try: just open the official NextChat site, no install needed. For long-term self-hosting: a Docker or Vercel-capable environment — see the official deployment docs.
Recommended models
| Use case | Model | Pricing | Live status |
|---|---|---|---|
| Everyday chat | claude-sonnet-4-6 | Price | Availability and latency |
| Harder questions and long conversations | gpt-5.5 | Price | Availability and latency |
| Cheap and fast for everyday questions | gpt-5.4-mini | Price | Availability and latency |
Model names are authoritative on the pricing page.
Option 1: use the official hosted site
-
Open app.nextchat.dev and click the settings icon in the bottom left.
-
In the Model section, find Custom Endpoint and turn it on. Two fields appear: OpenAI Endpoint and API Key.
-
Enter the following in OpenAI Endpoint first:
https://modelsok.comIf sending a message errors out (commonly a 404), switch to the versioned path:
https://modelsok.com/v1 -
Enter your Models Hub API key in API Key.
-
Back in the chat view, pick a model from the table above in the model dropdown. If it's not listed, try typing the model ID directly into the model field — subject to your current version's UI.
Settings on the hosted site are stored only in your browser; clearing your cache or switching devices means filling them in again.
Option 2: self-hosted instance
Self-hosting lets you set the connection via environment variables, which is more convenient for teams. Example with Docker:
docker run -d -p 3000:3000 \
-e BASE_URL="https://modelsok.com" \
-e OPENAI_API_KEY="your-models-hub-api-key" \
-e CUSTOM_MODELS="+claude-sonnet-4-6,+gpt-5.5,+gpt-5.4-mini" \
yidadaa/chatgpt-next-web| Environment variable | Purpose |
|---|---|
BASE_URL | The base URL. The source only requires an http(s):// prefix, not a mandatory /v1 — use the same try-then-fix approach as in Option 1 |
OPENAI_API_KEY | Your Models Hub API key; comma-separate multiple keys to round-robin |
CUSTOM_MODELS | Controls the model list: + adds, - hides, name=displayName renames, comma-separated. ⚠️ Using -all to clear the default list before re-adding (e.g. -all,+claude-sonnet-4-6) hasn't been verified against the current version in this rewrite — check the actual behavior on your deployment |
Restart the container after changing environment variables for them to take effect.
Verify
Select your configured model in the chat box and ask "describe this project in one sentence". A normal reply means you're connected. Then check Usage logs in the Models Hub console for a request under that model name within seconds.
Common errors
| Symptom | Cause | Fix |
|---|---|---|
| Sending a message returns 404 | The endpoint is missing or has an extra /v1 | Try both and keep whichever works |
401 / incorrect API key | Key copied incompletely, or the token is disabled | Re-copy from the Tokens page |
| The model you want isn't in the dropdown | You didn't type the model ID manually on the hosted site, or didn't add +model to CUSTOM_MODELS when self-hosting | Follow step 5 of Option 1, or the env var table in Option 2 |
Slow replies or 429 | Rate limited, usually too much concurrency | Retry shortly; contact support for a higher limit if it persists |
| Changed env vars on a self-hosted instance don't take effect | The container wasn't restarted | Run docker restart or redeploy |
More in Troubleshooting.
FAQ
How is it billed? Per input and output token actually consumed, at the price on each model's pricing page; usage logs itemize every request.
How is this different from calling the vendor's API directly? Same request format; only the endpoint changes. One key works across multiple vendors' models without separate accounts.
How do I switch models? Pick a different one from the model dropdown at the top of the chat box; on self-hosted instances, add the model to CUSTOM_MODELS first or it won't appear in the list.
Related
Use nanobot with Models Hub: Edit config.json
Configure nanobot's providers and agents.defaults in config.json to point at Models Hub, with install steps, recommended models, and error fixes.
Use Open WebUI with Models Hub: Admin Panel Connections Setup
Connect self-hosted Open WebUI to Models Hub as an OpenAI-compatible connection under Settings, Admin, Connections, with URL and API key fields, verification, and error troubleshooting.