mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
refactor: Move OpenAI Base URL option to credentials (#12175)
This commit is contained in:
@@ -30,6 +30,13 @@ export class OpenAiApi implements ICredentialType {
|
||||
description:
|
||||
"For users who belong to multiple organizations, you can set which organization is used for an API request. Usage from these API requests will count against the specified organization's subscription quota.",
|
||||
},
|
||||
{
|
||||
displayName: 'Base URL',
|
||||
name: 'url',
|
||||
type: 'string',
|
||||
default: 'https://api.openai.com/v1',
|
||||
description: 'Override the default base URL for the API',
|
||||
},
|
||||
];
|
||||
|
||||
authenticate: IAuthenticateGeneric = {
|
||||
@@ -44,8 +51,8 @@ export class OpenAiApi implements ICredentialType {
|
||||
|
||||
test: ICredentialTestRequest = {
|
||||
request: {
|
||||
baseURL: 'https://api.openai.com',
|
||||
url: '/v1/models',
|
||||
baseURL: '={{$credentials?.url}}',
|
||||
url: '/models',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -28,7 +28,8 @@ export class OpenAi implements INodeType {
|
||||
],
|
||||
requestDefaults: {
|
||||
ignoreHttpStatusErrors: true,
|
||||
baseURL: 'https://api.openai.com',
|
||||
baseURL:
|
||||
'={{ $credentials.url?.split("/").slice(0,-1).join("/") || https://api.openai.com }}',
|
||||
},
|
||||
properties: [
|
||||
oldVersionNotice,
|
||||
|
||||
Reference in New Issue
Block a user