Hey, there community!
I am trying to implement the gpt API, I am following the exact same code as in the docs, I set the key as environment variables, I even included an env file in my nest js project, but it is not picking up my API key. It only works if I set it directly equal to the key. Here’s how I am initializing it:
const openai = new OpenAI({
apiKey: process.env.OPENAI_API_KEY, <
});
and in my env: OPENAI_API_KEY = "my key"
what should I do? I need a permanent solution, where I just have to open up the project and run it. I tried a solution where it says to just load a profile file, it worked temporarily but lasted only the current session
I also plan on deploying it, so pointers for that would be great too.