Here’s a detailed guide to help you through the process of creating an API key for OpenAI.

Sign Up / Log In to OpenAI

  • If you don’t have an OpenAI account, you need to sign up.

  • Click on the Sign Up button to create an account.

  • If you already have an account, click on Log In and enter your credentials.

  • Once logged in, go to the OpenAI dashboard.

  • Find the section related to API usage or you can access it here. This is typically labeled as API or API keys.

Create a New API Key

  • In the API section, you should see an option to create a new API key.

  • Click on Create new secret key as shown on the figure 1 bellow.

  • OpenAI will prompt you to provide a secret key name (optional) and choose the permissions you wish to grant. See figure 2 bellow.

Fig 1 - User API Keys.

Fig 2 - Create new secret key.

Save the API Key

  • Copy the generated API key as shown on figure 3.

⚠️ Store it securely. API keys are sensitive credentials that should be kept private. Do not share it publicly or commit it to version control repositories.

Fig 3 - Save your key.

Best Practices

  • 🔒 Secure Storage: Store your API key securely. Environment variables or secrets management tools are recommended.

  • 👀 Monitor Usage: Keep an eye on your API usage to avoid unexpected charges 💸.

  • 🔑 Rotate Keys: Rotate your API keys periodically for added security.

  • 🚫 Access Control: Restrict the usage of your API key to specific IP addresses or services if possible.

For pricing details access https://openai.com/api/pricing/

Keep Reading