Getting the OpenAI API Key - bawkee/MdcAi GitHub Wiki

How to Get an OpenAI API Key

This guide walks you through creating an OpenAI account, generating an API key, and setting up billing to access premium models.

Prerequisites

  • A valid email address
  • A payment method (credit/debit card) for billing (required to use premium models)

Step 1: Create an OpenAI Account

  1. Go to OpenAI’s Platform.
  2. Click Sign Up (or Log In if you already have an account).
    • You can sign up using your email, Google, or Microsoft account.
    • Sign Up Screen

Step 2: Generate Your API Key

  1. After logging in, click the cogwheel icon in the top-right corner.
    • Settings Menu
  2. Navigate to the API Keys tab.
    • API Keys Page
  3. Click Create new secret key.
    • Create API Key
    • Give it any name (e.g., "MDC AI Key").
    • API Key
  4. Copy the key immediately—it won’t be shown again. Store it securely.
    • Copy API Key

⚠️ Important: Never share your API key publicly. If exposed, revoke it immediately and generate a new one.


Step 3: Set Up Billing (Required for Premium Models)

OpenAI provides $5 in free credits, but you must add a payment method to access advanced models like GPT-4o.

Add Payment Method

  1. Go to Billing.
    • Billing Page
  2. Click Add payment details and enter your credit card information.
    • Check "Purchasing as a business" if expensing for work.
    • Payment Setup

All There

Few notes:

  • Disable auto-recharge to avoid unexpected charges (recommended).
  • Monitor usage in the Usage Dashboard.
  • Top up credits at any time:
  • Top-Up Balance

Best Practices

  1. Secure your API key: Anyone who has access to it could use your OpenAI credits.
  2. Edit prompts instead of starting new conversations, fork the conversation instead of pivoting it.
  3. Track usage: Check your OpenAI Usage Dashboard regularly.

FAQs

Do I need to pay to use the API?

  • Basic models may work with free credits, but premium models (e.g., GPT-4) require a paid account.

Is my data shared with MDC AI?

  • No. OpenAI handles all billing and API access—MDC AI has no access to your payment details or usage data.

How long does $20 credit last?

  • Depends on usage, but for average users, it can last months.

Additional Resources


Now you’re ready to integrate the API with MDC AI or other tools! 🚀