Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: hostname config to support other api services #232

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

savoygu
Copy link

@savoygu savoygu commented Jul 15, 2023

No description provided.

@eMUQI
Copy link

eMUQI commented Aug 11, 2023

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.

@savoygu
Copy link
Author

savoygu commented Aug 14, 2023

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.

@0xemc
Copy link

0xemc commented Oct 2, 2023

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

src/utils/config.ts Outdated Show resolved Hide resolved
@toropanov
Copy link

toropanov commented Feb 21, 2024

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

@tgolsen
Copy link

tgolsen commented Feb 27, 2024

Not to step on toes but I made this PR: #272

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants