Skip to main content

OpenAI - Where to store your OpenAI API Key

Marc P Summers avatar
Written by Marc P Summers
Updated this week

Connecting Your Site to OpenAI via Supabase

Objective

This SOP outlines the steps to connect your application to OpenAI by storing the OpenAI API key in Supabase.

Key Steps

Step 1: Obtain OpenAI API Key 1:37

- Search online for how to find your OpenAI API key.

- Follow the instructions to retrieve your key.

Step 2: Access Supabase 1:47

- Log in to your Supabase account.

- Navigate to the left-hand side menu.

Step 3: Go to Edge Functions 1:57

- Click on 'Edge Functions' in the left-hand menu.

- Check if there is an OpenAI function listed (not mandatory for this step).

Step 4: Navigate to Secrets 2:28

- Click on 'Secrets' in the left-hand menu.

Step 5: Add OpenAI API Key 2:40

- In the 'Key' field, enter 'API_key'.

- In the 'Value' field, paste your OpenAI API key.

Step 6: Save the Key 3:04

- Click the 'Save' button to store the key.

Step 7: Update Key if Necessary 3:30

- If you need to change the key, enter the new key in the 'Value' field and click 'Save' again.

Cautionary Notes

- Ensure that the OpenAI API key is kept confidential and not shared publicly.

- If the key is not stored correctly, you may encounter fetch errors when trying to connect to OpenAI.

Tips for Efficiency

- Double-check that you have the correct OpenAI API key before pasting it into Supabase.

- Regularly review and update your API keys to maintain security.

Link to Video:
​https://youtu.be/lUbv5uklZb4
​

Did this answer your question?