Skip to content

General

How to Self-Host a ChatGPT-Style Chat Interface

Self-host a ChatGPT-style chat with an OpenAI API key or a local model: picking an interface, Docker setup, HTTPS, costs, privacy, team use and fixes.

ChatGPT itself is OpenAI's hosted app, and you cannot install it on your own server. What people mean by "self-hosted ChatGPT" is one of two setups:

  • Your interface, OpenAI's models. You run a chat interface yourself and connect it to the OpenAI API with your own key. The models run at OpenAI; the interface, the history and the access rules are yours.
  • Your interface, your model. You run an open-weight model on your own hardware, so nothing leaves your network. OpenAI publishes open-weight models (gpt-oss), and there are many others.

This guide covers both: choosing an interface, a step-by-step setup, cost, privacy, team use and common errors. At the end it explains what MultitaskAI, which used to sell a self-hosted chat app, does today.

What "self-hosted" really means here

The phrase covers very different setups, and the difference matters for privacy, cost and quality.

Self-hosted interface, hosted model

This is the common case. You run a web app on your own server or laptop, and that app sends each conversation to the OpenAI API. You own the interface, the history, the access rules and the bill, which is per token on your own platform account rather than per seat. What you do not own is the model. Every message still travels to OpenAI, gets processed there and comes back. If the reason you want to self-host is "no data may leave our network", this setup does not meet that requirement.

Self-hosted interface, self-hosted model

Here you also run the model. Tools such as Ollama, LM Studio and llama.cpp download open-weight models and serve them on your machine, and an interface like Open WebUI sits on top. Nothing goes to a third party unless you add a hosted provider yourself.

The trade-offs are hardware and quality. Larger open models need a capable GPU or a recent Apple Silicon machine with plenty of memory, and smaller models are noticeably weaker than OpenAI's hosted flagship models at complex reasoning, long documents and tool use. Our guide to local AI models compares the tools that run them.

The hybrid most people end up with

Most self-hosted interfaces let you connect several backends at once. A common pattern is a local model for drafts, quick questions and anything sensitive, and the OpenAI API (or another provider) for hard tasks. One interface, one history, and you choose per conversation where the data goes. If you want Google's models in the same window, our guide to a self-hosted Gemini interface covers that side.

Why run your own interface

  • Pay for use. The API is billed per token. For light or uneven use, that can cost less than a monthly seat; for heavy use it can cost more, so watch the usage page.
  • One interface for several providers. Most self-hosted interfaces talk to OpenAI, Anthropic, Google and local models side by side.
  • Your retention rules. History lives in a database or browser storage you control, for as long as you decide.
  • Your access control. Put the interface behind your own login, VPN or single sign-on. What you give up: features that only exist in OpenAI's apps, such as their memory, voice mode and built-in integrations, unless the interface you pick rebuilds them. Updates, backups and security also become your job. If you only want something different from ChatGPT and not a server to look after, our overview of ChatGPT alternatives may fit better.

Choosing an interface

Maintained open-source projects that work with the OpenAI API include LibreChat, Open WebUI and LobeChat. They overlap a lot, so the choice usually comes down to how you want to run it and who will use it. Check each project's documentation for its current features and licence before you roll it out to a team; licence terms in this space have changed over time, and some projects add conditions about branding or commercial use.

LibreChat

LibreChat is a multi-provider interface that looks and feels close to ChatGPT. It supports OpenAI, Anthropic, Google and other providers natively, plus any OpenAI-compatible endpoint.

  • Strengths: user accounts with several sign-in options, conversation search, presets, agents, and a configuration file (librechat.yaml) that lets you define custom endpoints and limit what users see. It can let each user enter their own key instead of sharing yours. It supports MCP servers, both local ones and remote ones over Streamable HTTP.
  • Trade-offs: it runs several containers (the app, MongoDB, a search service and optional retrieval services), so it is heavier to run and back up than a single container.

Open WebUI

Open WebUI started as a front end for local models through Ollama and connects to any OpenAI-compatible API, including OpenAI itself.

  • Strengths: one container to start, a strong local-model story, model management from the browser, user groups with per-model access, document chat, and native MCP support over Streamable HTTP (added in its 0.6 series).
  • Trade-offs: providers that are not OpenAI-compatible need a gateway or an add-on, and many settings live in its database after the first start, which can surprise you when environment variables seem to be ignored.

LobeChat

LobeChat is a multi-provider chat app with a polished interface and a plugin system.

  • Strengths: a clean design, many providers, and deployment either with Docker or on a serverless host.
  • Trade-offs: some features depend on which deployment mode you pick, for example whether history lives in the browser or in a server database. Read its deployment guide closely before you choose a mode for a team.

Or build a small one yourself

If you only need a minimal chat window, the official OpenAI SDK makes it a small project: a page sends messages to your own backend, and the backend calls the API with the key and streams the reply back. Keep the key on the server.

Step-by-step setup

The steps below use Open WebUI with the OpenAI API as the running example, because it starts with a single container. The pattern carries over to the other projects: get a key, run the containers, configure providers, lock down access, add HTTPS, then plan backups and updates.

1. Get an OpenAI API key

  1. Sign in to the OpenAI platform and set up billing. API usage is billed separately from ChatGPT plans.
  2. Create a project for this interface, so its usage and limits are separate from anything else you run.
  3. Create an API key in that project. Copy it once and store it in a password manager.
  4. Set a spend limit on the project. The platform lets you set a monthly spend limit per project and choose whether reaching it should block further requests or only alert you.

Our guide to getting an OpenAI API key walks through these screens in more detail.

2. Pick where it runs

  • Your own computer is fine for personal use, but only available while it is on.
  • A small Linux server with Docker is enough for a hosted-model setup, because the heavy work happens at OpenAI. Local models change that: they need a GPU server or a strong desktop.
  • A managed host with a one-click template saves server work. Check where it stores your data and volumes.

3. Install Docker and start the container

Install Docker and the Compose plugin from Docker's documentation for your system. Then create a folder with a compose.yaml like this outline:

YAML
services:
  open-webui:
    image: ghcr.io/open-webui/open-webui:main
    restart: unless-stopped
    ports:
      - "127.0.0.1:3000:8080"
    environment:
      OPENAI_API_KEY: ${OPENAI_API_KEY}
      WEBUI_SECRET_KEY: ${WEBUI_SECRET_KEY}
    volumes:
      - open-webui:/app/backend/data

volumes:
  open-webui:

Put the values in an .env file next to it, which Compose reads automatically:

Code
OPENAI_API_KEY=sk-your-key-here
WEBUI_SECRET_KEY=a-long-random-string
  • Bind to localhost. 127.0.0.1:3000:8080 makes the app reachable only from the server itself; the reverse proxy in step 6 faces the outside world.
  • Keep the secret key stable. WEBUI_SECRET_KEY signs login sessions. Generate it once and keep it.
  • Keep the volume. /app/backend/data holds the database, uploads and settings. Without it, recreating the container loses everything.
  • Pin a version for teams. Once things work, replace main with a specific release tag so updates happen when you choose.

Start it with docker compose up -d and open http://localhost:3000 on the server, or through an SSH tunnel from your laptop.

4. Create the admin account and add providers

In Open WebUI, the first account created becomes the administrator, so create yours right away. Then open the admin settings:

  • Connections. Confirm the OpenAI connection works and that models appear. Add other OpenAI-compatible endpoints here, such as a local Ollama instance or a gateway in front of other providers.
  • Models. Hide models you do not want people to use, set defaults, and add a system prompt per model if you want consistent behaviour.
  • Local models. If Ollama runs on the same host, add its address as a connection. Our local AI models guide covers installing it.

In LibreChat, the same step happens in its .env file and librechat.yaml: you add keys for the providers you use and define any custom endpoints there, then restart.

5. Users and authentication

Before anyone else can reach the interface:

  • Turn off open sign-up. In Open WebUI, disable sign-up in the admin settings or set ENABLE_SIGNUP=false once your admin account exists. In LibreChat, ALLOW_REGISTRATION=false in .env does the same.
  • Choose how people sign in. Both projects support local accounts and single sign-on through OAuth or OpenID Connect providers, and LDAP for directory-based setups. Single sign-on means leavers lose access when their company account is disabled.
  • Set roles. Give admin rights to as few people as possible. Use groups to control who can use expensive models.
  • Consider a private network. If only your team needs it, putting the interface behind a VPN or a zero-trust access proxy removes most of the attack surface.

6. HTTPS with a reverse proxy

Never send passwords or conversations over plain HTTP. A reverse proxy in front of the container handles TLS certificates and forwards requests to the app. Caddy is the simplest option because it obtains and renews certificates automatically. Point a DNS record such as chat.example.com at your server, then use a Caddyfile like this:

Code
chat.example.com {
    reverse_proxy 127.0.0.1:3000
}

If you use nginx or Traefik instead, make sure the proxy allows WebSocket upgrades and does not buffer streamed responses. Both interfaces stream replies token by token, and a buffering proxy makes answers appear all at once or time out on long replies. Raise the proxy's read timeout if long answers get cut off.

7. Backups

Your conversation history only exists where the interface stores it, so back it up like any other database:

  • Open WebUI: back up the data volume. One simple way is a temporary container that archives it:
Code
docker run --rm -v open-webui:/data -v "$PWD":/backup alpine tar czf /backup/open-webui.tgz -C /data .
  • LibreChat: back up the MongoDB database with mongodump, plus your .env, librechat.yaml and any uploaded files.
  • Copy backups off the server, keep several generations, and test a restore once. A backup you have never restored is a guess.
  • Treat backups as sensitive. They contain every conversation and, depending on the interface, stored provider keys. Encrypt them at rest.

8. Updates

These projects move quickly, which brings fixes and features but also breaking changes.

  1. Read the release notes before updating, especially for major versions.
  2. Take a backup.
  3. Change the image tag, then run docker compose pull and docker compose up -d. For LibreChat installed from its repository, pull the repository first so the compose files match the new version.
  4. Check sign-in, a test conversation and any connected tools.

Update at least monthly. A chat interface exposed to the internet that is never updated becomes a security risk.

What it costs

The interface itself is usually free software. The costs are the server and the API usage.

How API billing works

The OpenAI API charges per token, with separate rates for input (what you send) and output (what the model writes), and different rates per model. A token is a piece of a word; in English, a rough rule of thumb is about four characters per token, though it varies by language and content. The current rates are on OpenAI's pricing page, and they change, so check there rather than relying on numbers you have seen elsewhere.

The detail that surprises most people: every message sends the conversation so far. The tenth reply in a thread sends the nine before it as input again. Long threads, pasted documents and large system prompts all multiply input tokens. Many providers discount repeated prompt prefixes through prompt caching, which helps, but long threads still cost more per reply than short ones.

Estimating your usage

  1. Count roughly how many messages each person sends per working day.
  2. Estimate the average input per request, including history and attachments, and the average output.
  3. Multiply by people and working days for a month, then by the per-token rates for the models you plan to use.
  4. Run the setup for a week or two with a spend limit, then compare the usage dashboard with your estimate and adjust.

Keeping spend under control

  • Set a project spend limit and decide whether it should block requests or only alert you.
  • Default to a smaller, cheaper model for routine work and let people switch up for hard tasks.
  • Start new chats for new topics instead of continuing one thread forever.
  • Limit who can use the most expensive models, through model visibility or groups in the interface.
  • Use per-user limits if your interface has them. LibreChat, for example, has an optional token balance feature for users.
  • Use one key per interface so you can see and cut off exactly one source of spend. Our guide to API key management covers rotation and storage.

Privacy and compliance

Self-hosting the interface moves your history onto your infrastructure. It does not make the model private. Be precise about what changes.

What OpenAI still sees

Every prompt, file and reply in a conversation that uses an OpenAI model passes through OpenAI's API. Its policies decide what happens next:

  • Training. OpenAI states that it does not train its models on data sent through the API unless you opt in. Read the current API data usage policy before you send sensitive data.
  • Retention. API inputs and outputs may be kept for a limited period for abuse monitoring. Eligible organizations can request stricter arrangements such as zero data retention. Check the current retention policy and what your agreement allows.
  • Stored objects. Some API features store data on OpenAI's side until you delete it, such as uploaded files or stored responses. Find out whether your interface uses them.
  • Contracts. If you handle personal data for a business, look at OpenAI's data processing addendum and the regions available to you, and record OpenAI as a processor.

What you now hold

  • History. Conversations sit in your database or volume. Decide how long to keep them and delete old ones on a schedule if your policy requires it.
  • Logs. The interface, the reverse proxy and Docker all write logs. Debug logging can include full prompts. Keep log levels at normal in production and rotate logs.
  • Keys. Keep provider keys on the server. A key embedded in a web page can be copied and spent by anyone. If the interface stores keys in its database, that database is now a secret too.
  • Uploads. Files people attach are stored by the interface, and with document chat they may also be indexed in a vector store. Include those in retention and backups.

When you need data to stay in-house

If certain data must never leave your network, route those conversations to a local model and keep hosted providers for everything else. Some teams run two connections in the same interface and use model visibility to make the local one the default for sensitive groups.

Running it for a team

  • Write a short usage policy. Which data may go to hosted models, which must stay local, and which models to use for what.
  • Share presets and prompts, so people start from good defaults.
  • Keep a test instance with its own key for trying updates before the team sees them.
  • Name an owner who applies updates, watches spend and handles access.
  • Review the usage dashboard monthly for unexpected models or sudden jumps in spend.

Troubleshooting common errors

401 or "invalid API key"

The key is wrong, revoked, or not reaching the app. Check for stray spaces or quotes in .env, make sure you restarted the container after changing it, and confirm the key belongs to a project that still exists. In Open WebUI, settings saved in the database can override environment variables after the first start, so check the connection in the admin settings too.

429 errors

A 429 means either a rate limit (too many requests or tokens per minute) or a spending problem, such as an exhausted credit balance or a spend limit set to block requests. The error message says which. For rate limits, wait and retry or spread load across time; for spend, check billing and your project limits.

"Model not found" or models missing from the list

The model name may have changed, the project may not have access to it, or the interface may cache an old model list. Refresh the model list in the settings and compare names with the models page on the OpenAI platform.

Answers stop halfway or appear all at once

This is almost always the reverse proxy. Turn off response buffering, allow WebSocket upgrades and raise the read timeout.

"Context length exceeded"

The conversation plus attachments is larger than the model accepts. Start a new chat, summarise the old one into the first message, or switch to a model with a larger context.

Everything is gone after an update

The data directory was not on a persistent volume, or the volume name changed. Restore from backup and fix the compose file. If a container will not start at all, docker compose logs usually points to a port in use or a malformed .env or YAML file.

What happened to MultitaskAI's self-hosted app

MultitaskAI used to be a browser-based chat interface for your own API keys from OpenAI, Anthropic and Google. It offered split-screen conversations, agents and file handling, was sold as a one-time licence, and could be downloaded as a ZIP file and hosted on any static host. Chats stayed in the browser.

That app is retired. MultitaskAI is now a remote MCP server: one endpoint that gives AI agents 166 exact tools, such as DNS, WHOIS and SSL lookups, JSON repair, regex testing, conversions and image resizing, that they can call while they work. There is nothing to host: you add it to the AI client you already use. If MCP is new to you, read what an MCP server is, and browse the full list on the tools page.

Give ChatGPT tools with MultitaskAI

ChatGPT can connect to remote MCP servers, the open standard for giving assistants tools. With MultitaskAI connected, ChatGPT can look up a domain's records, check a certificate or convert a file instead of describing how you could do it yourself.

  • Follow Connect MultitaskAI to ChatGPT. Connectors like ChatGPT sign in with OAuth.
  • For Cursor, see Connect MultitaskAI to Cursor; for other MCP clients, see other clients. Editors and CLIs use an API key.
  • Self-hosted interfaces count too. LibreChat and Open WebUI both support remote MCP servers over Streamable HTTP, so you can add MultitaskAI's endpoint to your own instance and give every model in it the same tools. The docs have the endpoint and the details.

Every signed-in account gets 100 free requests a day, reset at midnight UTC. MultitaskAI Pro removes the limit for €9 a month. Pricing has the details.

Frequently asked questions

Can I download ChatGPT and run it locally?

No. ChatGPT and OpenAI's flagship models only run on OpenAI's infrastructure. You can run OpenAI's open-weight models or other open models locally, or self-host an interface that calls the API.

Is the API cheaper than a ChatGPT subscription?

It depends on how much you use it. The API charges per token, so occasional use is often cheaper and daily heavy use can cost more. Set a limit and check the usage page for a month.

Does a ChatGPT Plus subscription include API access?

No. The API is billed separately on the OpenAI platform.

Which self-hosted interface should I start with?

For a single user who also wants local models, Open WebUI is the quickest to get running. For a team that wants a ChatGPT-like experience across several providers, LibreChat is a good fit. Try one for a week before you invest in single sign-on and backups.

Is a self-hosted interface more private than ChatGPT?

It changes where your history is stored and who can reach the interface. Messages sent to OpenAI models are still processed by OpenAI, under the API terms rather than the consumer terms. For data that must not leave your network, use a local model.

Do I need a GPU?

Not for an interface on the OpenAI API: the models run at OpenAI, so a small server is enough. You only need serious hardware if you run models locally.

Can several people share one API key?

Yes, the interface uses one key on the server for everyone. Use the interface's accounts and groups to control access, and keep a separate key per interface so you can track and revoke it independently.

Is the old MultitaskAI app still sold?

No. It is retired. MultitaskAI now provides tools for agents through MCP.

Give your agent 433 tools in a minute

Connect MultitaskAI to your MCP client and ask in plain words. 100 requests a day are free.