Python client for the unofficial ChatGPT API by OpenAI.
To install the ChatGPT Client, run the following command:
pip install chatgpt-client
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())
This project is licensed under the MIT License - see the LICENSE file for details.