I am trying to use ChatGPT API to build a Chatbot with Next.js and deploy on Vercel.
In local development environment everything worked perfectly but the problem occured when I deployed.
The log from Vercel said that it can not find the API Key for my ChatGPT API
Eventhough I have set my environment variable in deployment settings on Vercel it was not working.
The solution I have figured out was change API key name from OPEN_API_KEY -> NEXT_PUBLIC_OPEN_API_KEY
However I am worrying that my secret key can be exposed in public.
Is my solution a safe way to use? If it's not please provide me other possible solution.
Thank you.