{"id":2444,"date":"2026-08-29T20:17:12","date_gmt":"2026-08-29T20:17:12","guid":{"rendered":"https:\/\/convly.ai\/?p=2444"},"modified":"2026-08-29T20:17:12","modified_gmt":"2026-08-29T20:17:12","slug":"hugging-face-token","status":"publish","type":"post","link":"https:\/\/convly.ai\/de\/hugging-face-token\/","title":{"rendered":"Hugging-Face-Token: So erstellen, speichern und verwenden Sie es"},"content":{"rendered":"<div class=\"convly-tldr\">\n<ul>\n<li><strong>What it is:<\/strong> a User Access Token (a string starting <code>hf_<\/code>) that authenticates you to the Hugging Face Hub. Create it in your account settings under <strong>Access Tokens<\/strong> \u2192 <strong>New token<\/strong> (<code>huggingface.co\/settings\/tokens<\/code>, login required).<\/li>\n<li><strong>How to use it:<\/strong> run <code>hf auth login<\/code> and paste it, or export <code>HF_TOKEN=hf_...<\/code>. Both work for <code>transformers<\/code>, <code>datasets<\/code>, <code>diffusers<\/code> and the <code>hf<\/code> CLI.<\/li>\n<li><strong>Which scope:<\/strong> <code>read<\/code> to download private or gated models, <code>write<\/code> to push, <code>fine-grained<\/code> for anything running in production.<\/li>\n<li><strong>Where it lands:<\/strong> <code>~\/.cache\/huggingface\/token<\/code> on Linux and macOS, <code>C:Users&lt;you&gt;.cachehuggingfacetoken<\/code> on Windows. The <code>HF_TOKEN<\/code> environment variable overrides the file.<\/li>\n<\/ul>\n<\/div>\n<p>A Hugging Face token is a User Access Token that authenticates your machine, script or CI job to the Hugging Face Hub. You create one in your account settings under the <strong>Access Tokens<\/strong> tab, choose a role (<code>read<\/code>, <code>write<\/code> or <code>fine-grained<\/code>), then either run <code>hf auth login<\/code> and paste it or set <code>HF_TOKEN<\/code> in your environment. Tokens look like <code>hf_...<\/code>.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_86 counter-flat ez-toc-counter ez-toc-container-direction\">\n<label for=\"ez-toc-cssicon-toggle-item-6a9374757c83b\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #000000;color:#000000\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #000000;color:#000000\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a9374757c83b\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/convly.ai\/de\/hugging-face-token\/#What_the_token_actually_authorises\" >What the token actually authorises<\/a><\/li><li class='ez-toc-page-1'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/convly.ai\/de\/hugging-face-token\/#The_three_token_types\" >The three token types<\/a><\/li><li class='ez-toc-page-1'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/convly.ai\/de\/hugging-face-token\/#Creating_a_token_step_by_step\" >Creating a token, step by step<\/a><\/li><li class='ez-toc-page-1'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/convly.ai\/de\/hugging-face-token\/#Logging_in_from_the_terminal\" >Logging in from the terminal<\/a><\/li><li class='ez-toc-page-1'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/convly.ai\/de\/hugging-face-token\/#Where_the_token_is_stored\" >Where the token is stored<\/a><\/li><li class='ez-toc-page-1'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/convly.ai\/de\/hugging-face-token\/#The_environment_variables_that_matter\" >The environment variables that matter<\/a><\/li><li class='ez-toc-page-1'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/convly.ai\/de\/hugging-face-token\/#Using_the_token_with_git\" >Using the token with git<\/a><\/li><li class='ez-toc-page-1'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/convly.ai\/de\/hugging-face-token\/#Using_the_token_for_hosted_inference\" >Using the token for hosted inference<\/a><\/li><li class='ez-toc-page-1'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/convly.ai\/de\/hugging-face-token\/#Gated_models_the_token_is_necessary_but_not_sufficient\" >Gated models: the token is necessary but not sufficient<\/a><\/li><li class='ez-toc-page-1'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/convly.ai\/de\/hugging-face-token\/#When_you_dont_need_a_token_at_all\" >When you don&#8217;t need a token at all<\/a><\/li><li class='ez-toc-page-1'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/convly.ai\/de\/hugging-face-token\/#Troubleshooting\" >Troubleshooting<\/a><\/li><li class='ez-toc-page-1'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/convly.ai\/de\/hugging-face-token\/#If_a_token_leaks\" >If a token leaks<\/a><\/li><li class='ez-toc-page-1'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/convly.ai\/de\/hugging-face-token\/#Frequently_asked_questions\" >Frequently asked questions<\/a><\/li><li class='ez-toc-page-1'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/convly.ai\/de\/hugging-face-token\/#Sources\" >Sources<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"What_the_token_actually_authorises\"><\/span>What the token actually authorises<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Three things, in practice: downloading files from private or gated repositories, pushing files to repositories you can write to, and calling <a href=\"https:\/\/huggingface.co\/docs\/inference-providers\/en\/index\" rel=\"noopener\" target=\"_blank\">Inference Providers<\/a> as a bearer token. Public model weights need no token at all \u2014 <code>hf download gpt2 config.json<\/code> works unauthenticated.<\/p>\n<p>Hugging Face&#8217;s docs describe the token as usable &#8220;<em>in place of a password<\/em>&#8221; for git and basic auth, which is the right mental model: it is a credential, not an API key tied to one product.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"The_three_token_types\"><\/span>The three token types<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<table>\n<thead>\n<tr>\n<th>Role<\/th>\n<th>Grants<\/th>\n<th>Use it for<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>read<\/code><\/td>\n<td>Read access to every repo you can already read, including private repos you or your orgs own<\/td>\n<td>Downloading gated weights, running inference, notebooks<\/td>\n<\/tr>\n<tr>\n<td><code>write<\/code><\/td>\n<td>Everything <code>read<\/code> does, plus write access to repos you can write to<\/td>\n<td>Pushing checkpoints, editing model cards, training runs that upload<\/td>\n<\/tr>\n<tr>\n<td><code>fine-grained<\/code><\/td>\n<td>Only the specific resources and permissions you tick<\/td>\n<td>Production apps, CI, anything shared with a team<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Hugging Face explicitly recommends fine-grained tokens for production use, on the grounds that the blast radius if one leaks is smaller and it can be shared inside an organisation without exposing your whole account. A typical production pattern: one org member requests access to a gated model, then mints a fine-grained token with read access to <em>that repo only<\/em>.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Creating_a_token_step_by_step\"><\/span>Creating a token, step by step<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ol>\n<li>Sign in, click your avatar (top right) \u2192 <strong>Settings<\/strong>.<\/li>\n<li>Open the <strong>Access Tokens<\/strong> tab \u2014 direct URL <code>huggingface.co\/settings\/tokens<\/code>.<\/li>\n<li>Click <strong>New token<\/strong>.<\/li>\n<li>Name it after the machine or app that will hold it (<code>laptop-read<\/code>, <code>ci-push<\/code>), not after yourself. One token per usage is the documented best practice, so you can revoke one without breaking the rest.<\/li>\n<li>Pick the role. For fine-grained, tick the individual permissions.<\/li>\n<li>Copy the value immediately. Later you can only delete or refresh it from the same page via <strong>Manage<\/strong>.<\/li>\n<\/ol>\n<p>If you are on a Team or Enterprise org with a token policy, a fine-grained token scoped to that org may land in a <strong>Pending<\/strong> state until an admin approves it \u2014 the token list shows an orange hourglass next to it, and calls against org resources return <code>403<\/code> until approval.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Logging_in_from_the_terminal\"><\/span>Logging in from the terminal<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The CLI shipped with <code>huggingface_hub<\/code> is called <code>hf<\/code>. Install and log in:<\/p>\n<pre><code>pip install huggingface_hub\nhf auth login<\/code><\/pre>\n<p>By default this now runs a browser device flow: it prints a URL (<code>https:\/\/huggingface.co\/oauth\/device<\/code>) and a short code such as <code>ABCD-EFGH<\/code>. Approve it in the browser and the CLI saves a token named <code>oauth-&lt;username&gt;<\/code> that refreshes itself as long as you keep using it. Choosing <em>Paste an access token<\/em> instead lets you supply a token you made by hand.<\/p>\n<p>Note on naming: older tutorials use <code>huggingface-cli login<\/code>. The command set has been reorganised under <code>hf auth ...<\/code>, and which spelling your machine accepts depends on the <code>huggingface_hub<\/code> version installed \u2014 run <code>hf --help<\/code> to see what you actually have.<\/p>\n<table>\n<thead>\n<tr>\n<th>Command<\/th>\n<th>What it does<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>hf auth login --token $HF_TOKEN<\/code><\/td>\n<td>Non-interactive login, safe for scripts<\/td>\n<\/tr>\n<tr>\n<td><code>hf auth login --token $HF_TOKEN --add-to-git-credential<\/code><\/td>\n<td>Also writes the token to your git credential helper<\/td>\n<\/tr>\n<tr>\n<td><code>hf auth login --force<\/code><\/td>\n<td>Re-login even if already authenticated<\/td>\n<\/tr>\n<tr>\n<td><code>hf auth whoami<\/code><\/td>\n<td>Prints your username and orgs; errors if not logged in<\/td>\n<\/tr>\n<tr>\n<td><code>hf auth list<\/code><\/td>\n<td>Lists the token names stored on the machine<\/td>\n<\/tr>\n<tr>\n<td><code>hf auth switch --token-name NAME<\/code><\/td>\n<td>Switches the active token<\/td>\n<\/tr>\n<tr>\n<td><code>hf auth token<\/code><\/td>\n<td>Prints the active token to stdout<\/td>\n<\/tr>\n<tr>\n<td><code>hf auth logout --token-name NAME<\/code><\/td>\n<td>Deletes one stored token (omit the flag to delete all)<\/td>\n<\/tr>\n<tr>\n<td><code>hf env<\/code><\/td>\n<td>Dumps token path, whether a token is saved, and configured git helpers<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Pass the token via <code>$HF_TOKEN<\/code> rather than typing the literal string \u2014 the docs warn against pasting raw tokens into command lines where shell history and CI logs can capture them.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Where_the_token_is_stored\"><\/span>Where the token is stored<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Multiple named tokens live in a <code>stored_tokens<\/code> file; the currently active one is mirrored to a plain <code>token<\/code> file. Both sit under <code>HF_HOME<\/code>, which defaults to <code>~\/.cache\/huggingface<\/code>.<\/p>\n<h3>Linux<\/h3>\n<p><code>~\/.cache\/huggingface\/token<\/code> and <code>~\/.cache\/huggingface\/stored_tokens<\/code>. If <code>XDG_CACHE_HOME<\/code> is set and <code>HF_HOME<\/code> is not, the base becomes <code>$XDG_CACHE_HOME\/huggingface<\/code> instead.<\/p>\n<h3>macOS<\/h3>\n<p>Same as Linux: <code>~\/.cache\/huggingface\/token<\/code>. Hugging Face does not use <code>~\/Library\/Caches<\/code> here, so don&#8217;t go looking there.<\/p>\n<h3>Windows<\/h3>\n<p>The path resolves from your home directory: <code>C:Users&lt;you&gt;.cachehuggingfacetoken<\/code>. Two Windows-specific quirks worth knowing. First, the model cache uses symlinks, which require Developer Mode or an admin shell; without them you get a warning and duplicated files on disk, silenceable with <code>HF_HUB_DISABLE_SYMLINKS_WARNING=1<\/code>. Second, if you point <code>HF_HUB_CACHE<\/code> at a NAS shared with Linux boxes, set <code>HF_HUB_DISABLE_SYMLINKS=1<\/code> \u2014 symlinks written on Linux are not reliably traversable on Windows.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"The_environment_variables_that_matter\"><\/span>The environment variables that matter<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<table>\n<thead>\n<tr>\n<th>Variable<\/th>\n<th>Effect<\/th>\n<th>Default<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>HF_TOKEN<\/code><\/td>\n<td>Supplies the token; <strong>overrides<\/strong> the token stored on disk<\/td>\n<td>unset<\/td>\n<\/tr>\n<tr>\n<td><code>HF_TOKEN_PATH<\/code><\/td>\n<td>Where the token file is read from and written to<\/td>\n<td><code>$HF_HOME\/token<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>HF_HOME<\/code><\/td>\n<td>Base folder for token plus cache<\/td>\n<td><code>~\/.cache\/huggingface<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>HF_HUB_DISABLE_IMPLICIT_TOKEN<\/code><\/td>\n<td>Stops the token being attached to read requests that don&#8217;t need it; it is then sent only for write calls<\/td>\n<td>off<\/td>\n<\/tr>\n<tr>\n<td><code>HUGGING_FACE_HUB_TOKEN<\/code><\/td>\n<td>Deprecated alias \u2014 still works, but no longer takes precedence over <code>HF_TOKEN<\/code><\/td>\n<td>\u2014<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Two gotchas. These variables are read at <em>import time<\/em> of <code>huggingface_hub<\/code>, so setting one after the import has no effect \u2014 restart the kernel. And <code>hf auth logout<\/code> cannot log you out of a token supplied via <code>HF_TOKEN<\/code>; you have to unset the variable.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Using_the_token_with_git\"><\/span>Using the token with git<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Cloning large repos over HTTPS prompts for a password \u2014 supply the token, not your account password:<\/p>\n<pre><code>git clone https:\/\/huggingface.co\/&lt;user&gt;\/&lt;repo&gt;\n# Username: your-hf-username\n# Password: hf_...<\/code><\/pre>\n<p>To avoid retyping, log in with <code>--add-to-git-credential<\/code>, which hands the token to your configured helper (<code>store<\/code> on Linux, Keychain on macOS, Windows Credential Manager on Windows). Confirm what&#8217;s wired up with <code>hf env<\/code>, which prints a <em>Configured git credential helpers<\/em> line.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Using_the_token_for_hosted_inference\"><\/span>Using the token for hosted inference<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The same token is the bearer credential for Inference Providers, which exposes an OpenAI-compatible endpoint at <code>https:\/\/router.huggingface.co\/v1<\/code>:<\/p>\n<pre><code>curl https:\/\/router.huggingface.co\/v1\/chat\/completions \n    -H \"Authorization: Bearer $HF_TOKEN\" \n    -H 'Content-Type: application\/json' \n    -d '{\"model\": \"openai\/gpt-oss-120b\", \"messages\": [{\"role\": \"user\", \"content\": \"hello\"}]}'<\/code><\/pre>\n<p>For this path a fine-grained token with the <strong>Make calls to Inference Providers<\/strong> permission is the tightest fit. On billing, Hugging Face publishes monthly credits of <a href=\"https:\/\/huggingface.co\/docs\/inference-providers\/en\/pricing\" rel=\"noopener\" target=\"_blank\">$0.10 for free accounts, $2.00 for PRO, and $2.00 per seat for Team and Enterprise orgs<\/a>, then pay-as-you-go at the provider&#8217;s own rates with no HF markup. Team and Enterprise orgs can centralise billing by sending <code>X-HF-Bill-To: my-org-name<\/code> as a header while each member keeps their own token.<\/p>\n<p>Those credits go fast at frontier-model rates \u2014 a model priced like <a href=\"https:\/\/convly.ai\/models\/\">Claude Opus 5 at $5.00 in \/ $25.00 out per 1M tokens<\/a> burns $2.00 in roughly 80k output tokens. Open-weights models are a different order of magnitude: Llama 3.3 70B runs $0.10 in \/ $0.32 out per 1M tokens, and Llama 3.1 8B $0.02 in \/ $0.03 out. Model our <a href=\"https:\/\/convly.ai\/ai-api-cost-calculator\/\">API cost calculator<\/a> against your token volume before wiring a token into anything that loops.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Gated_models_the_token_is_necessary_but_not_sufficient\"><\/span>Gated models: the token is necessary but not sufficient<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>For gated repos \u2014 most Llama and Gemma releases \u2014 a valid token only carries the access you have already been granted. Per <a href=\"https:\/\/huggingface.co\/docs\/hub\/en\/models-gated\" rel=\"noopener\" target=\"_blank\">Hugging Face&#8217;s gated models documentation<\/a>, the access request itself &#8220;<em>can only be done from your browser<\/em>&#8220;: open the model page while logged in, complete the form, click <strong>Agree<\/strong>. Approval is either automatic or manual, and authors can revoke it later without notice. Only then does <code>hf auth login<\/code> unlock the download in a script. Typically you&#8217;ll see a <code>401<\/code> when no token is sent and a <code>403<\/code> when the token is valid but your account lacks access.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"When_you_dont_need_a_token_at_all\"><\/span>When you don&#8217;t need a token at all<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Ungated public weights download without credentials, so a purely local stack often needs no token. <a href=\"https:\/\/convly.ai\/what-is-ollama-complete-guide-2026\/\">Ollama<\/a> pulls from its own registry entirely, and llama.cpp or LM Studio can fetch public GGUFs anonymously. What decides your setup is memory, not authentication: Llama 3.1 8B needs about 5 GB of VRAM at 4-bit and Llama 3.3 70B about 40 GB, while DeepSeek R1 wants roughly 400 GB and Kimi K3 around 1.4 TB \u2014 cluster territory. Check yours against the <a href=\"https:\/\/convly.ai\/llm-vram-calculator\/\">VRAM calculator<\/a> or the <a href=\"https:\/\/convly.ai\/vram-requirements-every-major-llm-2026\/\">per-model VRAM requirements table<\/a>.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Troubleshooting\"><\/span>Troubleshooting<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<table>\n<thead>\n<tr>\n<th>Symptom<\/th>\n<th>Likely cause<\/th>\n<th>Fix<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>401 Unauthorized<\/code><\/td>\n<td>No token sent, or it was deleted server-side<\/td>\n<td><code>hf auth whoami<\/code>; re-run <code>hf auth login --force<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>403<\/code> on a gated repo<\/td>\n<td>Token is fine; account lacks access<\/td>\n<td>Request access in the browser on the model page<\/td>\n<\/tr>\n<tr>\n<td><code>403<\/code> with &#8220;revoked by the organization administrator&#8221;<\/td>\n<td>Enterprise org revoked the token \u2014 permanent<\/td>\n<td>Delete it and create a new one<\/td>\n<\/tr>\n<tr>\n<td>Works in shell, fails in notebook<\/td>\n<td><code>HF_TOKEN<\/code> set after import, or a different kernel environment<\/td>\n<td>Restart the kernel; verify with <code>hf env<\/code><\/td>\n<\/tr>\n<tr>\n<td>Your private models missing from a listing<\/td>\n<td><code>HF_HUB_DISABLE_IMPLICIT_TOKEN=1<\/code> is set<\/td>\n<td>Pass <code>token=True<\/code> explicitly, or unset it<\/td>\n<\/tr>\n<tr>\n<td>Read token rejected by an org<\/td>\n<td>Org policy permits fine-grained tokens only<\/td>\n<td>Mint a fine-grained token scoped to that org<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2><span class=\"ez-toc-section\" id=\"If_a_token_leaks\"><\/span>If a token leaks<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Delete or refresh it from the Access Tokens tab. If you find <em>someone else&#8217;s<\/em> token \u2014 in a public repo, a Space, a log \u2014 you can invalidate it without owning the account, via <code>POST https:\/\/huggingface.co\/api\/credentials\/revoke<\/code> with a JSON body of <code>{\"credentials\": [\"hf_...\"]}<\/code>. Matching tokens die immediately and the owner is emailed. The endpoint always returns <code>202 Accepted<\/code> whether or not the token existed, so it can&#8217;t be abused to test whether a token is live. For CI, the cleaner answer is not storing a long-lived token at all: Trusted Publishers exchanges your CI provider&#8217;s OIDC identity for a short-lived Hub token per run.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Frequently_asked_questions\"><\/span>Frequently asked questions<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3>Is a Hugging Face token free?<\/h3>\n<p>Yes. Creating tokens costs nothing on any account tier, and there is no documented cap on how many you hold. Costs only appear when a token is used against paid compute \u2014 Inference Providers beyond your monthly credits, Inference Endpoints, upgraded Spaces hardware or Jobs.<\/p>\n<h3>Do Hugging Face tokens expire?<\/h3>\n<p>Tokens you create by hand in settings do not carry an expiry \u2014 they last until you delete or refresh them. Tokens minted by the browser device flow during <code>hf auth login<\/code> are the exception: they expire, but refresh automatically while you keep using them.<\/p>\n<h3>What&#8217;s the difference between read, write, and fine-grained?<\/h3>\n<p><code>read<\/code> can download anything you can already see, including private repos. <code>write<\/code> adds push access. <code>fine-grained<\/code> starts from nothing and grants only what you tick, which is why Hugging Face recommends it for production and why some orgs reject read\/write tokens outright with a <code>403<\/code>.<\/p>\n<h3>Can I use one token on several machines?<\/h3>\n<p>Technically yes, but the documented best practice is one token per machine or app \u2014 laptop, Colab notebook, inference server. Rotating a shared token breaks every consumer at once; rotating a per-machine token breaks one.<\/p>\n<h3>Do I need a token to run models locally?<\/h3>\n<p>Only for gated or private weights. Public ungated models download anonymously, and Ollama&#8217;s registry needs no credentials \u2014 see the <a href=\"https:\/\/convly.ai\/how-to-install-ollama-2026\/\">Ollama install guide<\/a>. Whether local makes sense versus an API is usually an economics question; the <a href=\"https:\/\/convly.ai\/self-hosting-vs-api-calculator\/\">self-hosting vs API calculator<\/a> puts a break-even number on it.<\/p>\n<h3>Where do I put the token in Google Colab?<\/h3>\n<p>Use Colab&#8217;s secrets panel (the key icon) to store it as <code>HF_TOKEN<\/code> rather than hardcoding it in a cell, then enable notebook access. Notebooks get committed and shared far more casually than source files, and a token pasted into a cell travels with the copy.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Sources\"><\/span>Sources<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ul>\n<li><a href=\"https:\/\/huggingface.co\/docs\/hub\/en\/security-tokens\" rel=\"noopener\" target=\"_blank\">Hugging Face Hub \u2014 User access tokens<\/a> (roles, best practices, revoking a leaked token, org token policies)<\/li>\n<li><a href=\"https:\/\/huggingface.co\/docs\/huggingface_hub\/en\/package_reference\/environment_variables\" rel=\"noopener\" target=\"_blank\">huggingface_hub \u2014 Environment variables<\/a> (<code>HF_TOKEN<\/code>, <code>HF_TOKEN_PATH<\/code>, <code>HF_HOME<\/code> defaults)<\/li>\n<li><a href=\"https:\/\/huggingface.co\/docs\/huggingface_hub\/en\/package_reference\/cli\" rel=\"noopener\" target=\"_blank\">huggingface_hub \u2014 CLI reference<\/a> (<code>hf auth<\/code> subcommands and flags)<\/li>\n<li><a href=\"https:\/\/huggingface.co\/docs\/inference-providers\/en\/pricing\" rel=\"noopener\" target=\"_blank\">Inference Providers \u2014 Pricing and billing<\/a> (monthly credits, <code>X-HF-Bill-To<\/code>)<\/li>\n<li><a href=\"https:\/\/huggingface.co\/docs\/hub\/en\/models-gated\" rel=\"noopener\" target=\"_blank\">Hugging Face Hub \u2014 Gated models<\/a> (access requests, browser-only approval flow)<\/li>\n<\/ul>\n<p>Model prices and VRAM figures are from the <a href=\"https:\/\/convly.ai\/models\/\">Convly models database<\/a>. Compare capability against cost on the <a href=\"https:\/\/convly.ai\/llm-leaderboard\/\">LLM leaderboard<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What it is: a User Access Token (a string starting hf_) that authenticates you to the Hugging Face Hub. Create [\u2026]<\/p>\n","protected":false},"author":1,"featured_media":2445,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[7],"tags":[],"class_list":["post-2444","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai-news"],"_links":{"self":[{"href":"https:\/\/convly.ai\/de\/wp-json\/wp\/v2\/posts\/2444","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/convly.ai\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/convly.ai\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/convly.ai\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/convly.ai\/de\/wp-json\/wp\/v2\/comments?post=2444"}],"version-history":[{"count":1,"href":"https:\/\/convly.ai\/de\/wp-json\/wp\/v2\/posts\/2444\/revisions"}],"predecessor-version":[{"id":2446,"href":"https:\/\/convly.ai\/de\/wp-json\/wp\/v2\/posts\/2444\/revisions\/2446"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/convly.ai\/de\/wp-json\/wp\/v2\/media\/2445"}],"wp:attachment":[{"href":"https:\/\/convly.ai\/de\/wp-json\/wp\/v2\/media?parent=2444"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/convly.ai\/de\/wp-json\/wp\/v2\/categories?post=2444"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/convly.ai\/de\/wp-json\/wp\/v2\/tags?post=2444"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}