How to get an OpenAI API key for ChatGPT

The biggest mistake people make when trying to get their ChatGPT API key is that they use the wrong URL.

The key can't be found at chatgpt.com. Instead, point your browser to the OpenAI developer platform. With the correct URL in hand, generating an OpenAI key so you can programmatically access ChatGPT becomes a whole lot easier.

How to get a ChatGPT API key

With the correct URL at your disposal, follow these steps to get an OpenAI API key so that applications can programmatically connect to ChatGPT models:

  1. Navigate to platform.openai.com.
  2. Click on the Dashboard link.
  3. Click on the API keys link.
  4. Click on the Create new secret key link.
  5. Provide a name for the key and select Create secret key.
  6. Copy and save the alphanumeric API key.
  7. Click Done.
OpenAI API key screenshot.
Your OpenAI API key will be temporarily displayed in the browser. Copy and save the key, as once the page is closed, it is no longer recoverable.

How to use the ChatGPT API key

There are generally two ways to use an OpenAI key:

  • The key is entered into the settings page of a software program that accesses OpenAI for you.
  • The key is used programmatically and OpenAI queries are initiated from Python, JavaScript or Java code.

However, regardless of how your key gets used, you need to purchase token credits before it becomes functional. While ChatGPT can be queried extensively through the browser, to access the API tokens must first be purchased.

Cost of OpenAI access tokens screenshot.
OpenAI API access is not free. Tokens must first be purchased before an OpenAI key can be used.

The cost of ChatGPT

For a casual user, $20 worth of tokens is more than enough to test the API or casually use an OpenAI-enabled software product for several months. It's a small investment that could open a world of AI-powered opportunities for you and your organization.

Cameron McKenzie has been a Java EE software engineer for 20 years. His current specialties include Agile development; DevOps; Spring; and container-based technologies such as Docker, Swarm and Kubernetes.

View All Videos