How to create a Hugging Face token (API key), and what it costs

Updated · 5 min read

A Hugging Face API key is called a User Access Token. To create one, sign in at huggingface.co, open Settings → Access Tokens (huggingface.co/settings/tokens), click New token, choose a type (fine-grained, read or write) and a name, and copy the token, which starts with hf_. The token itself is free. With it, apps can download models, including private and gated ones you have access to, at higher rate limits. Running models through Hugging Face's Inference Providers is not free. On 2026-11-24 its docs listed no monthly credits for free accounts, so you buy credits or pay $9 a month for PRO, which includes $2 of credit a month.

Step by step

  1. Sign in at huggingface.co, or create a free account.
  2. Open the Access Tokens tab in your settings.
  3. Click New token, pick a type and give the token a name, such as the app it is for.
  4. Choose permissions. For an app that runs models through Inference Providers, use a fine-grained token with Make calls to Inference Providers. For an app that only downloads models, a read token is enough.
  5. Copy the token and paste it into the app. For scripts and command-line tools, set it as the HF_TOKEN environment variable or run hf auth login.

Read, write or fine-grained?

Type What it can do Use it for
Fine-grained Only the resources and permissions you select, such as one model or one organization Apps and anything in production
Read Read every repository you can read, public and private, and run inference Downloading private or gated models, quick tests
Write Everything a read token can do, plus pushing to repositories you can write to Uploading models, training scripts that save results

If you belong to an organization, a read or write token also reaches that organization's repositories, as far as your role allows. Hugging Face recommends one token per app, and only fine-grained tokens for production, so a leaked token exposes as little as possible.

What the token gets you for free

  • Higher download limits. Hugging Face counts requests in 5-minute windows. Anonymous users get 500 API calls and 3,000 file downloads per IP address; a free account gets 1,000 and 5,000; PRO gets 2,500 and 12,000. These are the September 2025 values, and Hugging Face says the anonymous and free limits can change. Its docs say a missing HF_TOKEN is the number one reason people get rate limited. Desktop apps such as LM Studio, Jan and Ollama download from the same file endpoints; see local LLM apps.
  • Gated models need a one-time access request on the model's page in your browser, which the model's authors approve automatically or by hand. After that, your token can download the files.
  • Your token also reads private repositories you own or can access through an organization.

What costs money

Inference Providers is Hugging Face's serverless API for running models. It sends each request to a partner provider such as Cerebras, Groq or Together AI and charges that provider's own rate. Hugging Face adds no markup. These were the monthly credits on 2026-11-24:

Account Price Inference credit each month
Free $0 None (buy credits to use it)
PRO $9 a month $2
Team $20 per user a month $2 per seat, shared by the organization

The PRO and Team credits are general compute credits. They also pay for Inference Endpoints, Spaces hardware and Jobs, and they are used before any pay-as-you-go charges. Two other paid services use the same token:

  • The hf-inference provider, the former serverless Inference API, bills by compute time multiplied by the hardware's price. In Hugging Face's example, a 10-second FLUX.1-dev image on a GPU costing $0.00012 a second costs $0.0012. Since July 2025 it mostly runs smaller CPU models, such as embedding and classification models.
  • Inference Endpoints are dedicated servers for one model, starting at $0.033 an hour.

Hugging Face doesn't publish one price list for Inference Providers, because the price depends on the model and the provider. Your usage, broken down by model and provider, is on the Inference Providers settings page. For per-token prices of the same open models elsewhere, see OpenRouter alternatives.

Use the token in an app

If an app has a Hugging Face option, choose it and paste the token. If it only has a custom OpenAI-compatible provider, use:

  • Base URL: https://router.huggingface.co/v1
  • API key: your hf_ token
  • Model: a model ID from the Hub, for example deepseek-ai/DeepSeek-V4.1-Flash

By default, Hugging Face picks a provider by balancing price, speed and reliability, and switches to another one automatically if the first is down or rate limited. Its docs say this routing is powered by OpenRouter. To choose yourself, add a suffix to the model ID: :fastest, :cheapest, or a provider's name, such as deepseek-ai/DeepSeek-V4.1-Flash:novita. Hugging Face's docs include setup guides for OpenCode, Codex, Claude Code, Pi and Hermes Agent.

Some apps use the token for a dedicated Inference Endpoint instead. TypingMind, for example, documents connecting your own Hugging Face endpoint with a token that has the inference permissions.

Privacy

Hugging Face says it does not store request bodies or responses when it routes Inference Providers requests, and does not use your data for training. It keeps logs for debugging for up to 30 days, without user data or tokens. The provider that runs the model has its own data policy, so check the provider you route to.

Keep the token safe

  • Use one token per app, so you can revoke a single one without breaking the rest.
  • Prefer fine-grained tokens limited to the models and permissions the app needs.
  • Tokens unused for a year expire on their own; Hugging Face emails you 30 days before.
  • If a token leaks, delete or refresh it on the Access Tokens tab. Anyone who finds someone else's leaked token can invalidate it through Hugging Face's /api/credentials/revoke endpoint.
  • Never put the token in a website's front-end code or a public repository.

Apps that work with your Hugging Face token

  • Infinity

    Free · macOS

    Visit

    Free Mac AI chat app with git-style branching: fork any part of an answer into its own thread, ask up to four models at once, and use your own keys or local models.

    Works with:OpenAIAnthropicGoogle GeminixAI+7 more

  • AnythingLLM

    Free · macOS, Windows, Linux · Open source

    Visit

    Private AI app for chatting with your documents. Runs local models or connects to OpenAI, Anthropic, Gemini and others with your key.

    Works with:OpenAIAzure OpenAIAnthropicGoogle Gemini+9 more

  • NewMax

    One-time lifetime license from $399 · macOS, Windows

    Visit

    Desktop AI agent that runs workflows on your local files with your own API key or a local model; nothing routes through NewMax.

    Works with:OpenAIAnthropicGoogle GeminiMistral+6 more

  • Msty

    Free to start; paid Studio plans

    Visit

    Msty simplifies AI model use with a single app, offering offline functionality, privacy, and unique features for both local and online platforms.

    Works with:Hugging FaceOllamaOpenRouter

Other options

For free hosted models with a simpler setup, see the Groq API key guide and free AI API keys. To run Hugging Face models on your own computer instead, see LM Studio vs Ollama. For more apps that accept a Hugging Face token, see the Hugging Face provider page.

Questions

Is a Hugging Face token the same as an API key?

Yes. Hugging Face calls its API keys User Access Tokens. They start with hf_ and are created under Settings → Access Tokens on huggingface.co. Apps that ask for a Hugging Face API key want this token.

Is a Hugging Face token free?

Creating a token is free, and it lets you download public, private and gated models at higher rate limits. Running models through Inference Providers is not free on a free account: on 2026-11-24 Hugging Face listed no monthly credits for free users, so you buy credits or upgrade to PRO ($9 a month, which includes $2 of credit).

Which token type do I need for Inference Providers?

Hugging Face recommends a fine-grained token with the Make calls to Inference Providers permission. A read token also works for inference, but it can read all your repositories too.

Do Hugging Face tokens expire?

Only if you don't use them. A token unused for a year expires automatically; Hugging Face emails you 30 days before, and any use resets the countdown. Expired tokens can be refreshed to get a new value.

Why am I rate limited when downloading models?

Usually because the app sends no token. Anonymous requests get lower limits (500 API calls and 3,000 file downloads per 5 minutes per IP address) than a free account (1,000 and 5,000). Set HF_TOKEN or paste the token into the app.

Sources

Checked against the providers' own documentation on 2026-11-24. Prices and limits change; the links below have the current figures.

Related guides