How to Get Your Open AI API Key
Get your OpenAI API key to start using the API models from OpenAI in your apps.
To get OpenAI API Key, go to the platform.open.com website, log in or sign up if you don't have an account yet. Then, click on the 'Account Initials/Picture' to open an overflow menu and select 'View API Keys.' Click on 'Create new secret key' to generate the API key, copy it and store it somewhere safe. You can create multiple API keys for different tools and delete them by clicking the 'Trash icon' beside them.
ChatGPT has taken the world by storm with its capabilities. And if you are an app builder with a fantastic idea that could benefit by harnessing the power of ChatGPT, OpenAI API will tickle you pink.
What is OpenAI API and How Does it Work?
API (Application Programming Interface) allows you to access the features and data of any other program or app (ChatGPT in this case). Integrating an API enables you to perform all the functions the source app/ program can but inside your app environment.
To put it in context, below-mentioned is a list of requests you will be able to cater to with OpenAI API:
- Advanced Reasoning and Creative Writing.
- Visual Input (you can take images as input and perform actions such as identifying contents and explaining the image). This ability is coming soon to GPT-4 as it is still in research preview and not publicly available.
- Long-form content creation, Document analysis, and Long text acceptance; GPT-4 can handle more than 25,000 words.
Using the API is not free, though. Once you exhaust your free credit of $5, you must pay for what you use. The pricing varies according to which model you're using and how large of a context dataset you wish to allow as an input.
For instance, GPT-4 API will cost you $0.03/ 1K tokens for prompts, and you will need to pay $0.06/ 1K tokens for the completion if you opt for the 8K Token context models (e.g.
There are also 32K Token context models (e.g.
gpt-4-32k-0314), where you would need to pay $0.06/ 1K tokens for prompts and $0.12/ 1K tokens. To provide perspective, 1K tokens is roughly 750 words.
In comparison, the pricing for the
gpt-3.5-turbo model is $0.002/1K tokens.
OpenAI offers a few models with different capabilities at different price points which you can use. For your ease of convenience, we have listed them below.
- GPT-4: This is the latest model with a broad general knowledge base and domain expertise. It can comprehend complex instructions and resolve problems with accuracy.
- Chat (GPT 3.5): GPT 3.5 (i.e.,
gpt-3.5-turbomodel) is optimized for dialogue. You should opt for this if you need to build a natural-sounding chatbot.
- InstructGPT: You should opt for this model if you need an AI that can follow single-turn instructions. There are four models under this, namely Ada ($0.0004/1K tokens), DaVinci ($0.0200/1K tokens), Babbage ($0.0005/1K tokens), and Curie ($0.0020/1K tokens).
- Image and Audio models: There are also other models available with OpenAI API, like image models, which can build DALL-E into your app for image generation, and audio models, where you can use Whisper API, which can recognize speech and transcribe it.
The OpenAI API uses API keys for authentication. Now that you understand how APIs work and what is all on offer, let's head on to how to create an API key to use them.
Create an OpenAI API Key
First, you should head to the platform.open.com website using your preferred browser. Then, if you already have an account, enter the credentials to log in. Otherwise, you can click the 'Sign Up' button to create a new account. Else, you can also use your Google or Microsoft account to sign in without creating an account.
Once logged in, tap on the 'Account Initials/ picture' to open an overflow menu. Then, click on the 'View API Keys' option from the list to proceed.
Afterward, click on the 'Create new secret key' button. This will bring an overlay window to your screen.
Next, copy the displayed API key and paste it somewhere for safekeeping; for security reasons, you will only be allowed once to view the key. Click on 'OK' to close the window.
That's it, you can now use the generated key for your third-party tools, and they will be able to access OpenAI's servers.
If you wish to delete an API key, click on the 'Trash icon' beside it.
A window will appear on your screen. Click the 'Revoke key' button to permanently delete the API key.
You can also create multiple API keys on the platform and use separate API keys for different tools for better and more efficient tracking of the usage by the third-party tools.
Creating an API key is probably the simplest task; however, choosing the model that will fit your needs might take some brainstorming on your part.