127.0.0.1:11434 — only your own machine can reach it. Setting OLLAMA_HOST=0.0.0.0 makes it listen on every network interface, but Ollama has no built-in authentication: anything that can reach port 11434 can call the API with no credential. Keep Ollama on localhost and run the Tokios connector next to it instead: the connector dials out to https://api.tokios.com, and your tools, teammates, or agents call 1 authenticated endpoint from anywhere.
What people try first — and the catch
Each of these is a reasonable general-purpose tool. None were built for “expose a local inference API to the internet,” so each has a documented limit that shows up specifically in that workload.OLLAMA_HOST=0.0.0.0 (bind to all interfaces)
OLLAMA_HOST=0.0.0.0 (bind to all interfaces)
Port forwarding on your router
Port forwarding on your router
11434 to your machine has two separate problems. If your ISP uses CGNAT, you don’t have a stable public IP to forward to in the first place. If you do get a port open, internet-wide scanners like Shodan and Censys index exposed services within hours to days — and, same as above, there’s no authentication behind the port unless you build it yourself.Tailscale
Tailscale
Cloudflare Tunnel
Cloudflare Tunnel
text/event-stream content-type header, and proxied requests are subject to Cloudflare’s proxy timeouts (around 100 seconds on the free tier, shorter on some plans) — long generations can get cut off mid-stream.ngrok (free tier)
ngrok (free tier)
The outbound-only way
Run Ollama locally, as usual
127.0.0.1 — don’t set OLLAMA_HOST. Pull and run your model:http://127.0.0.1:11434.Pair the Tokios connector
TKS-XXXX-XXXX, valid for about 15 minutes.On the machine running Ollama, run the install one-liner for your OS:tokios-connector installed? Pass the code directly instead:Point the connector at Ollama's /v1 API
/v1, and that’s what Tokios talks to — not Ollama’s native /api endpoints. For the basic single-model path, the console’s Setup wizard uses http://127.0.0.1:11434/v1 as the upstream automatically. If you’re serving multiple models through a tokios-connector.json config, set the upstream BaseUrl explicitly:Register a deployment
llama3-tunnel. That public name, not Ollama’s local model id, is what clients send in the model field.Create an API key
* for all). Copy the sk-tok-… key now — it’s shown only once.Use it from anywhere
Once you have a deployment name and an API key, any OpenAI- or Anthropic-compatible client can reach your Ollama model — from another machine, a teammate’s laptop, or a hosted agent.Tokios vs Ollama Cloud
Ollama also offers Ollama Cloud — hosted models you reach withollama run <model>:cloud or an Ollama API key, where the weights run on Ollama’s infrastructure and are proxied through your local ollama daemon while you’re signed in. It’s a fine managed option, but it’s the opposite of self-hosting: your prompts leave for Ollama’s servers, and a :cloud tag has no local weights for you to control. (Some frontier models — Kimi, MiniMax, the largest Nemotron tier — are :cloud-only on Ollama for exactly this reason.)
Tokios is for the other case: the model runs on your hardware, and Tokios only puts an authenticated endpoint in front of it. You keep the weights, the data path, and the keys.
:cloud model when you need one — but only the local path keeps your data on hardware you own.
FAQ
What port does Ollama use?
What port does Ollama use?
127.0.0.1 (localhost only). You can change the port and bind address with the OLLAMA_HOST environment variable — for example OLLAMA_HOST=0.0.0.0:11435 listens on all interfaces at port 11435. You can verify Ollama is running with curl http://localhost:11434.How do I expose Ollama to my network?
How do I expose Ollama to my network?
OLLAMA_HOST=0.0.0.0 (or OLLAMA_HOST=0.0.0.0:11434) and restart Ollama. On Linux with systemd, add Environment="OLLAMA_HOST=0.0.0.0:11434" under [Service] in ollama.service and run systemctl daemon-reload && systemctl restart ollama. On macOS, use launchctl setenv OLLAMA_HOST "0.0.0.0:11434". On Windows, set OLLAMA_HOST in your user environment variables and restart Ollama.Does Ollama have an API key?
Does Ollama have an API key?
sk-tok-… API keys without a reverse proxy: you pair a connector, register a deployment, and create a key — then callers authenticate against https://api.tokios.com instead of your raw Ollama port.How do I call Ollama with curl?
How do I call Ollama with curl?
curl http://localhost:11434/api/generate -d '{"model": "llama3", "prompt": "Hello"}'. For the OpenAI-compatible surface: curl http://localhost:11434/v1/chat/completions -d '{"model": "llama3", "messages": [{"role": "user", "content": "Hello"}]}'. From a remote machine, replace localhost with the server’s IP (requires OLLAMA_HOST=0.0.0.0).Can I use Ollama with OLLAMA_ORIGINS for cross-origin requests?
Can I use Ollama with OLLAMA_ORIGINS for cross-origin requests?
127.0.0.1 and 0.0.0.0 by default. Set OLLAMA_ORIGINS to add more origins — for browser extensions, use OLLAMA_ORIGINS=chrome-extension://*,moz-extension://*. This only affects browser-based clients; API clients using curl or SDKs are not subject to CORS.Does streaming work?
Does streaming work?
"stream": true and Tokios returns standard server-sent events (SSE) in OpenAI or Anthropic format, depending on which API surface you called.Can I expose more than 1 Ollama model?
Can I expose more than 1 Ollama model?
tokios-connector.json config file to define multiple upstreams and routes for a single connector. See Connector config.Does this use Ollama's native /api endpoints?
Does this use Ollama's native /api endpoints?
/v1 OpenAI-compatible API, not the native /api/generate or /api/chat endpoints.Your model never leaves your machine — your endpoint works everywhere
Ollama keeps doing exactly what it does today, on localhost, with no inbound ports and no exposed API. The connector only dials out. Everything past that — auth, routing, streaming — is one endpoint you can call from any machine, teammate, or agent you choose to give a key to.Quickstart
API keys
sk-tok-… keys for teammates and agents.