Skip to main content

Python client for the unofficial ChatGPT API.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chatgpt_client-0.2.0.tar.gz (4.7 kB view hashes)

Uploaded Source

Built Distribution

chatgpt_client-0.2.0-py3-none-any.whl (4.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page