Step 1: Create an OpenAI account
If you haven't already, go to the OpenAI platform, and create an account.
Step 2: Create a project (optional)
You're logged in. Before we move to grabbing our API keys, you can organize them by project if you'd like. This lets you collaborate with your team, set custom billing limits, and have better visibility over usage.
If you want to use this feature, on the top left of the screen, click Default project and then Create project. (You can also access the Organization overview page from here.)

Step 3: Create an OpenAI API key
Since the OpenAI API isn't free, you need to create an API key so the platform knows who you are and who to bill the work to. To generate an OpenAI API key, look to top-right side of the screen, and click Dashboard.

This is the OpenAI Playground It has all the tools for testing and developing with the OpenAI API. After you read the welcome message pop-up, you can click Get Started to continue.

Close the pop-up. On the left-side menu, click API keys.

On the top right of the screen, click Create new secret key. Note: you can only create an API key once you verify your account with your phone number.

A pop-up appears with your API key settings. I'll walk you through all of these in just a second.

On the Owned by radio buttons, choose one:
- You is better for personal use. Check this option if you're going to be the only person making API calls. It's useful for integrating the OpenAI models with other apps you use that support API connections.
- Service account is for team or organizational use. This adds more security layers on the OpenAI platform, so it's suitable if multiple people will be using this key for API calls through the app you're building.
Very important: Regardless of the settings here, you need to keep this API key safe at all times. If someone finds your key, they could use it themselves, consuming credits, ruining training jobs you have going on, or even using it as an attack vector if you have OpenAI Assistants plugged into your systems. If this happens, you can discard the affected key and generate a new one. Don't share this key with anyone who doesn't need it, and if you're publishing an app to the public web, be sure to read up on your API security best practices.
Under Name, give your API key an appropriate name or service name ID.
If you created a project to manage your API keys, click the dropdown to select it. Otherwise, you can leave it on its default setting.
The last setting lets you adjust the Permissions this key has:
- All gives full access to all API features.
- Restricted lets you choose which models and tasks this key has access to. For example, if you're only using text generation, you can set Model capabilities to Write and all others to None.
- Read only blocks all writing requests, which is useful for pulling data into external systems.
Consider setting it to the lowest privilege level necessary to do what you need.
Once you've adjusted these settings, click Create secret key, and the platform will generate one for you. You won't be able to see this key again: copy and paste it to a safe place for now, and consider disposing of it after you've set up the call in the next step.

Once you click Done, the new key is added to the list. You can always delete or edit the name or permissions going forward.

Step 4: Add credits to your OpenAI account
You won't be able to use the API if you don't add a few credits. On the top right of the screen, click the cogwheel icon to go to the Settings page.

On the left-side menu, click Billing.

Follow the instructions to add a payment method: they're very similar to every other SaaS app you use.

Once complete, you'll see your pay-as-you-go credit on the page.

Comments
0 comments
Please sign in to leave a comment.