feat(Anthropic Chat Model Node): Add configurable base URL for Anthropic API (#15063)

This commit is contained in:
oleg
2025-05-05 09:57:10 +02:00
committed by GitHub
parent 54499fc6d1
commit 4b5f045281
4 changed files with 56 additions and 6 deletions

View File

@@ -266,8 +266,10 @@ export class LmChatAnthropic implements INodeType {
};
async supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {
const credentials = await this.getCredentials('anthropicApi');
const credentials = await this.getCredentials<{ url?: string; apiKey?: string }>(
'anthropicApi',
);
const baseURL = credentials.url ?? 'https://api.anthropic.com';
const version = this.getNode().typeVersion;
const modelName =
version >= 1.3
@@ -317,8 +319,9 @@ export class LmChatAnthropic implements INodeType {
}
const model = new ChatAnthropic({
anthropicApiKey: credentials.apiKey as string,
anthropicApiKey: credentials.apiKey,
modelName,
anthropicApiUrl: baseURL,
maxTokens: options.maxTokensToSample,
temperature: options.temperature,
topK: options.topK,