Creating Openai API keys programmatically

Does anyone know if it is possible to generate API keys in an automated way versus manually doing it by logging in to your account?

I assume its not, though not first time i would have been wrong.

Somekind of automatic way to generate new API keys would also allow misuses way much easier.

1 Like

There is no official API method to manage keys.

However, you can manually generate many API keys (not sure how many, you can try) and store them securely locally and retrieve them locally as you need them.

I may write my own script to create they keys because on my app all my users will need their own keys because the DALLe API limit of 50 images/min is not sufficient at all and manually creating the APi keys is not feasible as i would need thousands. Thanks for you help though.

We repeat with a smile @cbear300

There is no approved OpenAI API method to generate API keys.

:slight_smile:

1 Like

Was just about to say there is no official API support for doing this, but it is possible. :slightly_smiling_face:

You must create your first API key via the web UI/browser, but after that there is an ‘unofficial & unsupported’ API endpoint that will let you create and delete API keys.

I have been privately advised by OpenAI staff that “they are not part of our publicly documented API, and we’d prefer that people not access them programmatically”, so I will not post the URL’s here. But feel free to take a look at my profile :wink:

Also, I think you can have 4 or 5 API keys per user (and yes, there are user creation/deletion endpoints too)

I really hope OpenAI releases official & supported account management API endpoints soon.

M

1 Like

Yes @mc1903 but @cbear300 said “thousands” , not 5 …

There is a big difference between 1000s and 5, he says with a smile.

:slight_smile:

1 Like

I am thinking they need to use their own API proxy for this… Issue their own app (non OpenAI) API keys to each of their 1000+ users on the front end and inject their real OpenAI API key into the back-end request to the OpenAI API endpoints.

Not my area of expertise and I am sure there are 100’s of gotcha’s.

… and not the least of which is the OpenAI Terms of Usage.

Sounds like a good way to get blocked, TBH.

:slight_smile:

1 Like

Fair point. Do you have any specific reference in the OpenAI Terms of Usage that forbids this; had a quick skim couldn’t see anything.

It seems reasonable to separate your user side traffic from the back end traffic, especially to protect your actual back end API key.

You could ask OpenAI.

I am sure they will have a better and more definitive answer than me.

:wink:

1 Like

looool… Has anyone, in the history of OpenAI, ever had a response from support :stuck_out_tongue_closed_eyes:

1 Like

There is a rumor than one person did, but he fell into a state of shock in total disbelief and has not been heard from since then.

:laughing:

1 Like

I thought i was the only one they never responded to , nice to know i am not alone. Also, @mc1903 thanks for your suggestion but i will need 1000s of API keys 5 will not be enough, that being said I’ll still take a look at your profile

1 Like

Hi @cbear300

The limit is on API account not per key.

And no there’s no way to create API key programmatically, for good reasons.

Currently the DALL-E API is in beta hence the limits.

Also it’s never meant for OpenAI API keys to be used per user, instead these are meant for server side and not client-side.
Consider using service like Microsoft Azure API service to deploy your middleware API for secure authentication and user control.

Are you 100% sure its per account and not API key and where did you see this information. Also the API are created for my user and used server-side not client side. Azure would not be suitable and I have already implemented a secure way of user auth. The only 2 solutions to my problem is either a way of creating API keys programmatically or a significantly increased limit, which is not realistic. API keys are stored in my own database and can also be accessed by my .env environment variables in my server

Yes, @cbear300 I also read the reference posted by @sps as “per account”.

Also that has always been how I thought rate-limiting was defined.

HTH

1 Like

If that is the case I may have to find a different text to image API to use

I just rechecked and it is a max 5 API keys per ‘member’ account - these two members/users are in the same org.

Even if 100’s of member accounts could be created per org, each with max 5 API keys, it’s not an elegant solution and clearly not how OpenAI envisaged the API’s being consumed.

2 Likes