-
Notifications
You must be signed in to change notification settings - Fork 280
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
[Feature]: Support Custom API Key Formats and Server Addresses #291
Comments
Stale issue message |
reopening, will take a look at this |
Currently OpenCommit supports two engines:
[CONFIG_KEYS.OCO_OPENAI_API_KEY](value: any, config: any = {}) {
//need api key unless running locally with ollama
validateConfig(
'API_KEY',
value || config.OCO_AI_PROVIDER == 'ollama',
'You need to provide an API key'
);
validateConfig(
CONFIG_KEYS.OCO_OPENAI_API_KEY,
value.startsWith('sk-'),
'Must start with "sk-"'
);
validateConfig(
CONFIG_KEYS.OCO_OPENAI_API_KEY,
config[CONFIG_KEYS.OCO_OPENAI_BASE_PATH] || value.length === 51,
'Must be 51 characters long'
);
return value;
}, @XiaomaiTX Could you please elaborate on the feature you would like to have? It seems you would like to have the ability to make calls to an LLM API specifying the URL of its backend, possibly another engine. Please enlighten us. |
@sebastienfi Another friend and I developed a project called ChatNio, which is an AI model aggregation platform, which means that users can access different back-end AI services supported by ChatNio through a unified API interface. The use of ChatNio's API interface is the same as that of OpenAI's API interface, but the length of the custom API key we provide is different from that of the official API Key of OpenAI, which causes problems when I want to connect the ChatNio service to opencommit in OpenAI format. |
I see. Then this is simply about removing the business rule which validates the OpenAI API Key format. The code that needs to change is the one I provided earlier. |
@sebastienfi It's my honor if I can submit a PR for this project!❤️ Can I submit PR tomorrow or the day after tomorrow? I'm a little busy today. |
Description
I would like to request the addition of a feature to allow for the customization of API key formats and the API server address, providing flexibility for users with diverse API key structures.
Suggested Solution
Introduce configuration options to set custom API key formats and a custom API server address. This can be achieved by adding commands similar to:
oco config set OCO_CUSTOM_API_KEY_PATTERN=<custom_key_pattern>
oco config set OCO_CUSTOM_API_SERVER=<custom_server_address>
Where <custom_key_pattern> represents the user-defined API key pattern, and <custom_server_address> represents the user-defined API server address.
Alternatives
Upon setting custom API key formats and a server address, OpenCommit should utilize the specified formats for API requests instead of the default settings.
Additional Context
No response
The text was updated successfully, but these errors were encountered: