Lesson 5.2 – How to Get and Set Up Your API Key
1. What is an API Key?
An API key is like a password for your application—it gives you permission to access OpenAI’s ChatGPT API.
Without it, you can’t send requests to the API or get responses.
⚠️ Important:
Your API key is private. Never share it publicly or in code that others can view.
2. Steps to Get Your ChatGPT API Key
Step 1: Log in to OpenAI
-
Sign in with your OpenAI account (or create one if you don’t have it yet).
Step 2: Go to API Keys Section
-
From your OpenAI dashboard, click on your profile icon (top-right).
-
Select View API Keys from the dropdown menu.
Step 3: Create a New API Key
-
Click + Create new secret key.
-
Copy the generated key immediately (you won’t be able to see it again).
Step 4: Store Your API Key Securely
-
Paste it somewhere safe (like a password manager, not plain text in a public file).
3. Setting Up Your API Key in Automation Tools
For Zapier:
-
Add a step that uses OpenAI or ChatGPT.
-
Zapier will prompt you to enter your API key once.
-
It will store the key securely for future automations.
For Make (Integromat):
-
Add the OpenAI module in your scenario.
-
Choose Add Connection.
-
Paste your API key and save.
For Coding (Optional):
In Python:
4. Best Practices for API Key Safety
-
Never share your key in public forums or videos.
-
Use environment variables to store it in code (not directly in the script).
-
Delete and regenerate your key if you think it’s been exposed.
-
Limit usage with organization settings to prevent unexpected charges.
5. Activity
💡 Exercise:
-
Go to OpenAI and generate your API key.
-
Write down where you stored it and how you plan to use it (Zapier, Make, or code).
6. Pro Tip
If you’re just experimenting, monitor your usage in the OpenAI dashboard to avoid unexpected billing. You can set usage limits under account settings.
