Get Started with the Hugging Face Inference API

Learn how to sign up for a Hugging Face account and retrieve the access token of the Hugging Face Inference API.

We need to complete a few steps before we can start using the Hugging Face Inference API.

Sign up and generate an access token

Visit the registration link and perform the following steps:

  1. Enter a valid “Email address” and “Password.” Then, click the “Next” button.

  2. On the new page, enter the required details, click on the user agreement checkbox, and then click the “Create Account” button.

  3. You will receive a verification email. Click the verification link provided in the email. It opens a new page, as shown in slide 4.

  4. Click the profile photo in the top-right corner. Then, click “Settings” from the drop-down list. This opens a new page.

  5. Click the “Access Tokens” option from the left navbar on the new page.

  6. Click the “New token” button. This opens a pop-up window.

  7. Enter the “Name” for the token, select the “Role” as “read”, and click the “Generate a token” button. It generates an access token that we use for Hugging Face Inference API calls.

Save the API key

Let’s save the access token to use throughout the course. Follow the instructions below:

  1. Click the “Edit” button in the following widget.

  2. Enter your access token in the ACCESS_TOKEN field.

  3. Click the “Save” button.

Once the ACCESS_TOKEN is saved, it can be used throughout the course. To verify that the provided token is valid, click the “Run” button for the widget below. You'll receive a success or error message accordingly.

Press + to interact
token = "{{ACCESS_TOKEN}}";
// Invoking the function to make an API call
testAPI(token);