Unable to access API key

I have deployed my flask app successfully through GitHub, however, My API key cannot be stored on GitHub due to leak issues of OpenAI API policy.

I have added the environment variable on render. however, it is still not accessing the API key, generating 500 internal server error and logs show no API key could be found. Please advise how to fix this issue.


You’ve not really provided any specific details, when asking for assistance, elaborate on your issue in as much detail as possible, e.g. logs/error messages, reproduction steps, screenshots, etc. to show the problem you’re experiencing. If you don’t want to share these details on the community forum, please feel free to raise a ticket from the “Contact Support” link at the bottom of the Dashboard while logged in.

The only thing I can suggest here is to ensure your env var is referenced correctly in your code, e.g. if you’ve set MY_KEY in your service environment section, you’d access in your code with something like:

import osMY_KEY = os.getenv("MY_KEY")


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.