OpenAI API key works when locally hosted but not when uploaded to streamlit

Hi all,

My streamlit app works fine when locally hosted.

But as soon as I deployed it to streamlit. I can’t seem to get the API key working. I have checked more times then I can count that I have inputted the correct OpenAI API key.

here’s the repo: GitHub - ginozambe/AIToolHub

Any help would be greatly appreciated.

Hi @Gino_Zambe

How are you storing your OpenAI credentials? Is it stored in the secrets from within the secrets management in Community Cloud platform (Secrets management - Streamlit Docs), then calling it in the app via st.secrets

Please see a step-by-step tutorial showing how in this video:

Hope this helps!

What makes you think there is a problem with your API key? The error message, albeit incomplete, seems unrelated to it.

not sure, to be honest, still new to it all… but thank you for the link!