Skip to content

x1a00/chatgpt-python

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Downloads PyPi License

ChatGPT Python SDK

Buy Me A Coffee

Install

pip install -U chatgpt

Get the credentials

  1. Login into https://chat.openai.com/chat with your browser
  2. Paste the content of interceptor.js in the browser console
  3. Store the JSON in a file called config.json

Usage

Interactive chat

chatgpt

or

python -m chatgpt

SDK

from chatgpt import Conversation

conversation = Conversation()
print(
    conversation.chat(
        "We are going to start a conversation. "
        "I will speak English and you will speak Portuguese."
    )
)
print(conversation.chat("What's the color of the sky?"))

# The AI will forget it was speaking Portuguese
conversation.reset()
print(conversation.chat("What's the color of the sun?"))

About

Unofficial Python SDK for OpenAI's ChatGPT

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 78.0%
  • JavaScript 19.8%
  • Shell 1.9%
  • Dockerfile 0.3%