Skip to main content

Authorization

Follow this guide to create a new Hugging Face TGI credential that will allow Nexla to authenticate to and exchange data with your Hugging Face TGI endpoint.
huggingface_api_auth.png

Hugging Face TGI

Prerequisites

Before creating a Hugging Face TGI credential, you'll need to obtain an API key from your Hugging Face account. Hugging Face provides API keys for programmatic access to their Text Generation Inference (TGI) endpoints and other services.

To obtain a Hugging Face API key:

  1. Log in to your Hugging Face account at https://huggingface.co or create an account if you don't have one.

  2. Navigate to your account settings by clicking on your profile picture in the top right corner and selecting Settings, or by visiting https://huggingface.co/settings.

  3. In the Settings page, locate the Access Tokens section in the left sidebar or scroll to find the token management section.

  4. Click New token or Create token to generate a new API key. You can create tokens with different scopes (read, write) depending on your needs.

  5. Give your token a descriptive name (e.g., "Nexla Integration") and select the appropriate permissions. For TGI API access, you typically need read permissions.

  6. Click Generate token to create the new API key.

  7. Copy the API token immediately after generation, as it may only be displayed once for security purposes. Store it securely, as you'll need it to authenticate API requests.

  8. Note the base URL for your TGI endpoint (typically https://router.huggingface.co/novita or your custom TGI endpoint URL) and the API version you'll be using (typically v3/openai for OpenAI-compatible endpoints).

For detailed information about Hugging Face API authentication and token management, refer to the Hugging Face API Documentation and Text Generation Inference API Reference.

Create a Hugging Face TGI Credential

  • To create a new Hugging Face TGI credential, after selecting the data source/destination type, click the Add Credential tile to open the Add New Credential overlay.

New Credential Overlay – Hugging Face TGI

HuggingFaceCred.png

Credential Name & Description

  1. Enter a name for the credential in the Credential Name field and a short, meaningful description in the Credential Description field.

    Resource descriptions are recommended but are not required. They should be used provide information about the resource purpose, data freshness, etc. that can help the owner and other users efficiently understand and utilize the resource.

Authentication Settings

  1. In the API Key field, enter the Hugging Face API key that you obtained from your Hugging Face account settings. This is the secret API key used to authenticate requests to the Hugging Face TGI API.

    The API key is sensitive information and should be kept secure. If you've lost your API key, you'll need to generate a new one in your Hugging Face account settings. API keys are used in the Authorization header as a Bearer token for all API requests.

  2. In the Base URL field, enter the base URL for the Hugging Face TGI API. The default value is https://router.huggingface.co/novita, which is a common TGI endpoint. You can specify a different base URL if you're using a custom TGI endpoint or inference endpoint.

  3. In the API Version field, enter the API version you want to use. The default value is v3/openai, which provides OpenAI-compatible API endpoints for TGI. You can specify a different version if your TGI endpoint uses a different API version.

Save the Credential

  1. Once all of the relevant steps in the above sections have been completed, click the Save button at the bottom of the overlay to save the configured credential.

  2. The newly added credential will now appear in a tile on the Authenticate screen during data source/destination creation and can be selected for use with a new data source or destination.