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

# Add API keys to local models: Ollama, vLLM, and llama.cpp

> Ollama has no API key mechanism. vLLM and llama.cpp offer 1 static key. Tokios adds real, scoped sk-tok- keys per person or service — no reverse proxy needed.

Local model runtimes were not built for multi-user auth. **Ollama has no API-key mechanism at all** — its maintainers point users toward fronting it with a reverse proxy like nginx or Caddy. vLLM, llama.cpp, and LM Studio each offer at most 1 static, optional key. Tokios gives every registered model a real, scoped `sk-tok-` key per person or service, with no reverse proxy, TLS certificate, or firewall rule for you to manage.

## Ollama API key — the short answer

Ollama does not have API keys. When you run `ollama serve`, the API at `http://localhost:11434` accepts requests from anyone who can reach the port. There is no `--api-key` flag, no `Authorization` header check, and no per-user scoping in Ollama itself.

If you need to control who can call your Ollama model, you have 2 options:

1. **Reverse proxy** (nginx, Caddy) — add HTTP basic auth or token validation in front of Ollama. You manage the proxy config, TLS certificates, and key rotation yourself.
2. **Tokios connector** — pair a connector next to Ollama, register a deployment, and create scoped `sk-tok-…` keys in the dashboard. No proxy config, no TLS, no inbound ports. See [How Tokios adds keys](#how-tokios-adds-keys) below.

## What each runtime gives you today

These aren't shortcomings — the runtimes below are built for serving models, not for multi-tenant access control. That's the layer Tokios adds on top. Per each project's own documentation:

| Runtime | Built-in auth | Notes |
| - | - | - |
| **Ollama** | None | No API-key mechanism. Maintainers direct users who need auth to put a reverse proxy (nginx, Caddy) in front of it. |
| **vLLM** | Single static `--api-key` | One shared key for the whole server. vLLM's own security guidance says not to rely on it exclusively, and it only covers the `/v1` OpenAI-compatible routes. |
| **llama.cpp server** | Optional `--api-key` | Off by default; when set, it's a single shared key, not per-user. |
| **LM Studio** | Optional token auth | Off by default and intended for local network use, not per-user or per-team access. |

None of these give you per-person keys, scoping to specific models, or a way to revoke one caller without breaking the others. That's the gap Tokios fills.

## How Tokios adds keys

Tokios sits between your clients and your local runtime. Once your connector is paired and your model is registered as a deployment, every request to it authenticates with a Tokios API key — not with anything Ollama, vLLM, llama.cpp, or LM Studio issued.

**1. Register your model**

Pair a connector and give your model a **public name** (the deployment) in the [Models](https://tokios.com/console/models) tab. See [Register Model](https://docs.tokios.com/setup/register-model.md) if you haven't done this yet.

**2. Create a key on the Keys tab**

Open the **[Keys](https://tokios.com/console/keys)** tab and click **Create key**. Give it a display name, and optionally scope it with **model patterns** — comma-separated globs like `gemma*, gpt-4*` — so the key only reaches the deployments it needs. Leave it as `*` to allow all your models.

**3. Copy the key**

The key is shown only once, as `sk-tok-...`. Copy it immediately and store it in a password manager or secrets vault. You can hold up to 50 active keys, and each one can be edited, rotated, disabled, or deleted later.

**4. Authenticate requests**

Send the key as a Bearer token in the `Authorization` header:

```bash 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": "gemma-tunnel", "messages": [{"role": "user", "content": "Hello"}]}'
```

For the full mechanics of creating, rotating, and revoking keys, see [API Keys](https://docs.tokios.com/setup/api-keys.md).

## Give each teammate or service its own key

Because a shared static key (or no key at all) can't tell one caller from another, treat Tokios keys the way you'd treat any credential handed to more than one person:

* **One key per person or environment.** Issue a separate key for each teammate, CI job, or service. If someone leaves the team or a laptop goes missing, disable that one key on the **Keys** tab — everyone else keeps working.
* **Scope keys to only the models they need.** Set model patterns per key. A key scoped to `gemma*` can't touch a `gpt-4*` deployment, even if both run behind the same connector.
* **A leaked key can't reach another tenant.** Keys are scoped to your account and, optionally, to specific deployments — so a key that leaks can't be used to reach models outside what it was issued for.

> [!TIP]
>
> The fastest way to hand someone a scoped key is **Share Key** on the Keys tab — it mints a dedicated key and emails them a one-time reveal link (the key is never in the email), with its own model scope, optional passphrase and expiry, and one-click revoke. See [Share a key by email](https://docs.tokios.com/setup/api-keys.md#share-a-key-by-email).

When a key tries to call a deployment it isn't scoped for, Tokios rejects the request with **HTTP 403**:

```bash 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": "gpt-4-tunnel", "messages": [{"role": "user", "content": "Hello"}]}'
```

A `403` means the key isn't allowed to use that model (or the account is suspended); a `404` means the deployment name doesn't exist. See [API endpoints](https://docs.tokios.com/reference/api-endpoints.md#error-codes) for the full list.

> [!TIP]
>
> Rotate a key the same way you'd rotate any credential: create a replacement, update the caller, then disable the old key once traffic has moved over.

## What's next?

> [accordion] How do I generate an Ollama API key?
>
> You cannot generate an API key from Ollama itself — it has no key mechanism. To add auth in front of Ollama, use Tokios: create a key on the [Keys](https://tokios.com/console/keys) tab, copy the `sk-tok-…` value, and send it as `Authorization: Bearer sk-tok-YOUR_KEY` in your API requests. Tokios handles auth, scoping, and revocation.

> [accordion] Does vLLM have API keys?
>
> vLLM supports 1 static `--api-key` flag when you start the server (for example `vllm serve model --api-key my-key`). It is a single shared key for all users, and vLLM's own security guidance says not to rely on it exclusively. For per-user keys, add Tokios on top.

> [accordion] Can I add API keys to llama.cpp server?
>
> The llama.cpp server accepts an optional `--api-key` flag, but it is a single shared key with no per-user scoping. Tokios gives each person or service their own `sk-tok-…` key, scoped to specific models.

> [card] [API keys](https://docs.tokios.com/setup/api-keys.md)
>
> Full mechanics of creating, scoping, rotating, and revoking keys.

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

> [card] [Register model](https://docs.tokios.com/setup/register-model.md)
>
> Give your local model the public name clients will call.

> [card] [Ollama remote access](https://docs.tokios.com/guides/ollama-remote-access.md)
>
> Reach an Ollama instance from another machine without opening inbound ports.


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