Skip to main content

Authentication

Configure authentication for Hugging Face Hub and W&B.

Hugging Face Token

Environment Variable

In Python

Getting a Token

  1. Go to huggingface.co/settings/tokens
  2. Click “New token”
  3. Select “Write” access for push to hub
  4. Copy the token

W&B Token

Environment Variable

In Python

Getting a Token

  1. Go to wandb.ai/authorize
  2. Copy your API key

Push to Hub

To push models to Hugging Face Hub:

Private Models

Access private models with your token:

Private Datasets

Access private datasets:

Secure Token Handling

Using .env Files

Never Commit Tokens

Add to .gitignore:

Next Steps

Python SDK

Full API reference

LLM Endpoints

LLM training API