@wiro-ai/n8n-nodes-wiroai
Version:
n8n community node for Wiro AI — 290+ AI models: video, image, audio, LLM, 3D, and more.
168 lines • 6.93 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Gpt5Mini = void 0;
const n8n_workflow_1 = require("n8n-workflow");
const auth_1 = require("../utils/auth");
const polling_1 = require("../utils/polling");
class Gpt5Mini {
constructor() {
this.description = {
displayName: 'Wiro - GPT-5 Mini AI Model',
name: 'gpt5Mini',
icon: { light: 'file:wiro.svg', dark: 'file:wiro.svg' },
group: ['transform'],
version: 1,
description: 'Access GPT-5 Mini API by OpenAI on Wiro. Simple integration, transparent pricing, and comprehen',
defaults: {
name: 'Wiro - GPT-5 Mini AI Model',
},
inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
usableAsTool: true,
credentials: [
{
name: 'wiroApi',
required: true,
},
],
properties: [
{
displayName: 'Input Image URL',
name: 'inputImageUrl',
type: 'string',
default: '',
description: 'Optional. Multiple image files separated by semicolon. GPT-5.2 only supports images',
},
{
displayName: 'Prompt',
name: 'prompt',
type: 'string',
default: '',
required: true,
description: 'Required',
},
{
displayName: 'User ID',
name: 'user_id',
type: 'string',
default: '',
description: 'Required for chat history. Numeric or string ID.',
},
{
displayName: 'Session ID',
name: 'session_id',
type: 'string',
default: '',
description: 'Required for chat history. Numeric or string ID.',
},
{
displayName: 'System Instructions',
name: 'systemInstructions',
type: 'string',
default: '',
description: 'Optional. System-level instructions for the model.',
},
{
displayName: 'Reasoning Effort',
name: 'reasoning',
type: 'options',
default: 'high',
description: 'Optional. Controls reasoning effort level. If web search is enabled and reasoning set to default it will be fallback the low, web search can not be used with minimal reasoning',
options: [
{ name: 'High', value: 'high' },
{ name: 'Low', value: 'low' },
{ name: 'Medium', value: 'medium' },
{ name: 'Minimal', value: 'minimal' },
],
},
{
displayName: 'Web Search',
name: 'webSearch',
type: 'options',
default: 'false',
description: 'Optional. Enable web search. The number of web searches is determined by the complexity of your prompt. $0.01 per search',
options: [
{ name: 'False', value: 'false' },
{ name: 'True', value: 'true' },
],
},
{
displayName: 'Verbosity',
name: 'verbosity',
type: 'options',
default: 'high',
description: 'Optional. Controls response verbosity level.',
options: [
{ name: 'High', value: 'high' },
{ name: 'Low', value: 'low' },
{ name: 'Medium', value: 'medium' },
],
},
],
};
}
async execute() {
const returnData = [];
const inputImageUrl = this.getNodeParameter('inputImageUrl', 0, '');
const prompt = this.getNodeParameter('prompt', 0);
const user_id = this.getNodeParameter('user_id', 0, '');
const session_id = this.getNodeParameter('session_id', 0, '');
const systemInstructions = this.getNodeParameter('systemInstructions', 0, '');
const reasoning = this.getNodeParameter('reasoning', 0, '');
const webSearch = this.getNodeParameter('webSearch', 0, '');
const verbosity = this.getNodeParameter('verbosity', 0, '');
const credentials = await this.getCredentials('wiroApi');
const apiKey = credentials.apiKey;
const apiSecret = credentials.apiSecret;
const headers = (0, auth_1.generateWiroAuthHeaders)(apiKey, apiSecret);
const response = await this.helpers.httpRequest({
method: 'POST',
url: 'https://api.wiro.ai/v1/Run/openai/gpt-5-mini',
headers: {
...headers,
'Content-Type': 'application/json',
},
body: {
inputImageUrl,
prompt,
user_id,
session_id,
systemInstructions,
reasoning,
webSearch,
verbosity,
},
});
if (!(response === null || response === void 0 ? void 0 : response.taskid) || !(response === null || response === void 0 ? void 0 : response.socketaccesstoken)) {
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
message: 'Wiro API did not return a valid task ID or socket access token ' +
JSON.stringify(response),
});
}
const taskid = response.taskid;
const socketaccesstoken = response.socketaccesstoken;
const result = await polling_1.pollTaskUntilComplete.call(this, socketaccesstoken, headers);
const responseJSON = {
taskid: taskid,
message: '',
status: '',
};
switch (result) {
case '-1':
case '-2':
case '-3':
case '-4':
responseJSON.status = 'failed';
break;
default:
responseJSON.status = 'completed';
responseJSON.message = result !== null && result !== void 0 ? result : '';
}
returnData.push({
json: responseJSON,
});
return [returnData];
}
}
exports.Gpt5Mini = Gpt5Mini;
//# sourceMappingURL=Gpt5Mini.node.js.map