Skip to content

patsxy/Deploy-ChatGPT-to-API

 
 

Repository files navigation

Deploy ChatGPT to API

These days I found an interesting repo ChatGPT to API. You can deploy a fake API using the web version of ChatGPT.
However, it's docs are not specific. This repo is to help you easily config and deploy ChatGPT to API.

Requirements

  • git
  • python3
  • Docker (if deploy in Docker)
  • golang and go command in PATH (if deploy in host)
  • One or more ChatGPT accounts

Steps

  1. Clone this repo to somewhere (suppose /dcta/)
  2. Edit the following variables in run.py:
    • proxy: format: host:port. If you don't need proxy, set it to ""
    • proxy_type: possible values: "socks5" or "http"
    • accounts: It's a dictionary of accounts' info. Multiple users are supported. See the example bellow
    • server_host: the host you want ChatGPT-to-API to listen
    • server_port: the port you want ChatGPT-to-API to listen

image
3. If deployed in host: run pip3 install -r requirements.txt
If deployed in docker: nothing to do in this step
4. run build.py and follow the instructions.
5. run the service:
If deployed in docker:
open a terminal in /dcta/. run docker compose up -d
If deployed in host: open a terminal in /dcta/. run run.py
6. Enjoy~

FAQ

  • Q: What if the access_token of OpenAI expire?
    A: If this happen, the request to the fake api will cause 500 status code in ChatGPT-to-API. I use python to inspect this code and will regenerate access_token and restart ChatGPT-to-API automatically.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%