marcolardera / chatgpt-cli

Simple yet effective command line client for chatting with ChatGPT using the official API
MIT License
454 stars 80 forks source link

Could this tool be extended to include models outside of OpenAI? #69

Open TiansuYu opened 4 months ago

TiansuYu commented 4 months ago

I am thinking about trying out models from Anthropic and MistralAI on this tool as well. Given how similar the model APIs are between these companies. Could this be easily achieved on this tool?

marcolardera commented 4 months ago

Hello @TiansuYu, the providers supported out-of-the box are OpenAI and Azure. However, it should require only a small code modification to add other providers, given that the the API are the same (with just a different base endpoint)...

I add this suggestion to my "to to list when I find time/motivation" :)

In the meantime, you can try to set the environment variable OPENAI_BASE_ENDPOINT to the base endpoint of Anthropic/Mistral. Also set your API key provided by one of those suppliers. If the API is exactly the same as OpenAI, in theory, it should work. Let me know if it is the case...

TiansuYu commented 4 months ago

I will experiment around it. Open a PR if my time permits. 😄

TiansuYu commented 4 months ago

Draft PR https://github.com/marcolardera/chatgpt-cli/pull/71 Seems API KEY loading is not working as intended, needs some further work on this.

TiansuYu commented 4 months ago

Some general comments on how to refactor this repo: