Home

Awesome

:warning: This repository is deprecated and no longer maintained!

if you have a question about it you can join our Discord server.

For support join [Discord]

PyGPT - Unofficial API client for ChatGPT [Discord]

Other versions [NodeJS Version][C# Version]

PyPi Version PyPi Downloads GitHub issues GitHub forks GitHub stars GitHub license Discord server

Check the new Google Bard Chatbot!

Get Started

Install dependencies first

pip install --upgrade PyGPT

Example

import asyncio
from pygpt import PyGPT

async def main():
    chat_gpt = PyGPT('eyJhbGciOiJkaXIiLCJlbmMiOiJBMR0NN....')
    await chat_gpt.connect()
    await chat_gpt.wait_for_ready()
    answer = await chat_gpt.ask('What is the capital of France?')
    print(answer)
    await chat_gpt.disconnect()

if __name__ == '__main__':
    asyncio.run(main())

For multiple queries

import asyncio
from pygpt import PyGPT

async def main():
    chat_gpt = PyGPT('eyJhbGciOiJkaXIiLCJlbmMiOiJBMR0NN....')
    await chat_gpt.connect()
    await chat_gpt.wait_for_ready()
    questions = ["how are you", "where do you live", "what do you do"]
    for question in questions:
        answer = await chat_gpt.ask(question)
        print(answer)
    await chat_gpt.disconnect()

if name == 'main':
    asyncio.run(main())