> For the complete documentation index, see [llms.txt](https://docs.cloudeka.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cloudeka.ai/reference/deployment-llama-3.1-70b-with-vllm-on-kubernetes/getting-the-hugging-face-api-key.md).

# Getting the Hugging Face API Key

Before deploying the LLaMA model, you need to obtain an API key from Hugging Face. Follow these steps to get your API key.

{% hint style="info" %}
Make sure you already have an account on Hugging Face.
{% endhint %}

Go to the [Hugging Face](https://huggingface.co/login) website and enter the "Username/Email address" and "password" you use. Click the Login button to enter Hugging Face.

<figure><img src="https://2882153758-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fi9YWb69HFXLHYlXffReU%2Fuploads%2Fgit-blob-c55ca5ed1cc022f8961d4c16c207cb1c1a85ff1e%2Fimage.png?alt=media" alt=""><figcaption><p>Login Hugging Face</p></figcaption></figure>

After entering the Hugging Face page, press profile at the top right and select Access Token.

<figure><img src="https://2882153758-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fi9YWb69HFXLHYlXffReU%2Fuploads%2Fgit-blob-908764b80cd9f75f22d6ec41f43465686b091c8c%2Fimage.png?alt=media" alt=""><figcaption><p>Access Token</p></figcaption></figure>

On the Access Tokens page press the "+ Create new token" button.

<figure><img src="https://2882153758-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fi9YWb69HFXLHYlXffReU%2Fuploads%2Fgit-blob-17cb1f1a17cf74582f6379dc0c485e64f5c3a4b2%2Fimage.png?alt=media" alt=""><figcaption><p>Create New Token</p></figcaption></figure>

In this guide, the token type used is Write, enter the token name. Click the **Create Token** button to create a new token for Hugging Face.

<figure><img src="https://2882153758-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fi9YWb69HFXLHYlXffReU%2Fuploads%2Fgit-blob-ec2fa799cd4ff0680d2bca3ad387da9f0e977e50%2Fimage.png?alt=media" alt=""><figcaption><p>Create Token</p></figcaption></figure>

Once you have generated the token, save it securely. You will need it to authenticate your requests to Hugging Face models.

<figure><img src="https://2882153758-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fi9YWb69HFXLHYlXffReU%2Fuploads%2Fgit-blob-bc6c5c2d6d77bddbba76ff0f7c724ef704f3d8ff%2Fimage.png?alt=media" alt=""><figcaption><p>Token</p></figcaption></figure>

## Encoding the Hugging Face API Token to Base64

To convert your Hugging Face API token into a text format represented by Base64 characters. You can run the following syntax according to the operating system your computer uses.

### Linux

On computers using the Linux operating system, you can follow the following steps. Open a terminal on your computer. Run the following command to encode your Hugging Face token to base64.

```bash
echo -n 'your-hugging-face-token' | base64
```

Replace `your-hugging-face-token` with your actual Hugging Face token. The command will output the base64-encoded token.

```bash
aGZfQUZiV0phb2RTR1RqUXhReENQUXhRekV5c1VIenp4d1hNWA==
```

### Windows

On computers using the Windows operating system, use PowerShell. Open PowerShell on your computer.

<figure><img src="https://2882153758-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fi9YWb69HFXLHYlXffReU%2Fuploads%2Fgit-blob-a165f14fa6d0d970057d3818d910a68e8bf8bce2%2Fimage.png?alt=media" alt="" width="375"><figcaption><p>Open Powershell</p></figcaption></figure>

Use the following command to encode your token using Base64 in PowerShell.

```bash
[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes("your-hugging-face-token"))
```

<figure><img src="https://2882153758-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fi9YWb69HFXLHYlXffReU%2Fuploads%2Fgit-blob-bc75f9657404973737ffb27a7ebcb01786567eaf%2Fimage.png?alt=media" alt=""><figcaption><p>Encode Token</p></figcaption></figure>
