ChatGPT doesn't have an official API yet, but this package solves that issue by using the OpenAI completions API with a leaked model that ChatGPT uses under the hood. Works pretty well! Would recommend trying it out.