/my-chatgpt-project

Nextjs 프로젝트에서 ChatGPT API 요청해보기

Primary LanguageTypeScript

ChatGPT API를 써보자

준비

  • Node.js
  • npm or yarn

설치

  1. Clone the repository:
git clone git@github.com:inseo24/my-chatgpt-project.git
cd my-chatgpt-project
  1. Install dependencies
npm install

or

yarn install
  1. Add OpenAI API Key to .env.local file
OPENAI_API_KEY=your-api-key-here
  1. Run the App
next dev

or

npm run dev

or

yarn dev
  1. Page : http://localhost:3000
image
  1. Changing the ChatGPT Model

/api/chat/route/ts

const payload = {
  messages,
  model: 'gpt-4-1106-preview', // Change this to the model you want to use
  stream: false,
};