# How to Self-Host a Google Gemini Chat Interface

Gemini models run on Google's infrastructure, and Google does not publish their weights. So when people talk about a self-hosted Gemini setup, they mean one of two things:

- **Your interface, Google's models.** You run a chat interface on a server you control and connect it to the Gemini API with your own key. The model runs at Google; the interface, the user accounts, the conversation history and the access rules are yours.
- **Your interface, Google's open models.** You run Gemma, Google's family of open-weight models, on your own hardware. Nothing leaves your network, and you accept a smaller, less capable model in exchange.

Many setups end up as a mix of both: one interface that sends hard questions to the Gemini API and keeps private or routine work on a local Gemma model.

This guide walks through both routes, from API access and choosing an interface to a step-by-step deployment, costs, privacy, team use and troubleshooting. At the end it explains what MultitaskAI, which used to sell a self-hosted chat app, offers today.

## Hosted Gemini or local Gemma

Before you install anything, decide where the model should run. The interface is the easy part and you can change it later. The model decision shapes your hardware, your costs and your privacy story.

| | Gemini API with your own interface | Gemma on your own hardware |
| --- | --- | --- |
| Where the model runs | Google's infrastructure | Your machine or server |
| Capability | Google's current hosted models | Smaller open-weight models |
| Hardware you need | Any small server, the model is remote | A capable GPU or a recent Apple Silicon machine with plenty of memory for larger sizes |
| Cost shape | Pay per token, plus a small server | Hardware and electricity, no per-token bill |
| Works offline | No | Yes |
| What leaves your network | Prompts, files and responses go to Google | Nothing, unless you add online tools |
| Updates | Google ships new models; you pick them by name | You download new versions yourself |

Pick the Gemini API when you want the strongest answers, long context and multimodal input without buying hardware. Pick Gemma when the data must not leave your network, when you need to work offline, or when you already own suitable hardware and want predictable costs. Pick both when your team has a mix of sensitive and ordinary work.

## Getting access to the Gemini API

Google offers two doors to the same family of models. Which one you use depends mostly on whether your organisation already runs on Google Cloud.

### Google AI Studio

Google AI Studio is the quick route. You sign in with a Google account, create an API key and can call the Gemini API within minutes. Each key belongs to a Google Cloud project behind the scenes, but you do not have to manage that project to get started.

AI Studio is a good fit for individuals, small teams and prototypes. It has a free tier with lower rate limits and a paid tier that you turn on by linking billing to the project. Rate limits and model availability change over time, so check the current limits page rather than relying on a number you read somewhere else.

### Vertex AI on Google Cloud

Vertex AI is Google Cloud's machine learning platform, and it serves Gemini models too. It is the route for organisations that want Google Cloud's controls around the model:

- **Projects and billing** that sit alongside the rest of your cloud resources.
- **Identity and access management**, so you grant access to service accounts and groups instead of passing one key around.
- **Regional choices** for where requests are processed.
- **Enterprise agreements** and the data processing terms your legal team may already have signed.

The trade-off is setup effort: a project, the Vertex AI API enabled, a service account with the right role and its credentials in your interface. Not every self-hosted interface supports Vertex AI as well as AI Studio keys, so check first.

### Data use and the free tier

One difference matters more than any other for a self-hosted setup. Google's Gemini API terms treat unpaid and paid use differently:

- On **unpaid services**, Google may use your prompts and responses to provide and improve its products, and human reviewers may read and annotate them. The terms tell you not to submit sensitive, confidential or personal information.
- On **paid services**, Google says it does not use your prompts or responses to improve its products. It logs them for a limited period to detect abuse.
- For users in the European Economic Area, Switzerland and the United Kingdom, the terms apply the paid-service data rules to all use, including the unpaid quota.

The terms also require API users to be 18 or older. Read the current terms yourself before you rely on any of this, and turn on billing before you send anything sensitive. A free key is fine for testing the interface with dummy prompts.

## Choosing an interface

There are several maintained open-source chat interfaces that can talk to Gemini. They differ in how they handle users, which providers they support and how much they try to do beyond chat.

### LibreChat

LibreChat is a multi-provider interface that supports Google alongside OpenAI, Anthropic and others. It has user accounts, conversation search, presets and agents, and it can connect to MCP servers for tools. It is usually deployed with Docker Compose and stores its data in a database that runs beside it. It suits teams that want one interface for several providers with proper accounts.

### Open WebUI

Open WebUI started as an interface for local models through Ollama and now also connects to OpenAI-compatible APIs. Google offers an OpenAI-compatible endpoint for the Gemini API, so Open WebUI can use Gemini through it. Because it handles local models well, it is a natural choice for the mixed setup: Gemini through the API and Gemma through Ollama in the same model picker. It runs as a single Docker container.

### LobeChat

LobeChat is a multi-provider chat app with a plugin system and a polished interface. It can run as a Docker container or on a serverless host, and it supports Google's models directly. It suits people who care about the look and feel and want to try several providers.

### What to compare

There are more interfaces, and new ones appear regularly. Whichever you look at, ask the same questions:

- **Gemini support.** Native Google support, or only through the OpenAI-compatible endpoint? Native support usually exposes more Gemini features. Check Vertex AI support too if you need it.
- **Users and sign-in.** Local accounts, single sign-on through OpenID Connect, roles and the ability to turn off public sign-up.
- **Where history lives.** A database on your server or browser storage, and how you back it up.
- **Licence.** Read it before you deploy for a company. Some projects add conditions for branding or commercial use.
- **Activity.** Model APIs change, and an abandoned interface breaks. Look for recent releases.
- **Tools.** Whether it can call MCP servers, so the model can do things and not only talk.

## Step-by-step setup

The steps below follow the common pattern for Docker-based interfaces. The exact commands and variable names differ by project, so keep its documentation open while you work.

### 1. Pick a host

You have three common options:

- **Your own machine.** Fine for one person, and nothing is exposed to the internet unless you open it up.
- **A small virtual server.** Enough when the model runs at Google, because the interface uses little memory and CPU. The usual choice for a team.
- **A managed host.** Some platforms deploy Docker images or offer one-click templates for popular interfaces, so you do not maintain the operating system.

If you plan to run Gemma on the same box, size the host for the model instead.

### 2. Install Docker

Install Docker and Docker Compose from the official instructions for your operating system. On a server, make sure Docker starts on boot so the interface comes back after a restart.

### 3. Create a key and a project for it

Create a Gemini API key in Google AI Studio, ideally in a project that exists only for this interface. A dedicated project makes billing easy to read and lets you revoke the key without touching anything else. If you use Vertex AI, create a service account with only the role it needs.

Then set a budget alert in Google Cloud billing for that project, so a runaway script or a leaked key shows up in your inbox and not only on the invoice.

### 4. Configure the environment

Most interfaces read their settings from an environment file. Copy the example file the project ships, then fill in:

- The Gemini API key, or the path to the Vertex AI credentials.
- A secret used to sign sessions, generated randomly.
- The public URL the interface will run at.
- Database connection details, if the project uses a separate database.
- Whether new users may sign up on their own.

Keep this file out of version control and readable only by the user that runs Docker.

For Open WebUI, the documented quick start is a single container with a named volume for its data:

```bash
docker run -d -p 3000:8080 -v open-webui:/app/backend/data --name open-webui ghcr.io/open-webui/open-webui:main
```

Once it is running, you add Gemini as an OpenAI-compatible connection in the admin settings, with your Gemini API key and Google's OpenAI-compatible base URL:

```text
https://generativelanguage.googleapis.com/v1beta/openai/
```

For LibreChat and LobeChat, follow their quick starts. Both have a Google provider that takes the key directly.

### 5. Start it and create the first account

Start the containers and open the interface on the port you mapped. In many interfaces the first account you create becomes the administrator, so create yours before anyone else can reach the page. Then send a test message to each Gemini model you plan to offer.

### 6. Set up users and sign-in

Turn off open sign-up if the interface will be reachable from the internet. Create accounts for your users, or connect single sign-on if the interface supports OpenID Connect, and use roles to keep keys and connections in the hands of administrators. For a small group, a VPN or an access proxy in front of the whole interface is a simple extra layer.

### 7. Add HTTPS

Never send passwords or conversations over plain HTTP. Put a reverse proxy such as Caddy, Nginx or Traefik in front of the container and give it a certificate, for example from Let's Encrypt. Caddy obtains certificates automatically, which makes it the shortest path for a single server. Make sure the proxy passes WebSocket connections and streaming responses, because chat interfaces rely on them to show answers as they are generated.

Bind the container to localhost so it is only reachable through the proxy, not on its raw port.

### 8. Back up

History, accounts and settings live in a Docker volume or a database. Back them up on a schedule to somewhere other than the server, and test a restore once on a spare machine. Back up the environment file separately and securely, because it holds your key and secrets.

### 9. Keep it updated

Interfaces update often, to support new models and to fix security issues. Pick a rhythm, such as once a month: read the release notes, take a backup, pull the new image and restart. Pin a version tag if you want updates only when you choose. When Google retires a model name, update the model list in the interface.

## Running Gemma on your own hardware

Gemma is Google's family of open-weight models, built from the same research as Gemini. You download the weights and run them yourself, so no request leaves your machine.

The easiest way in is a local model runner:

- **Ollama** downloads and runs models from the command line and exposes a local API that Open WebUI and other interfaces connect to.
- **LM Studio** is a desktop app with a model browser and a local server mode.
- **llama.cpp** is the lower-level engine many of these tools are built on, for people who want full control.

Gemma comes in several sizes. Small versions run on a laptop; larger ones need a strong GPU or a lot of unified memory. Quantised versions use less memory at some cost in quality. Start small and move up only if the answers are not good enough. Read the licence of the version you download before you use it in a product. Our guide to [local AI models](/blog/local-ai-models/) compares the local runners in more detail.

If Open WebUI runs in Docker and Ollama runs on the host, the container cannot reach Ollama at `localhost`, because that points at the container itself. Use the host address Docker provides, or run both in the same Compose network.

## What it costs

There are no fixed prices worth quoting here, because they change. What stays constant is the shape of the bill.

### API usage

The Gemini API is billed per token, with separate rates for input and output, and different rates for different models. A few things drive the total:

- **Conversation length.** The interface sends the conversation so far with every message, so late replies in a long thread cost much more than early ones. Start a new chat for a new topic.
- **Attachments.** Images, PDFs and long documents add input tokens on every turn they stay in the context.
- **Model choice.** Smaller, faster models cost far less and handle most routine work. Make one the default.
- **Usage patterns.** For light or uneven use, paying per token can cost less than a monthly seat. For heavy daily use it can cost more.

Watch the usage page closely in the first month. Some interfaces can also limit usage per user.

### Hosting and hardware

A small server for the interface is a modest monthly cost; a managed host usually costs more but saves maintenance time. Running Gemma removes the per-token bill but moves the cost into hardware and electricity. If you would have to buy a machine for it, compare that against a year or two of API usage before you decide.

## Privacy: what Google still sees

Self-hosting the interface changes where your history lives. It does not change what happens to each request once it reaches Google.

### What leaves your server

Every message you send to a Gemini model goes to Google with the conversation context, any attached files and the system prompt. The response comes back the same way. Google processes that data under the Gemini API terms for your tier, as described above: on unpaid services it may be used to improve products and read by reviewers, on paid services it is not used for that but is logged for a limited period for abuse detection.

Google also sees metadata: which key or project made the request, when and how much.

### What stays with you

The interface keeps the full conversation history, user accounts, uploaded files and settings on your server. Google does not see your list of users or your history as a whole, only the requests the interface sends. That gives you control over retention: you decide how long history is kept and when it is deleted.

It also gives you responsibility. Your server now holds every conversation, so protect it like any system with sensitive data: HTTPS, single sign-on or strong passwords, updates and encrypted backups.

### Logs, add-ons and the local option

Check what the interface writes to its logs, and which features call other services, such as web search or document processing, because each one sends data to another provider. If none of your prompts may leave your network, use Gemma or another local model for that work and keep the Gemini connection for non-sensitive tasks.

## Running it for a team

A self-hosted interface is often a team decision: one place for everyone, with company rules applied in one spot.

- **One key or several.** A single key in the interface is simplest. Separate projects and keys per team make billing easier to split and limit the damage if one leaks.
- **Accounts.** Connect single sign-on where the interface supports it, so people who leave the company lose access when their account is disabled.
- **Default model.** Set an inexpensive default and explain when to use the larger models.
- **Usage policy.** Write down what may be pasted into the interface and which models are approved for which data. Point people with sensitive material to the local Gemma option.
- **Ownership.** Name someone who applies updates, watches the bill and tests backups. Self-hosted tools fail quietly when nobody owns them.

## Troubleshooting

### "API key not valid" or a 400 error on every request

The key is wrong, has extra spaces, belongs to a project where the API is not enabled, or was deleted. Create a new key in AI Studio, paste it again and restart the container, because many interfaces only read environment variables at start-up.

### 429 errors or "resource exhausted"

You hit a rate limit or a quota. On the free tier the limits are low; turning on billing raises them. For a team, a single key can run into per-minute limits during busy periods, so spread load across models or projects.

### "Model not found"

Model names change and older ones are retired. List the models available to your key and update the names configured in the interface.

### The OpenAI-compatible connection fails

Check the base URL, including the path and the trailing slash, and make sure the interface sends the Gemini key, not an OpenAI key. Some features of the native API are not available through the compatibility layer, so if something specific fails, try the interface's native Google provider instead.

### The interface cannot reach Ollama

Inside a container, `localhost` is the container. Point the interface at the Docker host address or put both services in the same Compose network.

### Answers stop halfway or never stream

The reverse proxy is buffering responses or blocking WebSockets. Turn off response buffering for the interface and allow WebSocket upgrades.

### The service is not available in your region

Gemini API availability depends on your country. If AI Studio does not open for you, Vertex AI may be available in a nearby region; check Google's availability list.

## Giving Gemini tools with MCP

A chat interface lets Gemini talk. Tools let it act: look up a domain's records, check a certificate or repair broken JSON, and return the exact result instead of a guess. The Model Context Protocol (MCP) is the open standard for connecting AI clients to tools like these, explained in [what is an MCP server](/blog/what-is-an-mcp-server/). Several self-hosted interfaces, LibreChat among them, can connect to MCP servers, and Google's Gemini CLI reads them from its settings.

MultitaskAI is a remote MCP server at one endpoint with 166 exact tools, from DNS, WHOIS and SSL lookups to JSON repair, regex testing, conversions and image resizing. Editors and command line clients send a MultitaskAI API key as a bearer token; connectors in Claude and ChatGPT sign in with OAuth.

- For the Gemini CLI, follow [Connect MultitaskAI to Gemini CLI](/docs/gemini-cli.md).
- For a self-hosted interface with MCP support, use the endpoint and header from the [setup overview](/docs.md).
- Browse the [tools](/tools/) and the supported [clients](/clients/).

Every signed-in account gets 100 free requests a day, reset at midnight UTC. MultitaskAI Pro removes the limit for €9 a month; [pricing](/pricing/) has the details.

## What happened to MultitaskAI's self-hosted app

MultitaskAI used to be a browser-based chat interface for your own API keys from Google, OpenAI and Anthropic, sold as a one-time licence and hosted as static files. That app is retired. MultitaskAI is now the MCP server described above, which you add to the AI client you already use. For the OpenAI side of self-hosting, see [self-hosting a ChatGPT-style interface](/blog/self-hosted-chatgpt/).

## Frequently asked questions

### Can I download Gemini and run it myself?

No. Gemini models run only on Google's infrastructure. Gemma is the open-weight family you can download and run on your own hardware.

### Do I need Google Cloud to use the Gemini API?

Not to start. A Google AI Studio key is enough, and it creates the underlying project for you. Vertex AI is the option when you want Google Cloud's projects, regions, access management and enterprise terms.

### Is my data used for training?

It depends on the tier. Google's terms say unpaid Gemini API use may be used to improve its products and may be read by human reviewers, while paid use is not used for that. In the European Economic Area, Switzerland and the United Kingdom the paid-service data rules apply to all use. Check the current terms before you rely on either.

### Is the API cheaper than a Gemini subscription?

It depends on how much you use it. The API charges per token, so occasional use is often cheaper, and heavy daily use can cost more. Set a budget alert and look at a month of real usage before you decide.

### Can several people share one API key?

Yes, the key stays on the server and the interface handles user accounts. For larger teams, separate projects and keys per team make billing clearer and limit the impact of a leak.

### Is the old MultitaskAI app still sold?

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