본문 바로가기
이것저것

ChatGPT API 맛보기 (Postman)

by 아이디생성자 2023. 5. 30.

 

가입 및 로그인     https://platform.openai.com/

 

API 키 발급     https://platform.openai.com/account/api-keys

 

api key 발급 창

키 이름 입력하고 생성, 이때 만들어진 키는 다시 볼 수 없으므로 바로 복사 후 꼭 따로 저장하기

 

 

채팅

아래 이미지와 같이 url 과 헤더 추가

api 키 입력시 앞에 'Bearer '를 입력해줘야한다.

 

url - https://api.openai.com/v1/chat/completions

Content-Type - application/json

Authorization - Bearer apikey

 

 

Headers

이후 바디에 파라미터를 아래와 같이 보내면 된다.

 

파라미터별 자세한 정보 - https://platform.openai.com/docs/api-reference/chat/create

body

 

 

이미지 생성

헤더는 채팅과 동일하며 url만 수정해주면 된다.

 

url - https://api.openai.com/v1/images/generations

 

파라미터별 자세한 정보 - https://platform.openai.com/docs/api-reference/images/create

 

 

data에 전달받은 url 링크를 누르면 이미지가 나온다.

 

 

+ 사실 이곳을 검색해서 들어올 이유가 전혀 없다.

ChatGPT에게 물어보면 다 알려준다....

 

댓글