Skip to content
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.

vsakkas/chatgpt-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ChatGPT Client

Latest Release Python MIT License CI

Python client for the unofficial ChatGPT API by OpenAI.

Installation

To install the ChatGPT Client, run the following command:

pip install chatgpt-client

Usage

Sign up for an OpenAI API key and store it in your environment.

import asyncio
import os

from chatgpt_client import ChatGPTClient

async def main() -> None:
    api_key = os.getenv("OPENAI_API_KEY")
    client = ChatGPTClient(api_key)

    response = await client.get_completion("What is the meaning of life?")
    print(response["choices"][0]["text"])

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

License

This project is licensed under the MIT License - see the LICENSE file for details.