Skip to content

lazyYC/Python-chatGPT-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

chatGPT API module by Python

This is a handy, lightweight unofficial chatGPT API, since OpenAI has not released their own yet.

如何使用
How to use?

1. 獲得你的權限token
get your auth token

1-1 到OpenAI的網站
go to https://chat.openai.com/chat

1-2 按F12找到應用程式裡面的cookies
press F12 and find "cookies" at application

1-3 選"__Secure-next-auth.session-token"並複製後面一長串的值
check "__Secure-next-auth.session-token" and copy the value

image

2. API

from chatgpt_api import chatgpt_api
api = chatgpt_api(
    # your token
)
api.open_browser()

# 傳入訊息
# send message to chatGPT
resp = api.send_message('good morning')
print(resp)

Response
image



你也可以指定輸出語言,目前只提供繁簡中文和英文
you can also specify a language you want chaTGPT replay with, now only English, ZH-TW and ZH-CN are supported.

resp = api.send_message('What can I do if I lose my sleep?', 'zhtw')
print(resp)

Response
image

功能陸續增加中,邊做邊學邊練習

About

An unofficial chatGPT API module made by LazyYC

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages