n8n-nodes-apexapi 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/nodes/ApexApi/ApexApi.node.js +82 -31
- package/dist/shared/video.js +16 -1
- package/package.json +1 -1
|
@@ -48,9 +48,14 @@ class ApexApi {
|
|
|
48
48
|
displayName: 'Model Name or ID',
|
|
49
49
|
name: 'model',
|
|
50
50
|
type: 'options',
|
|
51
|
-
description: 'Choose from the list of ApexApi
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
description: 'Choose from the list of ApexApi models for the selected resource. The list refreshes when you change Resource. You can also set an ID via an expression.',
|
|
52
|
+
// ONE model field for every resource. loadOptionsDependsOn: ['resource'] makes
|
|
53
|
+
// n8n reload the list (instead of reusing a stale cache) whenever Resource changes.
|
|
54
|
+
typeOptions: { loadOptionsMethod: 'getModels', loadOptionsDependsOn: ['resource'] },
|
|
55
|
+
displayOptions: {
|
|
56
|
+
show: { resource: ['chat', 'image', 'video'] },
|
|
57
|
+
hide: { operation: ['getResult'] },
|
|
58
|
+
},
|
|
54
59
|
default: '',
|
|
55
60
|
required: true,
|
|
56
61
|
},
|
|
@@ -92,16 +97,6 @@ class ApexApi {
|
|
|
92
97
|
options: [{ name: 'Generate Image', value: 'generate', action: 'Generate an image' }],
|
|
93
98
|
default: 'generate',
|
|
94
99
|
},
|
|
95
|
-
{
|
|
96
|
-
displayName: 'Model Name or ID',
|
|
97
|
-
name: 'model',
|
|
98
|
-
type: 'options',
|
|
99
|
-
description: 'Choose from the list of ApexApi image models. Choose from the list, or specify an ID using an expression.',
|
|
100
|
-
typeOptions: { loadOptionsMethod: 'getImageModels' },
|
|
101
|
-
displayOptions: { show: { resource: ['image'] } },
|
|
102
|
-
default: '',
|
|
103
|
-
required: true,
|
|
104
|
-
},
|
|
105
100
|
{
|
|
106
101
|
displayName: 'Prompt',
|
|
107
102
|
name: 'prompt',
|
|
@@ -157,16 +152,6 @@ class ApexApi {
|
|
|
157
152
|
],
|
|
158
153
|
default: 'generate',
|
|
159
154
|
},
|
|
160
|
-
{
|
|
161
|
-
displayName: 'Model Name or ID',
|
|
162
|
-
name: 'model',
|
|
163
|
-
type: 'options',
|
|
164
|
-
description: 'Choose from the list of ApexApi video models. Choose from the list, or specify an ID using an expression.',
|
|
165
|
-
typeOptions: { loadOptionsMethod: 'getVideoModels' },
|
|
166
|
-
displayOptions: { show: { resource: ['video'], operation: ['generate'] } },
|
|
167
|
-
default: '',
|
|
168
|
-
required: true,
|
|
169
|
-
},
|
|
170
155
|
{
|
|
171
156
|
displayName: 'Prompt',
|
|
172
157
|
name: 'prompt',
|
|
@@ -176,6 +161,44 @@ class ApexApi {
|
|
|
176
161
|
default: '',
|
|
177
162
|
required: true,
|
|
178
163
|
},
|
|
164
|
+
{
|
|
165
|
+
displayName: 'Aspect Ratio',
|
|
166
|
+
name: 'videoAspectRatio',
|
|
167
|
+
type: 'options',
|
|
168
|
+
displayOptions: { show: { resource: ['video'], operation: ['generate'] } },
|
|
169
|
+
options: [
|
|
170
|
+
{ name: 'Landscape 16:9', value: '16:9' },
|
|
171
|
+
{ name: 'Portrait 9:16', value: '9:16' },
|
|
172
|
+
{ name: 'Square 1:1', value: '1:1' },
|
|
173
|
+
{ name: 'Landscape 4:3', value: '4:3' },
|
|
174
|
+
{ name: 'Portrait 3:4', value: '3:4' },
|
|
175
|
+
{ name: 'Cinematic 21:9', value: '21:9' },
|
|
176
|
+
],
|
|
177
|
+
default: '16:9',
|
|
178
|
+
description: 'Output aspect ratio. The API validates support per model.',
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
displayName: 'Resolution',
|
|
182
|
+
name: 'videoResolution',
|
|
183
|
+
type: 'options',
|
|
184
|
+
displayOptions: { show: { resource: ['video'], operation: ['generate'] } },
|
|
185
|
+
options: [
|
|
186
|
+
{ name: '480p', value: '480p' },
|
|
187
|
+
{ name: '720p', value: '720p' },
|
|
188
|
+
{ name: '1080p', value: '1080p' },
|
|
189
|
+
],
|
|
190
|
+
default: '720p',
|
|
191
|
+
description: 'Output resolution. Higher resolutions depend on the model (e.g. Seedance Fast tops out at 720p) — the API returns a clear error if unsupported.',
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
displayName: 'Duration (Seconds)',
|
|
195
|
+
name: 'videoDuration',
|
|
196
|
+
type: 'number',
|
|
197
|
+
typeOptions: { minValue: 1, maxValue: 60 },
|
|
198
|
+
displayOptions: { show: { resource: ['video'], operation: ['generate'] } },
|
|
199
|
+
default: 5,
|
|
200
|
+
description: 'Clip length in seconds. Supported values depend on the model (commonly 5 or 10) — the API validates.',
|
|
201
|
+
},
|
|
179
202
|
{
|
|
180
203
|
displayName: 'Job ID',
|
|
181
204
|
name: 'jobId',
|
|
@@ -193,6 +216,28 @@ class ApexApi {
|
|
|
193
216
|
displayOptions: { show: { resource: ['video'], operation: ['generate'] } },
|
|
194
217
|
default: {},
|
|
195
218
|
options: [
|
|
219
|
+
{
|
|
220
|
+
displayName: 'Reference Image URL',
|
|
221
|
+
name: 'imageUrl',
|
|
222
|
+
type: 'string',
|
|
223
|
+
default: '',
|
|
224
|
+
description: 'Starting/reference image for image-to-video models (e.g. Seedance image-to-video).',
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
displayName: 'End Image URL',
|
|
228
|
+
name: 'endImageUrl',
|
|
229
|
+
type: 'string',
|
|
230
|
+
default: '',
|
|
231
|
+
description: 'Last-frame image (supported by fal Seedance end-frame models).',
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
displayName: 'Reference Video URL',
|
|
235
|
+
name: 'videoUrl',
|
|
236
|
+
type: 'string',
|
|
237
|
+
default: '',
|
|
238
|
+
description: 'Reference video for reference-to-video models.',
|
|
239
|
+
},
|
|
240
|
+
{ displayName: 'Generate Audio', name: 'audio', type: 'boolean', default: false },
|
|
196
241
|
{ displayName: 'Wait for Completion', name: 'waitForCompletion', type: 'boolean', default: true },
|
|
197
242
|
{ displayName: 'Max Poll Seconds', name: 'maxPollSeconds', type: 'number', default: 300 },
|
|
198
243
|
{ displayName: 'Poll Interval Seconds', name: 'pollIntervalSeconds', type: 'number', default: 5 },
|
|
@@ -202,14 +247,13 @@ class ApexApi {
|
|
|
202
247
|
};
|
|
203
248
|
this.methods = {
|
|
204
249
|
loadOptions: {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
async
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
return (0, loadOptions_1.loadModels)(this, 'video');
|
|
250
|
+
// ONE method for every resource: read the currently-selected resource and load
|
|
251
|
+
// the matching model list. Paired with loadOptionsDependsOn: ['resource'] on the
|
|
252
|
+
// model field so the dropdown refreshes the instant Resource changes.
|
|
253
|
+
async getModels() {
|
|
254
|
+
const resource = this.getCurrentNodeParameter('resource');
|
|
255
|
+
const modelType = resource === 'image' ? 'image' : resource === 'video' ? 'video' : 'chat';
|
|
256
|
+
return (0, loadOptions_1.loadModels)(this, modelType);
|
|
213
257
|
},
|
|
214
258
|
},
|
|
215
259
|
};
|
|
@@ -277,6 +321,13 @@ class ApexApi {
|
|
|
277
321
|
const body = (0, video_1.buildVideoBody)({
|
|
278
322
|
model: this.getNodeParameter('model', i),
|
|
279
323
|
prompt: this.getNodeParameter('prompt', i),
|
|
324
|
+
aspectRatio: this.getNodeParameter('videoAspectRatio', i, ''),
|
|
325
|
+
resolution: this.getNodeParameter('videoResolution', i, ''),
|
|
326
|
+
duration: this.getNodeParameter('videoDuration', i, 5),
|
|
327
|
+
audio: options.audio,
|
|
328
|
+
imageUrl: options.imageUrl || undefined,
|
|
329
|
+
endImageUrl: options.endImageUrl || undefined,
|
|
330
|
+
videoUrl: options.videoUrl || undefined,
|
|
280
331
|
});
|
|
281
332
|
json = (await (0, transport_1.generateVideo)(ctx, body, {
|
|
282
333
|
waitForCompletion: options.waitForCompletion ?? true,
|
package/dist/shared/video.js
CHANGED
|
@@ -3,7 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.buildVideoBody = buildVideoBody;
|
|
4
4
|
exports.isTerminalVideoStatus = isTerminalVideoStatus;
|
|
5
5
|
function buildVideoBody(params) {
|
|
6
|
-
|
|
6
|
+
const body = { model: params.model, prompt: params.prompt };
|
|
7
|
+
if (params.aspectRatio)
|
|
8
|
+
body.aspect_ratio = params.aspectRatio;
|
|
9
|
+
if (params.resolution)
|
|
10
|
+
body.resolution = params.resolution;
|
|
11
|
+
if (params.duration !== undefined)
|
|
12
|
+
body.duration = params.duration;
|
|
13
|
+
if (params.audio !== undefined)
|
|
14
|
+
body.audio = params.audio;
|
|
15
|
+
if (params.imageUrl)
|
|
16
|
+
body.image_url = params.imageUrl;
|
|
17
|
+
if (params.endImageUrl)
|
|
18
|
+
body.end_image_url = params.endImageUrl;
|
|
19
|
+
if (params.videoUrl)
|
|
20
|
+
body.video_url = params.videoUrl;
|
|
21
|
+
return body;
|
|
7
22
|
}
|
|
8
23
|
const TERMINAL_STATUSES = new Set(['completed', 'failed']);
|
|
9
24
|
function isTerminalVideoStatus(status) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-apexapi",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "n8n community node for ApexApi — call 14 AI providers (OpenAI, Anthropic, Google, Mistral, and more) through one OpenAI-compatible API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n-community-node-package",
|