I am new to retool so help me here
I am using python sdk to access openai models in the workflow code block but I don't know how to add an environment variable to store API key then access it in the retool workflow.
Thanks
Hi @Shirina
If you're calling the Workflow from an App, you can store the API key into the global JS in settings, such as window.openaiKey = 'your key'
and in the query call just pass it as parameter.
While for scheduled Workflow, I guess the only way is to put the key in the block that is making the OpeAI request.
Hope this help.
Hi @abusedmedia
Thank you for replying.
Just to be clear, if I add the key this way, it will be visible to others users (those who has access to the same environment) right?
I guess so unless you're adding the key in setting of the App and not the Org, and that App is limited to some user group. It's a guess, didn't test it.
I am not allowed to sore the key in the frontend, so I guess I will use it in the workflow then. But thanks for the feedback.
Hi @Shirina - we support referencing secret configuration variables in workflows! You can create them in the "Configuration variables" page in the Settings. Is this what you're looking for?