Get ChatGPT API Key

To use OpenAI's ChatGPT API, you need an API Key. This guide describes how to get an OpenAI API Key.


πŸ“‹ Prerequisites

  • βœ… OpenAI Account (Sign up if none)
  • βœ… Payment Method (Credit/Debit Card)
  • βœ… Email Verification

⚠️ Note: ChatGPT Plus subscription and API are separate!


πŸš€ API Key Issuance Steps

Step 1: Access OpenAI Website

Go to https://platform.openai.com

Step 2: Account Creation or Login

  • Click "Sign up" if you don't have an account
  • Sign up with Email or Google/Microsoft account
  • Complete email verification

Step 3: Register Payment Method

  1. Click account menu in top right
  2. Select "Billing"
  3. Go to "Payment methods" β†’ "Add payment method"
  4. Enter credit card info

πŸ’‘ Tip: We recommend charging at least $5.

Step 4: Create API Key

  1. Click "API keys" in left menu
  2. Click "Create new secret key" button
  3. Enter key name (e.g., "CodeFreeAI-Workflow")
  4. Click "Create secret key"

Step 5: Copy and Store API Key

⚠️ Important: API Key is displayed only once!

  1. Copy the displayed API Key
  2. Save it in a safe place (Password Manager, etc.)
  3. Click "Done"

πŸ”‘ API Key Format

sk-proj-1234567890abcdefghijklmnopqrstuvwxyzABCDEFGH
  • Starts with sk-proj-
  • Total length: Approx. 50-60 chars

πŸ’° Pricing Guide

As of Dec 2024 (GPT-4o)

Model Input Output
GPT-4o $0.15 / 1M Tokens $0.60 / 1M Tokens
GPT-4o-mini $0.03 / 1M Tokens $0.12 / 1M Tokens

Estimated Cost Calculation

1,000 AI Requests (Avg 500 tokens/request)

Input: 250,000 Tokens Γ— $0.15 = $0.0375
Output: 250,000 Tokens Γ— $0.60 = $0.15
Total: $0.1875

Monthly Estimate:

  • Small (10k req/mo): ~$19
  • Medium (100k req/mo): ~$190
  • Large (1M req/mo): ~$1,900

πŸ’‘ Cost Saving Tips:

  • Use GPT-4o-mini (80% cheaper)
  • Optimize Prompts (Remove unnecessary words)
  • Reuse System Prompts

βš™οΈ Setting up in CodeFreeAI

1. Add ChatGPT Node to Workflow

  1. Workflow Edit Screen
  2. Find "ChatGPT" in left node list
  3. Drag to Canvas

2. Enter API Key

  1. Click ChatGPT Node
  2. Paste copied key into "API Key" field
  3. Save

3. Select Model

Model Purpose Price
gpt-4o General, High Quality Standard
gpt-4o-mini Fast & Cheap 80% Off

4. Test

Test with simple prompt:

Hello. Is it working?

If you get a normal response, setup complete! πŸŽ‰


πŸ”’ Security Requirements

βœ… Do's

  • βœ… Manage API Key as Environment Variable
  • βœ… Regenerate key periodically (Every 6 months)
  • βœ… Set Usage alerts
  • βœ… Set Workflow to Private

❌ Don'ts

  • ❌ Upload to public repo like GitHub
  • ❌ Share screenshots
  • ❌ Print to logs
  • ❌ Share with multiple people

See API Key Security Guide


πŸ“Š Usage Monitoring

1. Access OpenAI Dashboard

https://platform.openai.com/usage

2. Checkable Info

  • Daily/Monthly Usage
  • API Call Count
  • Token Usage
  • Cost Accumulation

3. Set Alerts

  1. "Billing" β†’ "Limits"
  2. Set "Usage limits"
    • Monthly Limit: $50
    • Notification Threshold: $40
  3. Receive alerts via Email

πŸ”„ API Key Regeneration

When to Regenerate?

  • πŸ”“ Key is exposed
  • πŸ”„ Regular security maintenance (Every 6 months)
  • ❌ Suspicious usage pattern detected
  • 🚫 Workflow no longer in use

How to Regenerate

  1. Go to API keys page
  2. Click "..." next to existing key
  3. Select "Revoke" (Delete existing key)
  4. "Create new secret key" (Generate new key)
  5. Update CodeFreeAI Workflow

🎯 Next Steps


❓ FAQ

Q: Is API free if I have ChatGPT Plus? A: No. ChatGPT Plus and API are separate services.

Q: Is there a free trial? A: New signups get $5 credit, but it's limited.

Q: How is API cost calculated? A: It is charged based on usage (input/output tokens).

Q: Difference between GPT-4o and GPT-4o-mini? A: GPT-4o-mini is faster and cheaper, but GPT-4o is better for complex tasks.

Q: How much will it cost per month? A: Depends on usage, small scale is around $10-20/month.

Q: My API Key is exposed! A: Immediately Revoke the key and issue a new one.

results matching ""

    No results matching ""