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 runollama 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:
- 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.
- 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 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:
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 tab. See Register Model if you haven’t done this yet.
2
Create a key on the Keys tab
Open the 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: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 agpt-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.
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 for the full list.
What’s next?
How do I generate an Ollama API key?
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 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.Does vLLM have API keys?
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.Can I add API keys to llama.cpp server?
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.API keys
Full mechanics of creating, scoping, rotating, and revoking keys.
Quickstart
Pair a connector, register a model, and make your first authenticated request end to end.
Register model
Give your local model the public name clients will call.
Ollama remote access
Reach an Ollama instance from another machine without opening inbound ports.