What is chatgpt-api?
chatgpt-api
was a simple tool I made to interact with ChatGPT. You could use it to bring up the ChatGPT interface directly in your terminal. So if you were too lazy to open your browser or wanted to integrate ChatGPT into another software, this was your go-to tool.
Why I Built It
I built chatgpt-api
during the time when ChatGPT was becoming super popular and there was no API. I thought it would be fun to build something that I, and hopefully others, would find useful. It actually received more than 100 stars on GitHub. This felt good, as it was the first time any of my projects had gained that much attention.
The Tech Stack
- Python
- Typer (with Rich): I used Typer to build the CLI. It made it super easy to add commands and options. Rich helped me make the terminal output look really nice.
- httpx: This is what I used for sending HTTP requests to the ChatGPT API.
Community Involvement
One of the coolest parts was when people started to contribute to the project. It felt great to know that something I built for fun was useful enough for others to spend their time improving it.
Why It’s No Longer Maintained
Unfortunately, OpenAI started using Cloudflare, which made it impossible for this kind of library to function as it did. There were some bypasses (using Selenium/Playwright), but the project was too time-consuming to maintain.
Lessons Learned
It’s not impossible to earn stars on GitHub :D I thought it would be more difficult. I guess the timing helped a lot in this case.