Acquire a Free Hugging Face Account & Set Up an API Token

To use Hugging Face’s open‑source models and share your own work, you need a free Hugging Face account and an API token. The token lets your local scripts securely download models, datasets, or upload your own.


Step 1: Sign Up

  1. Create an account using your email, GitHub, or Google.

  2. Confirm your email to activate the account.


Step 2: Create an API Token

  1. Go to your profile menu → Settings.

  2. Click Access Tokens in the sidebar.

  3. Click New token.

  4. Give it a name like study-buddy-token.

  5. For most projects, role = Read is enough (or Write if you plan to push models).

  6. Click Generate token.

You’ll see your token — copy it right away. Keep it safe and private.


Step 3: Login from the Command Line

Run:

Paste your token when prompted. Your credentials are saved to ~/.huggingface so your Python scripts can connect automatically.


Step 4: Test Your Setup

Try this quick check in Python:

You should see your username and plan info. If so, your account and token are ready!


🔒 Tip: Never share your API token in public notebooks or GitHub. If you do, delete it and make a new one immediately.


➡️ Next: With your account connected, you can choose a foundation model and start building in Chapter 2!

Last updated