How to Get an OpenAI API Key: Step-by-Step Guide

OpenAI5 min read

What is the OpenAI API?

OpenAI is one of the pioneering research companies in artificial intelligence and the creator of the GPT (Generative Pre-trained Transformer) series of language models. Known worldwide through ChatGPT, OpenAI offers powerful models such as GPT-4o, GPT-4, and GPT-3.5.

The OpenAI API allows developers and applications to interact programmatically with these powerful language models. An API key is a unique authentication code used to access this interface. You need an OpenAI API key to use the GPT-based AI therapist experience in OpenGnothia.

The OpenAI API, like the Claude API, operates on a pay-as-you-go model. You are charged based on the amount of text (tokens) you send and receive.

Step 1: Go to OpenAI Platform

Open your browser and navigate to platform.openai.com. This is OpenAI's developer platform. Note: This address is different from chat.openai.com where ChatGPT is used. You need to use platform.openai.com for API keys.

Click the "Sign Up" button. You can register with an email address and password. Alternatively, you can sign up with your Google, Microsoft, or Apple account.

Fill out the registration form and click "Continue". OpenAI will request email verification to complete the registration process.

Step 2: Verify Your Account

Check your email inbox and find the verification email from OpenAI. Click the "Verify email address" link. If you can't see the email, check your spam/junk folder.

After email verification, OpenAI will also request phone number verification. Enter your mobile number and type the 6-digit verification code received via SMS into the appropriate field.

Once verification is complete, you may be asked to set an organization name and select your intended use. Fill in this information and continue.

Step 3: Create Your API Key

After logging into the OpenAI Platform, click on your profile icon in the top right corner and select "API Keys". Alternatively, you can go directly to platform.openai.com/api-keys.

Click the "Create new secret key" button. Give your key a name (e.g., "OpenGnothia") and select which project it will be used for. You can also set permissions for the key; for general use, select "All".

After clicking "Create secret key", your key will be generated and displayed on screen. This key is a long string of characters starting with "sk-". Copy your key immediately because you won't be able to see the full value again after closing this window.

Step 4: Store Your API Key Safely

After creating your API key, it's crucial to store it in a safe place. Save your key in a password manager (1Password, Bitwarden, etc.) or store it in a secure notes application.

Never share your API key in public places. Sharing your key on platforms like GitHub repositories, forums, social media, or email creates a serious security risk. Anyone who obtains your key can make API calls on your account.

If you suspect your key has been compromised, you can immediately revoke the key from the OpenAI Platform and create a new one.

Pricing and Usage Limits

The OpenAI API operates on a pay-as-you-go model. Pricing varies based on the model you use and the number of tokens processed. A token is a unit of text roughly equivalent to 3/4 of a word.

OpenAI offers different models: GPT-4o (newest and most versatile), GPT-4o mini (fast and affordable), and GPT-4 (powerful). Each model has different prices per input and output token. Visit openai.com/pricing for current prices.

New accounts have usage limits that gradually increase based on your account age and payment history. To start using the API, you may need to add your payment information (credit card) and load credits to your account. You can track usage and billing details at platform.openai.com/usage.

Frequently Asked Questions

My API key isn't working, what should I do? First, make sure you copied the key correctly — there should be no spaces at the beginning or end. Check that you have sufficient credits in your account. Verify the key hasn't been revoked from the OpenAI Platform. If it still doesn't work, try creating a new key.

I have a ChatGPT account, can I use the same key? No. A ChatGPT subscription (Plus, Pro) and API usage are separate. Even if you have a ChatGPT Plus subscription, you need to separately register at platform.openai.com and load credits for API access.

I lost my API key, how can I find it? Unfortunately, you cannot view the full value of an existing key again. Revoke the old key from the OpenAI Platform and create a new one. Update the new key in your OpenGnothia settings.

Is there free usage available? OpenAI may provide limited starter credits to new API accounts. Check OpenAI's website for current promotions. The GPT-4o mini model can be used as a low-cost alternative.