How to create an OpenAI API key to use in Ozeki AI Gateway

This guide demonstrates how to create an OpenAI API key and configure it in Ozeki AI Gateway. You'll learn how to access the OpenAI platform, generate a new API key, and set up OpenAI as a provider in your gateway. By following these steps, you can connect your Ozeki AI Gateway to OpenAI's models and services.

What is an OpenAI API Key?

An OpenAI API key is a unique authentication credential that allows applications to access OpenAI's AI models and services. The API key serves as a secure token that identifies your OpenAI account and authorizes API requests. When configuring OpenAI as a provider in Ozeki AI Gateway, you need this API key to establish the connection between your gateway and OpenAI's services.

How to create an OpenAI API Key (Quick Steps)

  1. Open OpenAI platform
  2. Login to OpenAI
  3. Click create new secret key
  4. Enter key details
  5. Create key
  6. Copy API key
  7. Open Providers page in Ozeki AI Gateway
  8. Add new provider
  9. Enter OpenAI provider details
  10. Create provider

How to create an OpenAI API Key (Video tutorial)

In this video tutorial, you will learn how to create an OpenAI API key and configure it in Ozeki AI Gateway step-by-step. The video covers accessing the OpenAI platform, generating a new API key, and setting up OpenAI as a provider in your gateway.

Step 0 - Install Ozeki AI Gateway

Before configuring OpenAI as a provider, you need to have Ozeki AI Gateway installed and running on your system. If you haven't installed Ozeki AI Gateway yet, follow our Installation on Linux Guide to complete the initial setup.

Step 1 - Open OpenAI platform

Open your web browser and navigate to the OpenAI platform API keys page. This is where you'll create and manage your OpenAI API keys (Figure 1).

Open OpenAI platform
Figure 1 - Open OpenAI platform

Step 2 - Login to OpenAI

Sign in to your OpenAI account using your credentials. If you don't have an OpenAI account yet, you'll need to create one before proceeding. After logging in, you'll have access to the API keys management section (Figure 2).

Login to OpenAI
Figure 2 - Login to OpenAI

Step 3 - Click create new secret key

Navigate to the API keys section in your OpenAI dashboard and click the "Create new secret key" button (Figure 3).

Click create new secret key
Figure 3 - Click create new secret key

Step 4 - Enter key details

Enter a descriptive name for your API key that identifies its purpose and select which project the API key belongs to. For example, you might name it "Ozeki AI Gateway" to indicate it will be used with your gateway installation. For testing purposes, the "Default project" will suffice (Figure 4).

Enter key details
Figure 4 - Enter key details

Step 5 - Create secret key

Click the "Create secret key" button to generate your new OpenAI API key. OpenAI will create a unique key that you'll use to authenticate your gateway with OpenAI's services (Figure 5).

Create secret key
Figure 5 - Click create secret key

Step 6 - Copy API key

After the API key is generated, OpenAI displays the complete key value. Click the copy button to copy the key to your clipboard (Figure 6).

The API key is shown only once during creation. Make sure to copy and securely store the key before closing this window.

Copy API key
Figure 6 - Copy API key

Step 7 - Open Providers page in Ozeki AI Gateway

Open the Ozeki AI Gateway web interface and navigate to the Providers page. This is where you'll configure OpenAI as a new provider using the API key you just created (Figure 7).

Open Providers page
Figure 7 - Open Providers page in Ozeki AI Gateway

Step 8 - Click add new provider

Click the "New" button to begin the provider creation process. This opens a form where you'll enter the connection details for OpenAI (Figure 8).

Click add new provider
Figure 8 - Click add new provider button

Step 9 - Enter OpenAI provider details

Fill in the provider configuration form with OpenAI's details. Enter "OpenAI" as the provider name, select "OpenAI compatible" as the provider type, specify the API endpoint URL, and paste the API key you copied earlier. Select the preferred model from the dropdown list, then click "Create" to save the configuration (Figure 9).

https://api.openai.com/v1

Enter OpenAI provider details
Figure 9 - Enter OpenAI provider details and create

Step 10 - Provider created

After clicking "Create", the OpenAI provider is added to Ozeki AI Gateway. The provider now appears in the providers list, confirming that your gateway can route requests to OpenAI's services. You can now create routes that allow users to access OpenAI models through your gateway (Figure 10).

Provider created
Figure 10 - OpenAI provider created successfully

Conclusion

You have successfully created an OpenAI API key and configured it as a provider in Ozeki AI Gateway. Your gateway can now communicate with OpenAI's services and access models like GPT-5 and other OpenAI models through your centralized gateway infrastructure. This setup allows you to manage OpenAI access for multiple users and applications from a single point.

More information