To authenticate with the AI Gateway, you need to provide an API key as bearer token in the Authorization header in the request.

Alternatively you can set the following environment variableS if using

OPENAI_BASE_URL="{truefoundry-base-url}/api/llm/api/inference/openai"
OPENAI_API_KEY="your-api-key"

You can get your API key from the TrueFoundry platform. It can either be a Personal Access Token (PAT) or a Virtual Account Token.

Personal Access Token (PAT)

To generate a PAT, go to the “Access” sidebar in the TrueFoundry platform and open Personal Access Tokens as shown below:

You can then create a new PAT by clicking on the “New Personal Access Token” button. This is the recommended way to authenticate with the AI Gateway for development purposes. For production environments, we recommend using a Virtual Account Token (VAT).

Virtual Account Token (VAT)

To generate a VAT, go to the “Access” sidebar in the TrueFoundry platform and open Virtual Account Tokens as shown below:

You can then create a new VAT by clicking on the “New Virtual Account” button. You will see a form to create a new VAT. You can give it a name and select the models that you want to give access to.

Note: Virtual Accounts can be created by platform admins only.