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:
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:
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.
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 scheme
Bearer scheme are matched case-insensitively, which is what makes the tunnel work with clients that spell them their own way.The token
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.
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
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.
No tunnel has this address
404 itself for a model you have not pulled, and then the body is its own JSON.