# Connect Ollama

> Ollama takes no key at all - only an address - so the whole failure surface here is whether your browser is allowed to talk to the runtime.

- Canonical: https://big-agi.com/docs/connect-ollama
- Minimum tier: open  [Open ⊂ Free ⊂ Pro - a tier only ever ADDS to the Open baseline]
- Kind: provider · Last content update generation: 2026-07-27 · Review by: 2026-10-27
- Answers: What address do I enter for Ollama? · Why don't my pulled models show up? · Do I have to self-host Big-AGI to use Ollama?

Ollama issues no key. Big-AGI needs an address, and the entire failure surface is reachability: whether your browser is permitted to talk to the runtime. The hosted app connects to a local runtime as happily as a self-hosted one ([models on your own machine](/docs/connect-models#models-on-your-own-machines)).

## Installing it and pulling a model

Take the runtime from [ollama.com/download](https://ollama.com/download/), then pull one model with `ollama pull <model>`. Weights are large and speed follows your memory and GPU, so start small.

## The address it serves on

Once running, the runtime serves at `http://127.0.0.1:11434`. [Ollama's own FAQ](https://docs.ollama.com/faq) states it binds that address and port by default.

## Letting your browser talk to it

The runtime accepts `127.0.0.1` and `0.0.0.0` as browser origins and refuses the rest until you list them in its `OLLAMA_ORIGINS` variable. You need that when Big-AGI is loaded from a web address and dials the runtime from your browser. The FAQ carries the per-OS instructions; set the variable and restart the runtime.

## The address Big-AGI needs

Open **Models** (`Ctrl + Shift + M`) and press **More Services** if the **Setup AI Models** wizard appears. Then **Add** -> **Ollama**, paste into **Ollama Host**, and press **Models** - the list filling in below is your confirmation ([add and manage your keys](/docs/connect-models)).

The models you pulled filling the list below is the confirmation.

## Direct Connection, recommended here

Always eligible here, and usually the setting that makes this work. With it off, the fetch is made by the Big-AGI fast edge servers, which cannot see your `127.0.0.1`. The toggle says as much in a green tooltip: `Recommended ON for local services`.

> **Direct Connection works only with your API key stored in the browser**, and with an AI service that permits direct browser calls (CORS). Where it cannot be used, requests route through the Big-AGI fast edge servers instead - everything still works, within the standard upload size and time limits.

Big-AGI server is fine; arrow Big-AGI server -> Ollama crosses back into the outline and carries a red x. RIGHT panel, two stacked rows sharing the same machine outline. Row 1 "Solution 1 - Direct Connection ON": one arrow straight from the browser to Ollama 127.0.0.1:11434, both inside the outline, the server box greyed out and bypassed. Row 2 "Solution 2 - run Big-AGI locally": the Big-AGI server box moved INSIDE the outline, arrow browser -> server -> Ollama, all green. Only hostname anywhere is 127.0.0.1:11434.'
>
  Two panels: with Direct Connection off, the fetch is made by a Big-AGI server that sits outside your machine and has no route to your `127.0.0.1`. Turning Direct Connection on sends the request from your browser straight to the runtime. Running Big-AGI on your own machine puts the server inside the same machine instead.

## Ollama behind an nginx proxy

The third route gives the runtime an address a server elsewhere can reach: nginx on the same machine as Ollama, under a domain you control.

```bash
sudo apt install nginx certbot python3-certbot-nginx
sudo certbot --nginx -d yourdomain.com
```

Then the location block, in that server's nginx config:

```nginx
location /ollama/ {
    proxy_pass http://127.0.0.1:11434/;
    # Disable buffering for the streaming responses (SSE)
    proxy_set_header Connection '';
    proxy_http_version 1.1;
    chunked_transfer_encoding off;
    proxy_buffering off;
    proxy_cache off;
    # Longer timeouts (1hr)
    keepalive_timeout 3600;
    proxy_read_timeout 3600;
    proxy_connect_timeout 3600;
    proxy_send_timeout 3600;
}
```

**Ollama Host** then takes `https://yourdomain.com/ollama`. The buffering and cache lines keep streamed tokens arriving one at a time; the hour-long timeouts cover a slow first token on a cold model. `chunked_transfer_encoding off` belongs to this hop, the one in front of Ollama - do not copy it into a proxy that fronts Big-AGI itself.

The runtime issues no credential, so whoever reaches that URL is using your hardware. Put authentication in front of the location block.

## When this doesn't work

| What you see | What it means | What to do |
|---|---|---|
| `[Ollama network issue]: Could not connect:` | Wrong address, or the runtime is not running. | [I don't see the model I want](/docs/issue-messages) |
| `403 Forbidden` from `127.0.0.1:11434` | The runtime is refusing your browser's origin. | Set `OLLAMA_ORIGINS` per the FAQ: [my local models don't show up](/docs/issue-messages) |

## Related

- [Models on your own machine](/docs/connect-models#models-on-your-own-machines)
- [What leaves your browser](/docs/privacy-data-flow)
- [I don't see the model I want](/docs/issue-messages)
