# Run a local model with Ollama or LM Studio

Connect Nanobrowser to a model on your own computer. Set up Ollama or LM Studio so the extension can reach it.

A local model costs nothing to use, and the pages the agent reads stay on your computer. Voice input still goes to its own provider. Local models do best on short, clear tasks. For harder ones, try a [cloud model](https://nanobrowser.ai/docs/models).

## Which local model should I use?

- **Qwen3.8 27B** is the model we recommend for now. It also sees images.
- The model must support tool calling. [Test models](https://nanobrowser.ai/docs/models#test-models) checks this.
- Load it with a context of 16k tokens or more. Nanobrowser uses the size the server loaded.

## Use Ollama

1. Install Ollama and download a model, for example with `ollama pull`.
2. Set `OLLAMA_ORIGINS` so Ollama accepts requests from the extension, as shown below for your system.
3. In Nanobrowser, open **Settings → Providers**, choose **Ollama** in **Add a provider** and click **Add a provider**. The **Server address** is `http://localhost:11434`.
4. Click **List models**, pick your model and click **Add**.
5. Click **Test models**.

### macOS

Run this in Terminal, then quit and reopen Ollama:

```sh
launchctl setenv OLLAMA_ORIGINS "chrome-extension://*"
```

This lasts until you restart your Mac. Run it again after a restart.

### Windows

1. Open **Settings → System → About → Advanced system settings → Environment Variables**.
2. Add a user variable named `OLLAMA_ORIGINS`, with the value `chrome-extension://*`.
3. Quit Ollama from the taskbar and open it again.

Or run this in PowerShell, then quit and reopen Ollama:

```powershell
setx OLLAMA_ORIGINS "chrome-extension://*"
```

### Linux

If Ollama runs as a systemd service, which is how the Linux install script sets it up, edit the service:

```sh
sudo systemctl edit ollama.service
```

Add these lines, then save:

```ini
[Service]
Environment="OLLAMA_ORIGINS=chrome-extension://*"
```

Restart Ollama:

```sh
sudo systemctl restart ollama
```

If you start Ollama yourself, start it like this:

```sh
OLLAMA_ORIGINS="chrome-extension://*" ollama serve
```

## Use LM Studio

1. Install LM Studio, download a model and load it with a context of 16k or more.
2. In LM Studio's Developer settings, turn on **Enable CORS**, then start the server. It runs on port 1234.
3. In Nanobrowser, open **Settings → Providers**, choose **LM Studio** in **Add a provider** and click **Add a provider**. The **Server address** is `http://localhost:1234`.
4. Click **List models**, pick your model and click **Add**.
5. Click **Test models**.

If **Enable CORS** is off, Nanobrowser shows:

`LM Studio refused the request. Turn on "Enable CORS" in LM Studio's Developer settings, then try again.`

## Good to know about Ollama and LM Studio

- **No key.** There is no key field.
- **`/v1` is added for you.** Type the server's address, like `http://localhost:11434`. Nanobrowser adds `/v1` to the end. An address that already ends in `/v1` works too.
- **One request at a time.** Nanobrowser sends one request at a time to each Ollama or LM Studio server, so tasks you run at once take turns.

## Use llama.cpp, vLLM or another server

Use the **OpenAI-compatible** provider.

1. In **Settings → Providers**, choose **OpenAI-compatible** in **Add a provider** and click **Add a provider**.
2. In **Server address**, type the full address, including `/v1`, such as `http://localhost:8000/v1`. Nanobrowser adds nothing to it.
3. Fill in **API key (if the server needs one)** only if your server asks for one.
4. Click **List models**, or type the model name, then click **Add**.
5. Click **Test models**.

Good to know:

- **Tasks don't take turns.** Requests go to these servers as they come. If yours handles one at a time, run one task at a time.
- **CORS.** The server must allow requests from browser extensions. See [The server refused the request](https://nanobrowser.ai/docs/troubleshooting#cors).
