How to create a GPT-4 API?

Hi guys

I got the invitation for OpenAI GPT-4 API but in the page how do I create a GPT-4 api key? Or I just generate any key and on my end I specify this is model gpt-4?

Thanks for help.

You should create a new key and then specify the gpt-4 model :slight_smile:

1 Like

im sure the option is there …

oh you meant to specify in the app … sure

btw another weird thing i just created a paid account in the billing session and when i try the test key in the code

import os
import openai

openai.organization = "org-my org"
openai.api_key = os.getenv("sk-OPENAIKEY")

openai.Model.list()

it says

openai.error.AuthenticationError: No API key provided. You can set your API key in code using ‘openai.api_key = ’, or you can set the environment variable OPENAI_API_KEY=). If your API key is stored in a file, you can point the openai module at it with ‘openai.api_key_path = ’. You can generate API keys in the OpenAI web interface. See for details, or email support@openai.com if you have any questions.

any idea why?

thanks

Probably because you have not set your open ai API key in your env variable. You can run it without setting your env variable like this.

import os
import openai

openai.organization = "org-my org"
openai.api_key = "Your-API-Key"

openai.Model.list()

The API key is just the key, it does not encode any kind of access information. The ability to use model = 'gpt-4' is just a change in your function call, i.e. if you change the model name in your code from gpt-3.5-turbo to gpt-4 you will now be using gpt-4.

The two separate endpoints can be used with the same API key.

1 Like

Welcome to the community!
The key stays the same, but when you doing you request you should specify for GPT-4 model.