In short
NextJS api router failed to call openai api endpoint createChatCompletion() while pure Node.js code can succeed.
Detail
I use NextJS 's api router as coded here to call "openai api" endpoints using Node.js package openai
I got 401 at calling endpoint createChatCompletion() view code - though succeeded 200 with createCompletion() view code
I double check with pure Node.js code, and can succeed calling createChatCompletion(), strange...
What am I missing?
p.s.
My search in Stack Overflow and Google search result with no helpful found

As far as I know, nextjs define env in
next.config.jsSample