tinychat icon indicating copy to clipboard operation
tinychat copied to clipboard

Support custom API base

Open johnd0e opened this issue 1 year ago • 2 comments

I would like this feature to be available in the settings. The default value should be https://api.openai.com/v1, however, it should also allow the specification of custom values.

I would also like to see similar setting for Google Gemini API base, with default value https://generativelanguage.googleapis.com or https://generativelanguage.googleapis.com/v1beta.

This should not be a fixed option, as there may be a need to switch APIs dynamically.

Please note:

  • Different APIs typically do not use the same API keys.
  • Sometimes, certain APIs do not require API keys at all, and more importantly, passing a redundant value as an API key could potentially trigger an error.

johnd0e avatar May 05 '24 13:05 johnd0e

Hi there and thanks for the suggestion!

Please tell me more. Why would having the a default value in settings be useful?

How does that improve the ability to create new models for a given provider?

Aside from cleaning up the codebase which I agree it would by moving the hardcoding in a more suitable place! But why the base url?

What other endpoints are you thinking about using?

pymike00 avatar May 06 '24 07:05 pymike00

Please tell me more. Why would having the a default value in settings be useful? How does that improve the ability to create new models for a given provider?

Uh.. It seems to me that we do not speak about the same matter. I will try to explain further.

But why the base url? What other endpoints are you thinking about using?

I am not thinking about other endpoints at all. I mean quite opposite: there is only one possible endpoint (/chat/completion), but many variable base api urls possible. Besides, it is quite common practice - to specify base url.

Because there are a lot of other services, that are compatible with OpenAI.

johnd0e avatar May 06 '24 11:05 johnd0e