51 lines
1.1 KiB
TypeScript
51 lines
1.1 KiB
TypeScript
import type {
|
|
IAuthenticateGeneric,
|
|
ICredentialTestRequest,
|
|
ICredentialType,
|
|
INodeProperties,
|
|
} from 'n8n-workflow';
|
|
|
|
export class TeamorouterApi implements ICredentialType {
|
|
name = 'teamorouterApi';
|
|
|
|
displayName = 'TeamoRouter API';
|
|
|
|
documentationUrl = 'https://api.teamorouter.com/docs/api-integration';
|
|
|
|
properties: INodeProperties[] = [
|
|
{
|
|
displayName: 'API Key',
|
|
name: 'apiKey',
|
|
type: 'string',
|
|
typeOptions: { password: true },
|
|
required: true,
|
|
default: '',
|
|
description: 'API key from the TeamoRouter dashboard. Starts with sk-teamo-',
|
|
},
|
|
{
|
|
displayName: 'Base URL',
|
|
name: 'baseUrl',
|
|
type: 'string',
|
|
required: true,
|
|
default: 'https://api.teamorouter.com/v1',
|
|
description: 'OpenAI-compatible base URL. Change it only for the .cn mirror or a self-hosted router',
|
|
},
|
|
];
|
|
|
|
authenticate: IAuthenticateGeneric = {
|
|
type: 'generic',
|
|
properties: {
|
|
headers: {
|
|
Authorization: '=Bearer {{$credentials.apiKey}}',
|
|
},
|
|
},
|
|
};
|
|
|
|
test: ICredentialTestRequest = {
|
|
request: {
|
|
baseURL: '={{ $credentials.baseUrl }}',
|
|
url: '/models',
|
|
method: 'GET',
|
|
},
|
|
};
|
|
}
|