feat(Ollama Credentials): Add optional API key support to Ollama credentials (Openwebui proxy) (#17857)

This commit is contained in:
Julian van der Horst
2025-08-05 17:25:19 +02:00
committed by GitHub
parent c4c46b8ff9
commit acfb79bd97
4 changed files with 43 additions and 2 deletions

View File

@@ -1,4 +1,9 @@
import type { ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
import type {
ICredentialTestRequest,
ICredentialType,
INodeProperties,
IAuthenticateGeneric,
} from 'n8n-workflow';
export class OllamaApi implements ICredentialType {
name = 'ollamaApi';
@@ -15,12 +20,30 @@ export class OllamaApi implements ICredentialType {
type: 'string',
default: 'http://localhost:11434',
},
{
displayName: 'API Key',
hint: 'When using Ollama behind a proxy with authentication (such as Open WebUI), provide the Bearer token/API key here. This is not required for the default Ollama installation',
name: 'apiKey',
type: 'string',
typeOptions: { password: true },
default: '',
required: false,
},
];
authenticate: IAuthenticateGeneric = {
type: 'generic',
properties: {
headers: {
Authorization: '=Bearer {{$credentials.apiKey}}',
},
},
};
test: ICredentialTestRequest = {
request: {
baseURL: '={{ $credentials.baseUrl }}',
url: '/',
url: '/api/tags',
method: 'GET',
},
};