# OpenAI API Key

OpenAI provides access to models such as GPT-4o, GPT-5, and others through its developer platform. The API key you generate here is separate from any ChatGPT subscription you might have.

### Prerequisites

You need the following:

* An email address, or a Google, Microsoft, or Apple account for single sign-on
* A payment method (credit or debit card) for purchasing API credits

### Step-by-step instructions

Follow the steps to set up the OpenAI API key:&#x20;

{% stepper %}
{% step %}
Go to [platform.openai.com](https://platform.openai.com/), and create your account using an email address or a single sign-on (SSO) provider.
{% endstep %}

{% step %}
Review the information. If prompted, enter a password in the **Password** field, and then click **Continue**.
{% endstep %}

{% step %}
In the **Full name** field, enter your name, enter your date of birth in the **Birthday** field, and then click **Finish creating accoun**t.
{% endstep %}

{% step %}
On the **Welcome to OpenAI Platform** page, enter a name in the **Organization name** field, select an option in the **What best describes you?** list, and then click **Create organization**.&#x20;
{% endstep %}

{% step %}
On the **Invite your team** page, enter email addresses in the **Emails** field, assign the designated role, and then click **Continue**. To skip this step, click **I'll invite my team later**.
{% endstep %}

{% step %}
On the **Make your first API call** page, enter a name in the **API key name** and **Project name** fields, and then click **Generate API Key**. To skip this step, click **I'll do this later**. Every API key belongs to a project inside your organization. You can create a project or use the default one.

{% hint style="info" %}
**Tip:**  Go to <https://platform.openai.com/api-keys>, and click <img src="broken-reference" alt="" data-size="line"> **Edit** to redefine the API key permissions.&#x20;
{% endhint %}
{% endstep %}

{% step %}
On the **Make your first API call** page, click **Copy** to copy your new API key. You can also try out the new API key by selecting the **curl**, **Node**, or **Python** tab to view the code examples. Click **Continue**.

{% hint style="warning" %}
**Important:** OpenAI shows your secret key only once. If you lose it, you must generate a new one. Treat it like a password. Store it in a password manager, an `.env` file, or a secrets manager. Never commit it to a public repository.
{% endhint %}
{% endstep %}

{% step %}
On the **Add some API credits** page, select a credit amount, and then click **Purchase credits**. To skip this step, click **I'll buy credits later.**
{% endstep %}
{% endstepper %}

### Test your key

Store your key as an environment variable (for example, `OPENAI_API_KEY`), and use the official Python or Node.js SDK. Alternatively, test with a simple `curl` request using the `Authorization: Bearer` header.

<figure><img src="https://1036205596-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fv9avy716UiAsS24zOznZ%2Fuploads%2F6GEBQiNS9dxrrKoOFZef%2Fimage.png?alt=media&#x26;token=6e822afa-d0c1-4ca1-8b5c-33846f0eded6" alt=""><figcaption></figcaption></figure>
