What is an API Key?
Think of an API key as a password that lets your code talk to an AI model. When you use ChatGPT through the website, OpenAI handles everything behind the scenes. But if you want to build your own apps, you need an API key. Getting one takes about 5 minutes and most providers offer free credits to start.
Getting an OpenAI API Key
Step 1: Go to platform.openai.com and click "Sign up."
Step 2: Navigate to "API Keys" in the sidebar, then click "Create new secret key."
Step 3: Name it (like "My First App") and copy the key. You can only see this once! Save it somewhere secure.
Step 4: Add a payment method under "Billing." OpenAI gives you $5 in free credits.
Getting an Anthropic (Claude) API Key
Visit console.anthropic.com, create an account, go to "API Keys," click "Create Key," and save it securely. Anthropic also provides initial free credits.
Getting a Google AI Studio Key
Go to aistudio.google.com, sign in with Google, click "Get API key." Google offers a generous free tier — Gemini Flash has no cost for low-volume usage.
Keeping Your Key Safe
Never share your key publicly, commit it to GitHub, or paste it in client-side code. Store it as an environment variable or secrets manager.
💡 Set spending limits! All providers let you cap monthly spend. Start with $10-20 while learning.