You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Due to the possibility of leaking access tokens to users of your website or web application, we only support accessing private/gated models from server-side environments (e.g., Node.js) that have access to the process' environment variables.
7
+
8
+
</Tip>
9
+
10
+
## Step 1: Generating a User Access Token
11
+
12
+
[User Access Tokens](https://huggingface.co/docs/hub/security-tokens) are the preferred way to authenticate an application to Hugging Face services.
13
+
14
+
To generate an access token, navigate to the [Access Tokens tab](https://huggingface.co/settings/tokens) in your settings and click on the **New token** button. Choose a name for your token and click **Generate a token** (we recommend keeping the "Role" as read-only). You can then click the **Copy** button next to your newly-created token to copy it to your clipboard.
To delete or refresh User Access Tokens, you can click the **Manage** button.
22
+
23
+
24
+
## Step 2: Using the access token in Transformers.js
25
+
26
+
Transformers.js will attach an Authorization header to requests made to the Hugging Face Hub when the `HF_ACCESS_TOKEN` environment variable is set and visible to the process.
27
+
28
+
One way to do this is to call your program with the environment variable set. For example, let's say you have a file called `llama.js` with the following code:
0 commit comments