How to encrypt/restrict access to `openai.api_key` within jupyter notebook like online code-editor

We need to let users to try out openai api-calls within jupyter notebook like online code editor environment,

users should be able to run most of the openai python API calls (hands-on tutorials for internal training)
but we need to restrict users from printing openai.api_key or we need to print only encrypted value, within the online code editor
Any help / reference is much appreciated. #api_key

1 Like

I suspect you’re not gonna get around proxying traffic through one of your servers.

You might consider generating a bunch of API keys for every user, and then invalidating them after the users are done, but I’d advise against it: OpenAI has had issues with invalidating API keys in the past. Exposing them is a massive risk, as users have also reported OpenAI’s budget limit also failing, resulting in massive bills.