feat: Add HTTP proxy for supported LLM nodes (#15449)

This commit is contained in:
oleg
2025-05-16 12:23:26 +02:00
committed by GitHub
parent 570d1e7aad
commit 907485d016
14 changed files with 173 additions and 30 deletions

View File

@@ -1,6 +1,8 @@
import type { ILoadOptionsFunctions, INodeListSearchResult } from 'n8n-workflow';
import OpenAI from 'openai';
import { getHttpProxyAgent } from '@utils/httpProxyAgent';
export async function searchModels(
this: ILoadOptionsFunctions,
filter?: string,
@@ -11,7 +13,11 @@ export async function searchModels(
(credentials.url as string) ||
'https://api.openai.com/v1';
const openai = new OpenAI({ baseURL, apiKey: credentials.apiKey as string });
const openai = new OpenAI({
baseURL,
apiKey: credentials.apiKey as string,
httpAgent: getHttpProxyAgent(),
});
const { data: models = [] } = await openai.models.list();
const filteredModels = models.filter((model: { id: string }) => {