Keys / Hugging Face
HF_TOKEN
The Hugging Face User Access Token your app reads models and calls Hugging Face services with.
- Starts with
hf_- Expires
- after a year without use
- API
- none for user tokens; organization service account tokens: create, rotate and delete
Get it
Create one on huggingface.co/settings/tokens. The steps aren't recorded yet.
Set it
HF_TOKEN=hf_...
The huggingface_hub Python library reads it from this variable before the token saved by hf auth login. Or keep it out of .env with keypin: keypin run -- npm run dev
Replace it
- Create a new token with the same role or fine-grained permissions as the old one. Refresh, under Manage, changes the value in place instead.
- Deploy it everywhere that reads
HF_TOKEN. - Check that it works, then delete the old token on the Access Tokens page.
Set rotate_every on the key in keypin.toml and a rotated date on its vault item, and keypin status shows when it's due.