Jan’s local API server listens on your machine, and by default any local program can call it. The server has an optional API key: set it, and every client must send it as a Bearer token — a cheap layer of protection the moment another program on the machine could reach the port.
Set the key in Jan and send it as a Bearer token
In Jan’s local API server settings, set the API key to a long random string and save it. Clients then send it in the Authorization header: Authorization: Bearer <your-key>. A client without the header, or with the wrong key, gets a 401 error — that is the server telling you the key is working.
curl http://127.0.0.1:1337/v1/models -H "Authorization: Bearer <your-key>"
The key is optional in Jan, which means it is off until you turn it on — do not assume a fresh install is protected. Keep the key out of screenshots and shared configs, and rotate it if it ever leaks: the key is the only thing standing between the port and a caller.
Try it: four checks
| Check | What you should see | If you do not see it |
|---|---|---|
| Key set | The API key is saved in the server settings | Use a long random string |
| Client sends it | The curl call carries the Bearer header | Check the header spelling |
| Wrong key fails | A wrong key gets a 401 | That is the protection working |
| No key fails | A call without the header gets a 401 | Turn the key on first |
Expected result. We checked the Jan local API server docs, which describe the optional API key sent as an Authorization Bearer token and list 401 among the server’s errors. We did not set a key on this machine.
Limits
This guide covers the API key only. The key protects the API, not the Jan app itself. We did not test any key ourselves.
