MichielvanBeers / Flow.Launcher.Plugin.ChatGPT

MIT License
45 stars 7 forks source link

Allow custom API base url #57

Open BYJRK opened 4 months ago

BYJRK commented 4 months ago

Currently, this plugin uses the official API url of OpenAI by default and cannot be customized. It is hoped that the function of adding custom API links can be added to support users in using unofficial APIs.

MichielvanBeers commented 4 months ago

Hi @BYJRK, thanks for the suggestion! What custom API URL are you exactly hoping to support? Since making the API configurable shouldn't be a major challenge, but ensuring that the payload is the same may require more work.

If you want to try it out on your local machine you can also take the following steps:

  1. Go to your plugins
  2. Look up the ChatGPT plugin
  3. Open the Plugin folder
  4. Open the main.py file
  5. On line 100, change the url variable to the variable you would like to use.
BYJRK commented 4 months ago

Hi @MichielvanBeers, in some countries, due to restrictions imposed by OpenAI itself, many people are unable to directly use and pay for OpenAI's API services, thus they cannot directly access its default API base url. For example, in China, there are quite a bit agents that offer the exact same API but with different base urls. In addition, some individuals may opt to use services like Azure.

The method you provided also seems feasible, I will try to modify the Python script later. But I still hope to see a configuration option for modifying base url someday. Keep up the good work!