aicommits icon indicating copy to clipboard operation
aicommits copied to clipboard

feat: `hostname` config to support other api services

Open savoygu opened this issue 1 year ago • 5 comments

savoygu avatar Jul 15 '23 15:07 savoygu

Nice work! This is also a feature that I have been expecting.

However, after taking a quick look at your commit, I have a few suggestions regarding the code (Please forgive me for not being familiar with JavaScript or Node.js, so my suggestions below may contain errors):

  1. According to the OpenAI Node.js Library, it is actually possible to achieve this functionality by setting the basePath. However, it seems that this project may have modified some of the logic to support proxies, which has resulted in the inability to use this feature. However, I still recommend referring to the naming in the OpenAI Node.js Library and considering using basePath as a more appropriate naming option instead of hostname.

  2. And this commit has given me inspiration. When checking for OPENAI_KEY, OpenAI uses sk- as a prefix. However, when using a third-party basePath, some API distributors or proxies may not adhere to this format. Therefore, when using a third-party basePath, I suggest no longer checking the key format.

eMUQI avatar Aug 11 '23 13:08 eMUQI

However, it seems that this project may have modified some of the logic to support proxies, which has resulted in the inability to use this feature.

Yes, aicommits encapsulates the logic for the standalone request itself, without the help of the official OpenAI Node.js Library, which requires a lot of tweaking because the basePath in the official library is different from the hostname in the current pr.

For the OPENAI_KEY checksum, it's not really related to basePath, so maybe we can provide another pr to do it.

savoygu avatar Aug 14 '23 03:08 savoygu

Bump on this. Though it looks like hostname must now always be provided and doesn't default to the openai api

0xemc avatar Oct 02 '23 03:10 0xemc

Can you add also custom path for api? I need not /v1/chat/completions but /openai/v1/chat/completions

toropanov avatar Feb 21 '24 16:02 toropanov

Not to step on toes but I made this PR: https://github.com/Nutlope/aicommits/pull/272

Currently using this with an Azure instance of GPT and it's working for me.

tgolsen avatar Feb 27 '24 14:02 tgolsen