> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tokios.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Tokios exposes private local models through https://api.tokios.com using an outbound-only connector tunnel.
> Use 'connector' for the local tokios-connector process.
> Use 'deployment' for the public model name in the API model field.
> Use 'upstream model id' for the model served by Ollama, llama.cpp, vLLM, LM Studio, or another local backend.
> API keys use the prefix sk-tok-. Connector tokens use the prefix ct-tok-.

# Ollama remote access without OLLAMA_HOST=0.0.0.0

> How to reach Ollama from another machine without setting OLLAMA_HOST=0.0.0.0 or forwarding port 11434. Keep it on localhost, add authenticated access.

By default, Ollama listens on `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.

> [!TIP]
>
> **Beginner-friendly.** Ollama is the quickest way to run a local model — `ollama run <model>` and you're serving. It's a great first backend for Tokios.

## 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.

> [accordion] OLLAMA\_HOST=0.0.0.0 (bind to all interfaces)
>
> This makes Ollama listen on every network interface, not just loopback. Ollama does not ship built-in authentication, so anything that can reach the port can call the API — list models, run inference, pull models — with no credential. Security researchers (SentinelLABS/Censys, 2026) reported roughly 175,000 Ollama hosts exposed this way and reachable from the open internet.

> [accordion] Port forwarding on your router
>
> Forwarding `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.

> [accordion] Tailscale
>
> Tailscale solves personal access well — your own devices join a private mesh network (a "tailnet") and can reach each other securely. The catch is for anything beyond personal use: teammates or SaaS clients that need to call your model have to join your tailnet first, which doesn't fit a public API key model. Tailscale Funnel can publish a service publicly, but it's restricted to a fixed set of ports and its bandwidth is not configurable.

> [accordion] Cloudflare Tunnel
>
> Cloudflare Tunnel routes traffic through Cloudflare's edge with no inbound port required, which is the right shape. But by default Cloudflare buffers responses rather than streaming them unless the response carries a `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.

> [accordion] ngrok (free tier)
>
> ngrok is quick to set up and works well for demos. The free tier caps usage at 1 GB of data and 20,000 requests per month, and free tunnels show an interstitial warning page to visitors before they reach your service — both are fine for a demo link, less fine for a teammate or agent calling the API programmatically all day.

> [!NOTE]
>
> None of this is a knock on these tools — they're solving a different problem (device mesh networking, edge proxying, quick demo links). Tokios is purpose-built for one thing: turning a local model endpoint into an authenticated API you can call from anywhere.

## The outbound-only way

**1. Run Ollama locally, as usual**

Keep Ollama on `127.0.0.1` — don't set `OLLAMA_HOST`. Pull and run your model:

```bash theme={"theme":{"light":"github-light","dark":"css-variables"}}
ollama run llama3
```

Leave it listening on the default `http://127.0.0.1:11434`.

**2. Pair the Tokios connector**

Sign in at [tokios.com/console](https://tokios.com/console), open the **Setup** tab, and click **Start pairing**. Tokios shows a one-time **claim code** like `TKS-XXXX-XXXX`, valid for about 15 minutes.

On the machine running Ollama, run the install one-liner for your OS:

```powershell Windows theme={"theme":{"light":"github-light","dark":"css-variables"}}
irm https://tokios.com/downloads/install/windows | iex; tokios-install -Code 'TKS-XXXX-XXXX'
```

```bash macOS theme={"theme":{"light":"github-light","dark":"css-variables"}}
curl -fsSL https://tokios.com/downloads/install/macos | sh -s -- --code TKS-XXXX-XXXX
```

```bash Linux theme={"theme":{"light":"github-light","dark":"css-variables"}}
curl -fsSL https://tokios.com/downloads/install/linux | sh -s -- --code TKS-XXXX-XXXX
```

Already have `tokios-connector` installed? Pass the code directly instead:

```bash theme={"theme":{"light":"github-light","dark":"css-variables"}}
tokios-connector TKS-XXXX-XXXX
```

Back in the console, **approve** the device on the **Setup** or **Connectors** tab. The connector's token is delivered over the tunnel once approved — you never see it on screen or paste it into a file.

**3. Point the connector at Ollama's /v1 API**

Ollama exposes an OpenAI-compatible surface at `/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:

```json theme={"theme":{"light":"github-light","dark":"css-variables"}}
{
  "Upstream": {
    "BaseUrl": "http://127.0.0.1:11434/v1"
  }
}
```

See [Connector config](https://docs.tokios.com/reference/connector-config.md) for the full multi-model file format.

**4. Register a deployment**

In the [Models](https://tokios.com/console/models) tab, register the Ollama model and choose a **public name** — for example, `llama3-tunnel`. That public name, not Ollama's local model id, is what clients send in the `model` field.

**5. Create an API key**

In the [Keys](https://tokios.com/console/keys) tab, click **Create key**. Optionally scope it to specific deployments with model-name patterns (comma-separated globs, `*` 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.

```bash curl theme={"theme":{"light":"github-light","dark":"css-variables"}}
curl https://api.tokios.com/v1/chat/completions \
  -H "Authorization: Bearer sk-tok-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "llama3-tunnel",
    "stream": true,
    "messages": [{"role": "user", "content": "Hello!"}]
  }'
```

```python Python (OpenAI SDK) theme={"theme":{"light":"github-light","dark":"css-variables"}}
from openai import OpenAI

client = OpenAI(
    base_url="https://api.tokios.com/v1",
    api_key="sk-tok-YOUR_KEY",
)

response = client.chat.completions.create(
    model="llama3-tunnel",
    messages=[{"role": "user", "content": "Hello!"}],
    stream=True,
)

for chunk in response:
    print(chunk.choices[0].delta.content or "", end="")
```

```bash Claude Code theme={"theme":{"light":"github-light","dark":"css-variables"}}
export ANTHROPIC_BASE_URL=https://api.tokios.com
export ANTHROPIC_API_KEY=sk-tok-YOUR_KEY
claude --model llama3-tunnel
```

> [!TIP]
>
> The `model` field is always your registered **deployment** name (`llama3-tunnel` above), never Ollama's local model id. See [Use Claude Code](https://docs.tokios.com/guides/claude-code.md) for persisting the environment variables across sessions.

## Tokios vs Ollama Cloud

Ollama also offers **Ollama Cloud** — hosted models you reach with `ollama 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.

| | Ollama Cloud | Tokios + local Ollama |
| - | - | - |
| Where the model runs | Ollama's servers | Your machine |
| Your prompts / data | Sent to Ollama's cloud | Stay on your hardware |
| Auth | Ollama account / API key | Your own `sk-tok-…` keys — per-teammate, scoped, revocable |
| Model choice | Ollama's cloud catalog | Anything you can run locally |

Both can coexist: run small models locally behind Tokios and reach a `:cloud` model when you need one — but only the local path keeps your data on hardware you own.

## FAQ

> [accordion] What port does Ollama use?
>
> Ollama listens on port **11434** by default, bound to `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`.

> [accordion] How do I expose Ollama to my network?
>
> Set the environment variable `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.

> [accordion] Does Ollama have an API key?
>
> No. Ollama itself has no built-in authentication — it was built for local serving, not multi-tenant access control. The Ollama maintainers recommend putting a reverse proxy (nginx, Caddy) in front of it if you need auth. Tokios adds scoped `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.

> [accordion] How do I call Ollama with curl?
>
> Ollama exposes both native and OpenAI-compatible endpoints. For the native API: `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`).

> [accordion] Can I use Ollama with OLLAMA\_ORIGINS for cross-origin requests?
>
> Yes. Ollama allows cross-origin requests from `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.

> [accordion] Does streaming work?
>
> Yes. Set `"stream": true` and Tokios returns standard server-sent events (SSE) in OpenAI or Anthropic format, depending on which API surface you called.

> [accordion] Can I share access with teammates without sharing my Ollama instance directly?
>
> Yes. Create a separate `sk-tok-…` key per teammate in the [Keys](https://tokios.com/console/keys) tab, and scope each key to only the deployments they need. Revoking a key stops it from authenticating immediately, so you can cut off access without touching Ollama or the connector.

> [accordion] Can I expose more than 1 Ollama model?
>
> Yes. Register additional deployments in the [Models](https://tokios.com/console/models) tab, or use a `tokios-connector.json` config file to define multiple upstreams and routes for a single connector. See [Connector config](https://docs.tokios.com/reference/connector-config.md).

> [accordion] Does this use Ollama's native /api endpoints?
>
> No. Tokios speaks the OpenAI Chat Completions surface, so it talks to Ollama's `/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.

> [card] [Quickstart](https://docs.tokios.com/quickstart.md)
>
> Pair a connector and register your first model end to end.

> [card] [API keys](https://docs.tokios.com/setup/api-keys.md)
>
> Create, scope, and rotate `sk-tok-…` keys for teammates and agents.

> [card] [Drive it with a coding agent](https://docs.tokios.com/use-cases/coding-agents.md)
>
> Point Claude Code, Codex, Cline, or Cursor at your Ollama model through Tokios.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.