> ## Documentation Index
> Fetch the complete documentation index at: https://docs.daydream.live/llms.txt
> Use this file to discover all available pages before exploring further.

# HuggingFace Auth

> Set up your HuggingFace token for gated model downloads and WebRTC connections

# Setting up HuggingFace authentication

Some pipelines use gated models on HuggingFace that require authentication to download. A HuggingFace token is also used to obtain Cloudflare TURN credentials for WebRTC connections behind firewalls. You can create a token at [huggingface.co/settings/tokens](https://huggingface.co/settings/tokens).

Scope supports two ways to provide your token: through the Settings UI or via an environment variable.

***

## Using the API Keys Tab

<Steps>
  <Step title="Open Settings">
    Click the **gear icon** in the app header to open the Settings dialog.
  </Step>

  <Step title="Navigate to API Keys">
    Select the **API Keys** tab.
  </Step>

  <Step title="Enter your token">
    Find the **HuggingFace** entry, paste your token into the field, and click the **save** button.
  </Step>
</Steps>

To remove a stored token, click the **delete** button next to the entry.

<Note>
  If the `HF_TOKEN` environment variable is already set, the input field is disabled.
</Note>

***

## Using an Environment Variable

Setting the `HF_TOKEN` environment variable is the preferred method for headless, cloud, and CI deployments.

<Tabs>
  <Tab title="Linux / macOS" icon="terminal">
    ```bash theme={null}
    export HF_TOKEN=hf_your_token_here
    ```
  </Tab>

  <Tab title="Windows (PowerShell)" icon="windows">
    ```powershell theme={null}
    $env:HF_TOKEN = "hf_your_token_here"
    ```
  </Tab>
</Tabs>

<Note>
  The environment variable takes precedence over a token stored through the UI.
</Note>

***

## When Is a Token Needed?

| Scenario                     | Why                                                                                                                                                                  |
| :--------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Gated model downloads**    | Pipelines that depend on gated HuggingFace models will fail with an authentication error without a valid token                                                       |
| **Cloudflare TURN (WebRTC)** | A token is used to obtain TURN server credentials for NAT traversal. Without it, Scope falls back to a public STUN server which may not work behind strict firewalls |

***

## Troubleshooting

<AccordionGroup>
  <Accordion title="Authentication errors during model download">
    Verify that your token is set in **Settings > API Keys** or via the `HF_TOKEN` environment variable.
  </Accordion>

  <Accordion title="Token is set but downloads still fail">
    Ensure you have accepted the model's license agreement on its HuggingFace page. Gated models might require explicit approval before access is granted.
  </Accordion>

  <Accordion title="WebRTC connection issues behind firewalls">
    Without a valid HuggingFace token, Scope cannot obtain Cloudflare TURN credentials and falls back to STUN-only mode. Set your token and restart Scope to enable TURN-based NAT traversal.
  </Accordion>
</AccordionGroup>

***

## See Also

<CardGroup cols={2}>
  <Card title="Quick Start" icon="rocket" href="/scope/getting-started/quickstart">
    Get Scope running and generate your first AI video
  </Card>

  <Card title="System Requirements" icon="server" href="/scope/reference/system-requirements">
    GPU, RAM, and OS requirements per pipeline
  </Card>
</CardGroup>
