Skip to content
zgrok ai

Ollama, public URL.

Ollama listens on port 11434 and binds to loopback. You do not need to change that. Point zgrok at the port instead: the tunnel rewrites the request Host to localhost:11434 on its way to the model, and carries the public hostname separately as X-Forwarded-Host.

~/app · Ollama on :11434
$ zgrok ai
✓ Online · llm--acme-shop.zgrok.io → localhost:11434
GET/api/tags2004 ms
POST/api/generate2006.1 s
POST/v1/chat/completions401edge
POST/v1/chat/completions2009.4 s
On this page

The setting you were about to change

Ollama's own documentation states the default bind as 127.0.0.1 port 11434, and names OLLAMA_HOST as the way to change it. Setting that to 0.0.0.0 is the shortest route to reaching the model from another machine, and it is worth a minute of thought before you use it.

The listener it produces has nothing in front of it. Ollama's published request examples, native and OpenAI-compatible alike, carry no credential at all, which is a reasonable shape for something only reachable from the machine it runs on. Widen the bind address and that stops being a simplification: anything that can route a packet to port 11434 on your machine can pull models, spend your GPU and read the prompts going through it. On a shared network that is everyone on the network. Forward the port on a router to reach it from outside the building and the set of people is no longer one you can describe.

It also only half solves the problem you had. A wildcard bind makes you reachable from your own network. It does not give you a name that resolves, a certificate, or a way through a router you may not administer. zgrok ai leaves OLLAMA_HOST where it is: the model keeps listening exactly where it already listens, and the address other people use belongs to the tunnel.

One command

$ zgrok ai 11434

With no port at all it is the same command: 11434 is what zgrok ai falls back to when neither the command line nor your config names a port. On the strength of that port the banner labels the tunnel Ollama, and hands you a Base URL with /v1 already appended plus the Token every request needs.

If you did not supply a token, zgrok generates one for the session, a zg_ai_ prefix followed by 24 hex characters, and prints a note underneath saying it will not be shown again. Copy it then.

Two values come off that banner and they are the only two anything needs: the address, and the token.

Calling it

Both of Ollama's HTTP surfaces are reachable through the tunnel. zgrok rewrites the head of a request and copies the rest through, so the path and the body are whatever you would have sent to localhost. The difference is the host, one header removed and one added.

Ollama's native endpoint:

bash
curl https://llm--acme-shop.zgrok.io/api/generate \
  -H "Authorization: Bearer zg_ai_xxxxxxxxxxxxxxxxxxxxxxxx" \
  -d '{
    "model": "llama3.2",
    "prompt": "Why is the sky blue?",
    "stream": false
  }'

And the OpenAI-compatible one, which is the /v1 the printed Base URL already ends in:

bash
curl https://llm--acme-shop.zgrok.io/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer zg_ai_xxxxxxxxxxxxxxxxxxxxxxxx" \
  -d '{
    "model": "gpt-oss:20b",
    "messages": [{ "role": "user", "content": "Say this is a test" }]
  }'

Substitute your own tunnel address, your own token and a model you have actually pulled. The shape of the bodies is Ollama's, documented by Ollama, and unchanged by the tunnel. stream is spelled out in the first example only because Ollama documents it as defaulting to on for /api/generate, so leaving it out gives you a series of responses rather than one.

What a wrong token gets you

A 401, and nothing else happens.

The token check runs at the edge of the tunnel server, before any QUIC stream to your machine is opened, so a request with a missing or wrong Authorization header never reaches the port Ollama is listening on and never wakes your GPU. A command-line client gets a small JSON body whose detail reads missing or invalid Bearer token; something that looks like a browser gets the same status as a page.

The comparison

The comparison itself is constant-time, so it leaks nothing about the token's contents.

The scheme

The header name and the Bearer scheme are matched case-insensitively, which is what makes the tunnel work with clients that spell them their own way.

The token

The token after the scheme has to match exactly, and once it does, zgrok strips the Authorization header out of the request head before forwarding: Ollama never receives your zgrok token, so it cannot end up in a local log.

The Host header

The request that arrives at your machine is addressed to localhost:11434, not to the public hostname it came in on. That is the rewrite in the first paragraph, and it applies to every AI tunnel rather than being something switched on for Ollama. The public hostname is not thrown away: it is forwarded as X-Forwarded-Host, so anything behind the tunnel that needs to know the outside name can still read it.

The practical consequence is the reason this page exists.

A server configured to accept only requests addressed to a loopback host sees requests addressed to a loopback host, and you do not have to widen that configuration to put a public URL in front of it.
ARRIVESHost: llm--acme-shop.zgrok.io
REACHES OLLAMAHost: localhost:11434X-Forwarded-Host: llm--acme-shop.zgrok.io

Streaming, and models that think first

Streaming

"stream": true behaves the way it does locally. Once the response head is through, the tunnel writes bytes onward as it reads them, so tokens arrive as they are produced instead of collecting somewhere until the generation finishes.

Models that think first

An AI tunnel has no first-byte deadline, so a cold model loading weights or a non-streaming completion chewing through a long context is not cut off for taking its time. What the tunnel waits on instead is on the pillar page.

When it does not answer

The status says which half to look at. A 401 is the token, covered above. The other two are about where the request stopped.

404

No tunnel has this address

The tunnel is not running, or it came back under another name: on Free the assigned address changes when you restart zgrok. Compare the host in your request with the Forwarding line in the terminal. Ollama also answers 404 itself for a model you have not pulled, and then the body is its own JSON.
503

Nothing is listening on the port

The tunnel is up and Ollama is not. The page says Local server not running and names the port zgrok tried. Start Ollama and send the request again: the tunnel does not need a restart.

Next

Run your first tunnel.

Free to start. $9 for a URL that stays. You pay for features, never for traffic.