Bring Your Own Key (BYOK)
Using your own credentials with an external AI provider allows AI Gateway to authenticate requests on your behalf with no added markup. This approach is useful for utilizing credits provided by the AI provider or executing AI queries that access private cloud data. If a query using your credentials fails, AI Gateway will retry the query with its system credentials to improve service availability.
Integrating credentials like this with AI Gateway is sometimes referred to as Bring-Your-Own-Key, or BYOK. In the Vercel dashboard this feature is found in the AI Gateway tab under the Integrations section in the sidebar.
Provider credentials are scoped to be available throughout your Vercel team, so you can use the same credentials across multiple projects.
First, retrieve credentials from your AI provider. These credentials will be used first to authenticate requests made to that provider through the AI Gateway. If a query made with your credentials fails, AI Gateway will re-attempt with system credentials, aiming to provide improved availability.
- Go to the AI Gateway tab in your Vercel dashboard.
- Click on the Integrations section on the left sidebar.
- Find your provider from the list and click Add.
- In the dialog that appears, enter the credentials you retrieved from the provider.
- Ensure that the Enabled toggle is turned on so that the credentials are active.
- Click Test Key to validate and add your credentials.
Once the credentials are added, it will automatically be included in your requests to the AI Gateway. You can now use these credentials to authenticate your requests.
After successfully adding your credentials for a provider, you can verify that they're working directly from the Integrations tab. To test your credentials:
- In the AI Gateway tab, navigate to the Integrations section.
- Click the menu for your configured provider.
- Select Test Key from the dropdown.
This will execute a small test query using a cheap and fast model from the selected provider to verify the health of your credentials. The test is designed to be minimal and cost-effective while ensuring your authentication is working properly.
Once the test completes, you can click on the test result badge to open a detailed test result modal. This modal includes:
- The code used to make the test request
- The raw JSON response returned by the AI Gateway
Was this helpful?