Will this work with React/Nextjs? #1
-
I am confused as to whether this is client-side code or server-side code, as if the former, the API key may be exposed. On the other hand when i tried to run it from a nextjs app it threw up all kinds of errors. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi there @quacrobat, This library is intended for server-side code. OpenAI ]does not recommend](https://github.com/openai/openai-node#openai-nodejs-library) using JavaScript API client code on the client side due to exposing secret API keys. We haven't used this library ourselves with NextJS, but we have used it in a NodeJS app and a Typescript app. I hope that helps, James |
Beta Was this translation helpful? Give feedback.
Hi there @quacrobat,
This library is intended for server-side code.
OpenAI ]does not recommend](https://github.com/openai/openai-node#openai-nodejs-library) using JavaScript API client code on the client side due to exposing secret API keys.
We haven't used this library ourselves with NextJS, but we have used it in a NodeJS app and a Typescript app.
I hope that helps,
James