n8n-nodes-haryai 0.2.0 → 0.3.0
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/README.md +16 -10
- package/README.zh-CN.md +16 -10
- package/dist/nodes/HaryAiImage/HaryAiImage.node.d.ts +5 -0
- package/dist/nodes/HaryAiImage/HaryAiImage.node.js +220 -0
- package/dist/nodes/HaryAiImage/HaryAiImage.node.json +10 -0
- package/dist/nodes/HaryAiImage/haryai.svg +1 -0
- package/dist/nodes/HaryAiSeedance/HaryAiSeedance.node.js +51 -8
- package/dist/nodes/HaryAiSeedance/HaryAiSeedance.node.json +1 -1
- package/dist/package.json +10 -6
- package/package.json +10 -6
package/README.md
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
# n8n-nodes-haryai: Seedance 2.5 in n8n
|
|
1
|
+
# n8n-nodes-haryai: Seedance 2.5, Seedream and Nano Banana in n8n
|
|
2
2
|
|
|
3
3
|
[中文](README.zh-CN.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
n8n community nodes for ByteDance's Seedance 2.5 video and for Seedream 5.5 and Nano Banana images, through [HaryAI](https://haryai.com/en/seedance-2-5-comfyui?utm_source=github&utm_medium=readme&utm_campaign=n8n-nodes-haryai). Seedance 2.5 costs 12% less than BytePlus's official price, Seedream 20% less and Nano Banana 50% less. No BytePlus or Google account needed.
|
|
6
6
|
|
|
7
7
|
The **HaryAI Seedance** node:
|
|
8
8
|
|
|
9
9
|
- **Generate Video**: submit a task, wait for it and return the video as binary data plus its URL
|
|
10
10
|
- **Submit Task** and **Get Task**: for long jobs, submit now and read the result later
|
|
11
|
-
- text to video, first and last frame, up to
|
|
11
|
+
- text to video, first and last frame, reference images (up to 30; Flash 10), reference videos and audio by URL, generated sound and spoken lines with lip sync
|
|
12
|
+
- usable as a tool by the n8n AI Agent
|
|
13
|
+
|
|
14
|
+
The **HaryAI Image** node:
|
|
15
|
+
|
|
16
|
+
- Seedream 5.5, Nano Banana 2.1 and Nano Banana 2: text to image, or follow or edit up to 14 reference images (URLs or data URIs)
|
|
17
|
+
- returns the images as binary data (`data`, `data_1`, …)
|
|
12
18
|
- usable as a tool by the n8n AI Agent
|
|
13
19
|
|
|
14
20
|
## Install
|
|
@@ -36,14 +42,14 @@ For image to video, add an image with role First Frame and an image URL (or a da
|
|
|
36
42
|
|
|
37
43
|
## Cost
|
|
38
44
|
|
|
39
|
-
|
|
45
|
+
From your HaryAI balance. Video per second: Seedance 2.5 at 720p $0.203, Seedance 2.5 Flash at 480p $0.059. Images: Seedream 5.5 1K $0.016, Nano Banana 2.1 1K $0.0168. A failed or moderated request is not charged. All prices: [pricing](https://haryai.com/en/pricing?utm_source=github&utm_medium=readme&utm_campaign=n8n-nodes-haryai).
|
|
40
46
|
|
|
41
47
|
## Related
|
|
42
48
|
|
|
43
|
-
- [seedance-2.5-api](https://github.com/
|
|
44
|
-
- [seedance-comfyui](https://github.com/
|
|
45
|
-
- [seedance-skill](https://github.com/
|
|
46
|
-
- [nano-banana-api](https://github.com/
|
|
47
|
-
- API reference: [docs/video.md](https://haryai.com/docs/video.md)
|
|
49
|
+
- [seedance-2.5-api](https://github.com/haryai-com/seedance-2.5-api): the API, curl examples, Q&A
|
|
50
|
+
- [seedance-comfyui](https://github.com/haryai-com/seedance-comfyui): the same in ComfyUI
|
|
51
|
+
- [seedance-skill](https://github.com/haryai-com/seedance-skill): Seedance 2.5 as a Claude Code and Codex skill
|
|
52
|
+
- [nano-banana-api](https://github.com/haryai-com/nano-banana-api): Nano Banana 2.1 and 2 through the OpenAI images API or Gemini's own format
|
|
53
|
+
- API reference: [docs/video.md](https://haryai.com/docs/video.md), [docs/image.md](https://haryai.com/docs/image.md)
|
|
48
54
|
|
|
49
|
-
MIT. Prices as of 2026-11-
|
|
55
|
+
MIT. Prices as of 2026-11-27.
|
package/README.zh-CN.md
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
# n8n-nodes-haryai:在 n8n 里用 Seedance 2.5
|
|
1
|
+
# n8n-nodes-haryai:在 n8n 里用 Seedance 2.5、Seedream 和 Nano Banana
|
|
2
2
|
|
|
3
3
|
[English](README.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
n8n 社区节点,通过 [HaryAI](https://haryai.com/zh/seedance-2-5-comfyui?utm_source=github&utm_medium=readme&utm_campaign=n8n-nodes-haryai) 调用字节的视频模型 Seedance 2.5,以及图片模型 Seedream 5.5 和 Nano Banana。Seedance 2.5 是 BytePlus 官方价 88 折,Seedream 8 折,Nano Banana 5 折。不用开 BytePlus 或 Google 账号。
|
|
6
6
|
|
|
7
7
|
节点名叫 **HaryAI Seedance**:
|
|
8
8
|
|
|
9
9
|
- **Generate Video**:提交任务,等它完成,把视频作为二进制数据连同地址一起输出
|
|
10
10
|
- **Submit Task** 和 **Get Task**:时间长的任务可以先提交,之后再取结果
|
|
11
|
-
-
|
|
11
|
+
- 支持文生视频、首帧和尾帧、参考图(最多 30 张,Flash 10 张)、用链接给参考视频和参考音频、生成声音以及台词配音对口型
|
|
12
|
+
- n8n 的 AI Agent 可以把它当工具调用
|
|
13
|
+
|
|
14
|
+
节点 **HaryAI Image**:
|
|
15
|
+
|
|
16
|
+
- Seedream 5.5、Nano Banana 2.1 和 Nano Banana 2:文生图,也可以照着最多 14 张参考图画或者改图(填链接或 data URI)
|
|
17
|
+
- 图片作为二进制数据输出(`data`、`data_1`……)
|
|
12
18
|
- n8n 的 AI Agent 可以把它当工具调用
|
|
13
19
|
|
|
14
20
|
## 安装
|
|
@@ -36,14 +42,14 @@ Manual Trigger 接 HaryAI Seedance,选 Generate Video:
|
|
|
36
42
|
|
|
37
43
|
## 费用
|
|
38
44
|
|
|
39
|
-
|
|
45
|
+
从 HaryAI 余额扣费。视频按秒:Seedance 2.5 720p 每秒 $0.203,Seedance 2.5 Flash 480p 每秒 $0.059。图片:Seedream 5.5 1K 每张 $0.016,Nano Banana 2.1 1K 每张 $0.0168。失败或审核没过的请求不扣费。全部价格见 [价格页](https://haryai.com/zh/pricing?utm_source=github&utm_medium=readme&utm_campaign=n8n-nodes-haryai)。
|
|
40
46
|
|
|
41
47
|
## 相关
|
|
42
48
|
|
|
43
|
-
- [seedance-2.5-api](https://github.com/
|
|
44
|
-
- [seedance-comfyui](https://github.com/
|
|
45
|
-
- [seedance-skill](https://github.com/
|
|
46
|
-
- [nano-banana-api](https://github.com/
|
|
47
|
-
- 接口文档:[docs/video.md](https://haryai.com/docs/video.md)
|
|
49
|
+
- [seedance-2.5-api](https://github.com/haryai-com/seedance-2.5-api):接口本身、curl 示例和常见问题
|
|
50
|
+
- [seedance-comfyui](https://github.com/haryai-com/seedance-comfyui):在 ComfyUI 里用
|
|
51
|
+
- [seedance-skill](https://github.com/haryai-com/seedance-skill):Claude Code 和 Codex 用的 Seedance 2.5 skill
|
|
52
|
+
- [nano-banana-api](https://github.com/haryai-com/nano-banana-api):用 OpenAI 图片接口或 Gemini 原生格式调 Nano Banana 2.1 和 2
|
|
53
|
+
- 接口文档:[docs/video.md](https://haryai.com/docs/video.md)、[docs/image.md](https://haryai.com/docs/image.md)
|
|
48
54
|
|
|
49
|
-
MIT 许可。价格截至 2026-11-
|
|
55
|
+
MIT 许可。价格截至 2026-11-27。
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class HaryAiImage implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HaryAiImage = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const MODELS = {
|
|
6
|
+
seedream: 'dola-seedream-5-5-261028',
|
|
7
|
+
nanoBanana21: 'gemini-nano-banana-2.1',
|
|
8
|
+
nanoBanana2: 'gemini-3.1-flash-image',
|
|
9
|
+
};
|
|
10
|
+
const SIZES = {
|
|
11
|
+
seedream: ['1K', '1.5K', '2K'],
|
|
12
|
+
nanoBanana21: ['1K', '2K', '4K'],
|
|
13
|
+
nanoBanana2: ['1K', '2K', '4K'],
|
|
14
|
+
};
|
|
15
|
+
const SEEDREAM_PIXELS = { '1K': 1024 * 1024, '1.5K': 2330000, '2K': 2048 * 2048 };
|
|
16
|
+
function seedreamSize(ratio, size) {
|
|
17
|
+
const [rw, rh] = ratio.split(':').map(Number);
|
|
18
|
+
const w = Math.sqrt((SEEDREAM_PIXELS[size] * rw) / rh);
|
|
19
|
+
const r16 = (x) => Math.max(16, Math.floor(x / 16) * 16);
|
|
20
|
+
return `${r16(w)}x${r16((w * rh) / rw)}`;
|
|
21
|
+
}
|
|
22
|
+
function mimeOf(data) {
|
|
23
|
+
if (data[0] === 0x89 && data[1] === 0x50)
|
|
24
|
+
return 'image/png';
|
|
25
|
+
if (data[0] === 0xff && data[1] === 0xd8)
|
|
26
|
+
return 'image/jpeg';
|
|
27
|
+
return 'image/webp';
|
|
28
|
+
}
|
|
29
|
+
async function referenceBytes(url) {
|
|
30
|
+
if (url.startsWith('data:'))
|
|
31
|
+
return Buffer.from(url.slice(url.indexOf(',') + 1), 'base64');
|
|
32
|
+
return Buffer.from((await this.helpers.httpRequest({ method: 'GET', url, encoding: 'arraybuffer' })));
|
|
33
|
+
}
|
|
34
|
+
class HaryAiImage {
|
|
35
|
+
constructor() {
|
|
36
|
+
this.description = {
|
|
37
|
+
displayName: 'HaryAI Image',
|
|
38
|
+
name: 'haryAiImage',
|
|
39
|
+
icon: { light: 'file:haryai.svg', dark: 'file:haryai.svg' },
|
|
40
|
+
group: ['transform'],
|
|
41
|
+
version: 1,
|
|
42
|
+
subtitle: '={{$parameter["model"]}}',
|
|
43
|
+
description: 'Make and edit images with Seedream 5.5 and Nano Banana through HaryAI',
|
|
44
|
+
defaults: { name: 'HaryAI Image' },
|
|
45
|
+
inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
46
|
+
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
47
|
+
usableAsTool: true,
|
|
48
|
+
credentials: [{ name: 'haryAiApi', required: true }],
|
|
49
|
+
properties: [
|
|
50
|
+
{
|
|
51
|
+
displayName: 'Operation',
|
|
52
|
+
name: 'operation',
|
|
53
|
+
type: 'options',
|
|
54
|
+
noDataExpression: true,
|
|
55
|
+
options: [
|
|
56
|
+
{
|
|
57
|
+
name: 'Generate Image',
|
|
58
|
+
value: 'generate',
|
|
59
|
+
action: 'Generate an image',
|
|
60
|
+
description: 'Make images from a prompt, optionally following or editing reference images',
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
default: 'generate',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
displayName: 'Prompt',
|
|
67
|
+
name: 'prompt',
|
|
68
|
+
type: 'string',
|
|
69
|
+
typeOptions: { rows: 4 },
|
|
70
|
+
required: true,
|
|
71
|
+
default: '',
|
|
72
|
+
description: 'What to draw, or what to change in the reference images. Refer to them as Image 1, Image 2.',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
displayName: 'Model',
|
|
76
|
+
name: 'model',
|
|
77
|
+
type: 'options',
|
|
78
|
+
options: [
|
|
79
|
+
{ name: 'Seedream 5.5', value: 'seedream' },
|
|
80
|
+
{ name: 'Nano Banana 2.1', value: 'nanoBanana21' },
|
|
81
|
+
{ name: 'Nano Banana 2', value: 'nanoBanana2' },
|
|
82
|
+
],
|
|
83
|
+
default: 'seedream',
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
displayName: 'Size',
|
|
87
|
+
name: 'size',
|
|
88
|
+
type: 'options',
|
|
89
|
+
options: ['1K', '1.5K', '2K', '4K'].map((s) => ({ name: s, value: s })),
|
|
90
|
+
default: '1K',
|
|
91
|
+
description: 'Seedream: 1K, 1.5K, 2K. Nano Banana: 1K, 2K, 4K.',
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
displayName: 'Aspect Ratio',
|
|
95
|
+
name: 'ratio',
|
|
96
|
+
type: 'options',
|
|
97
|
+
options: ['1:1', '3:4', '4:3', '9:16', '16:9', '2:3', '3:2', '21:9'].map((r) => ({ name: r, value: r })),
|
|
98
|
+
default: '1:1',
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
displayName: 'Number of Images',
|
|
102
|
+
name: 'count',
|
|
103
|
+
type: 'number',
|
|
104
|
+
typeOptions: { minValue: 1, maxValue: 4 },
|
|
105
|
+
default: 1,
|
|
106
|
+
description: 'Seedream only; Nano Banana makes one image',
|
|
107
|
+
displayOptions: { show: { model: ['seedream'] } },
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
displayName: 'Reference Images',
|
|
111
|
+
name: 'images',
|
|
112
|
+
type: 'fixedCollection',
|
|
113
|
+
typeOptions: { multipleValues: true },
|
|
114
|
+
placeholder: 'Add Image',
|
|
115
|
+
default: {},
|
|
116
|
+
description: 'Image URLs or data URIs to follow or edit, up to 14. Each is billed for Seedream.',
|
|
117
|
+
options: [
|
|
118
|
+
{
|
|
119
|
+
name: 'image',
|
|
120
|
+
displayName: 'Image',
|
|
121
|
+
values: [{ displayName: 'URL', name: 'url', type: 'string', default: '' }],
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
async execute() {
|
|
129
|
+
var _a, _b, _c;
|
|
130
|
+
const items = this.getInputData();
|
|
131
|
+
const out = [];
|
|
132
|
+
for (let i = 0; i < items.length; i++) {
|
|
133
|
+
try {
|
|
134
|
+
const credentials = await this.getCredentials('haryAiApi');
|
|
135
|
+
const origin = new URL(credentials.baseUrl || 'https://api.haryai.com').origin;
|
|
136
|
+
const prompt = this.getNodeParameter('prompt', i);
|
|
137
|
+
const model = this.getNodeParameter('model', i);
|
|
138
|
+
const size = this.getNodeParameter('size', i);
|
|
139
|
+
const ratio = this.getNodeParameter('ratio', i);
|
|
140
|
+
if (!SIZES[model].includes(size)) {
|
|
141
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `This model has ${SIZES[model].join(', ')} only`, { itemIndex: i });
|
|
142
|
+
}
|
|
143
|
+
const refs = ((_a = this.getNodeParameter('images', i, {}).image) !== null && _a !== void 0 ? _a : [])
|
|
144
|
+
.map((im) => { var _a; return (_a = im.url) === null || _a === void 0 ? void 0 : _a.trim(); })
|
|
145
|
+
.filter(Boolean);
|
|
146
|
+
if (refs.length > 14)
|
|
147
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'At most 14 reference images', { itemIndex: i });
|
|
148
|
+
let reply;
|
|
149
|
+
if (model === 'seedream') {
|
|
150
|
+
reply = (await this.helpers.httpRequestWithAuthentication.call(this, 'haryAiApi', {
|
|
151
|
+
method: 'POST',
|
|
152
|
+
url: `${origin}/v1/images/generations`,
|
|
153
|
+
json: true,
|
|
154
|
+
body: {
|
|
155
|
+
model: MODELS.seedream,
|
|
156
|
+
prompt,
|
|
157
|
+
n: this.getNodeParameter('count', i, 1),
|
|
158
|
+
size: seedreamSize(ratio, size),
|
|
159
|
+
response_format: 'b64_json',
|
|
160
|
+
watermark: false,
|
|
161
|
+
...(refs.length ? { image: refs } : {}),
|
|
162
|
+
},
|
|
163
|
+
}));
|
|
164
|
+
}
|
|
165
|
+
else if (refs.length) {
|
|
166
|
+
const boundary = `haryai${Date.now().toString(16)}`;
|
|
167
|
+
const parts = [];
|
|
168
|
+
const field = (name, value) => parts.push(Buffer.from(`--${boundary}\r\nContent-Disposition: form-data; name="${name}"\r\n\r\n${value}\r\n`));
|
|
169
|
+
field('model', MODELS[model]);
|
|
170
|
+
field('prompt', prompt);
|
|
171
|
+
field('aspect_ratio', ratio);
|
|
172
|
+
field('image_size', size);
|
|
173
|
+
for (const [k, url] of refs.entries()) {
|
|
174
|
+
const data = await referenceBytes.call(this, url);
|
|
175
|
+
parts.push(Buffer.from(`--${boundary}\r\nContent-Disposition: form-data; name="image"; filename="ref-${k}"\r\nContent-Type: ${mimeOf(data)}\r\n\r\n`));
|
|
176
|
+
parts.push(data, Buffer.from('\r\n'));
|
|
177
|
+
}
|
|
178
|
+
parts.push(Buffer.from(`--${boundary}--\r\n`));
|
|
179
|
+
const raw = await this.helpers.httpRequestWithAuthentication.call(this, 'haryAiApi', {
|
|
180
|
+
method: 'POST',
|
|
181
|
+
url: `${origin}/v1/images/edits`,
|
|
182
|
+
headers: { 'Content-Type': `multipart/form-data; boundary=${boundary}` },
|
|
183
|
+
body: Buffer.concat(parts),
|
|
184
|
+
});
|
|
185
|
+
reply = (typeof raw === 'string' ? JSON.parse(raw) : raw);
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
reply = (await this.helpers.httpRequestWithAuthentication.call(this, 'haryAiApi', {
|
|
189
|
+
method: 'POST',
|
|
190
|
+
url: `${origin}/v1/images/generations`,
|
|
191
|
+
json: true,
|
|
192
|
+
body: { model: MODELS[model], prompt, aspect_ratio: ratio, image_size: size },
|
|
193
|
+
}));
|
|
194
|
+
}
|
|
195
|
+
const data = ((_b = reply.data) !== null && _b !== void 0 ? _b : []);
|
|
196
|
+
if (!data.length)
|
|
197
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `No image in the reply: ${JSON.stringify(reply)}`, { itemIndex: i });
|
|
198
|
+
const item = { json: { model: MODELS[model], images: data.length, usage: (_c = reply.usage) !== null && _c !== void 0 ? _c : null }, binary: {}, pairedItem: i };
|
|
199
|
+
for (const [k, d] of data.entries()) {
|
|
200
|
+
const bytes = Buffer.from(d.b64_json, 'base64');
|
|
201
|
+
const mime = mimeOf(bytes);
|
|
202
|
+
item.binary[k === 0 ? 'data' : `data_${k}`] = await this.helpers.prepareBinaryData(bytes, `image-${k + 1}.${mime.split('/')[1]}`, mime);
|
|
203
|
+
}
|
|
204
|
+
out.push(item);
|
|
205
|
+
}
|
|
206
|
+
catch (error) {
|
|
207
|
+
if (this.continueOnFail()) {
|
|
208
|
+
out.push({ json: { error: error.message }, pairedItem: i });
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
if (error instanceof n8n_workflow_1.NodeOperationError)
|
|
212
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, { itemIndex: i });
|
|
213
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), error, { itemIndex: i });
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return [out];
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
exports.HaryAiImage = HaryAiImage;
|
|
220
|
+
//# sourceMappingURL=HaryAiImage.node.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"node": "n8n-nodes-haryai.haryAiImage",
|
|
3
|
+
"nodeVersion": "1.0",
|
|
4
|
+
"codexVersion": "1.0",
|
|
5
|
+
"categories": ["Marketing & Content"],
|
|
6
|
+
"resources": {
|
|
7
|
+
"credentialDocumentation": [{ "url": "https://haryai.com/docs/image.md" }],
|
|
8
|
+
"primaryDocumentation": [{ "url": "https://github.com/haryai-com/n8n-nodes-haryai" }]
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><rect width="100" height="100" rx="24" fill="#ee4d0d"/><g fill="none" stroke="#fff" stroke-width="14" stroke-linecap="round" stroke-linejoin="round"><path d="M27 20V80M73 20V80"/><path d="M27 80C27 50 73 50 73 80"/></g></svg>
|
|
@@ -8,6 +8,7 @@ const MODELS = {
|
|
|
8
8
|
fullUnlock: 'dreamina-seedance-2-5-260628-unlock',
|
|
9
9
|
flashUnlock: 'dreamina-seedance-2-5-flash-261115-unlock',
|
|
10
10
|
};
|
|
11
|
+
const LIMITS = { full: [30, 10, 10], flash: [10, 5, 5] };
|
|
11
12
|
async function api(method, path, body) {
|
|
12
13
|
const credentials = await this.getCredentials('haryAiApi');
|
|
13
14
|
const baseURL = (credentials.baseUrl || 'https://api.haryai.com/api/v3').replace(/\/$/, '');
|
|
@@ -136,7 +137,7 @@ class HaryAiSeedance {
|
|
|
136
137
|
typeOptions: { multipleValues: true },
|
|
137
138
|
placeholder: 'Add Image',
|
|
138
139
|
default: {},
|
|
139
|
-
description: 'Image URLs or data URIs. Use a first frame (and optionally a last frame), or up to
|
|
140
|
+
description: 'Image URLs or data URIs. Use a first frame (and optionally a last frame), or reference images (up to 30; Flash 10), not both.',
|
|
140
141
|
displayOptions: { show: { operation: ['generate', 'submit'] } },
|
|
141
142
|
options: [
|
|
142
143
|
{
|
|
@@ -164,6 +165,40 @@ class HaryAiSeedance {
|
|
|
164
165
|
},
|
|
165
166
|
],
|
|
166
167
|
},
|
|
168
|
+
{
|
|
169
|
+
displayName: 'Reference Videos and Audio',
|
|
170
|
+
name: 'media',
|
|
171
|
+
type: 'fixedCollection',
|
|
172
|
+
typeOptions: { multipleValues: true },
|
|
173
|
+
placeholder: 'Add Video or Audio',
|
|
174
|
+
default: {},
|
|
175
|
+
description: 'Public URLs. Videos (mp4 or mov, 480p or more) and audio (mp3 or wav) run 2 to 30 s each, videos 30 s together. Up to 10 of each (Flash 5). Not together with a first or last frame.',
|
|
176
|
+
displayOptions: { show: { operation: ['generate', 'submit'] } },
|
|
177
|
+
options: [
|
|
178
|
+
{
|
|
179
|
+
name: 'item',
|
|
180
|
+
displayName: 'Item',
|
|
181
|
+
values: [
|
|
182
|
+
{
|
|
183
|
+
displayName: 'URL',
|
|
184
|
+
name: 'url',
|
|
185
|
+
type: 'string',
|
|
186
|
+
default: '',
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
displayName: 'Type',
|
|
190
|
+
name: 'type',
|
|
191
|
+
type: 'options',
|
|
192
|
+
options: [
|
|
193
|
+
{ name: 'Video', value: 'video' },
|
|
194
|
+
{ name: 'Audio', value: 'audio' },
|
|
195
|
+
],
|
|
196
|
+
default: 'video',
|
|
197
|
+
},
|
|
198
|
+
],
|
|
199
|
+
},
|
|
200
|
+
],
|
|
201
|
+
},
|
|
167
202
|
{
|
|
168
203
|
displayName: 'Download Video',
|
|
169
204
|
name: 'download',
|
|
@@ -185,7 +220,7 @@ class HaryAiSeedance {
|
|
|
185
220
|
};
|
|
186
221
|
}
|
|
187
222
|
async execute() {
|
|
188
|
-
var _a;
|
|
223
|
+
var _a, _b;
|
|
189
224
|
const items = this.getInputData();
|
|
190
225
|
const out = [];
|
|
191
226
|
for (let i = 0; i < items.length; i++) {
|
|
@@ -201,18 +236,26 @@ class HaryAiSeedance {
|
|
|
201
236
|
if ((model === 'flash' || model === 'flashUnlock') && resolution === '1080p') {
|
|
202
237
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Seedance 2.5 Flash has 480p and 720p only', { itemIndex: i });
|
|
203
238
|
}
|
|
204
|
-
const images = ((_a = this.getNodeParameter('images', i, {}).image) !== null && _a !== void 0 ? _a : []);
|
|
239
|
+
const images = ((_a = this.getNodeParameter('images', i, {}).image) !== null && _a !== void 0 ? _a : []).filter((im) => im.url);
|
|
240
|
+
const media = ((_b = this.getNodeParameter('media', i, {}).item) !== null && _b !== void 0 ? _b : []).filter((m) => m.url);
|
|
205
241
|
const roles = images.map((im) => im.role);
|
|
206
|
-
|
|
207
|
-
|
|
242
|
+
const frames = roles.some((r) => r !== 'reference_image');
|
|
243
|
+
if (frames && (roles.includes('reference_image') || media.length)) {
|
|
244
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Use a first/last frame, or reference images, videos and audio, not both', { itemIndex: i });
|
|
245
|
+
}
|
|
246
|
+
const [maxImages, maxVideos, maxAudio] = LIMITS[model === 'flash' || model === 'flashUnlock' ? 'flash' : 'full'];
|
|
247
|
+
const videos = media.filter((m) => m.type === 'video');
|
|
248
|
+
const audio = media.filter((m) => m.type === 'audio');
|
|
249
|
+
if (images.length > (frames ? 2 : maxImages) || videos.length > maxVideos || audio.length > maxAudio) {
|
|
250
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `This model takes up to ${maxImages} reference images, ${maxVideos} videos and ${maxAudio} audio clips (or a first and last frame)`, { itemIndex: i });
|
|
208
251
|
}
|
|
209
252
|
const body = {
|
|
210
253
|
model: MODELS[model],
|
|
211
254
|
content: [
|
|
212
255
|
{ type: 'text', text: this.getNodeParameter('prompt', i) },
|
|
213
|
-
...images
|
|
214
|
-
|
|
215
|
-
|
|
256
|
+
...images.map((im) => ({ type: 'image_url', image_url: { url: im.url }, role: im.role })),
|
|
257
|
+
...videos.map((m) => ({ type: 'video_url', video_url: { url: m.url }, role: 'reference_video' })),
|
|
258
|
+
...audio.map((m) => ({ type: 'audio_url', audio_url: { url: m.url }, role: 'reference_audio' })),
|
|
216
259
|
],
|
|
217
260
|
duration: this.getNodeParameter('duration', i),
|
|
218
261
|
resolution,
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"categories": ["Marketing & Content"],
|
|
6
6
|
"resources": {
|
|
7
7
|
"credentialDocumentation": [{ "url": "https://haryai.com/docs/video.md" }],
|
|
8
|
-
"primaryDocumentation": [{ "url": "https://github.com/
|
|
8
|
+
"primaryDocumentation": [{ "url": "https://github.com/haryai-com/n8n-nodes-haryai" }]
|
|
9
9
|
}
|
|
10
10
|
}
|
package/dist/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-haryai",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "n8n
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "n8n nodes for HaryAI: Seedance 2.5 video (text to video, first and last frame, reference images, videos and audio, sound) and Seedream 5.5 / Nano Banana images (text to image, reference images, edits).",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"homepage": "https://github.com/
|
|
6
|
+
"homepage": "https://github.com/haryai-com/n8n-nodes-haryai",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"n8n-community-node-package",
|
|
9
9
|
"n8n",
|
|
@@ -12,7 +12,10 @@
|
|
|
12
12
|
"bytedance",
|
|
13
13
|
"video-generation",
|
|
14
14
|
"ai-video",
|
|
15
|
-
"haryai"
|
|
15
|
+
"haryai",
|
|
16
|
+
"seedream",
|
|
17
|
+
"nano-banana",
|
|
18
|
+
"image-generation"
|
|
16
19
|
],
|
|
17
20
|
"author": {
|
|
18
21
|
"name": "HaryAI",
|
|
@@ -20,7 +23,7 @@
|
|
|
20
23
|
},
|
|
21
24
|
"repository": {
|
|
22
25
|
"type": "git",
|
|
23
|
-
"url": "https://github.com/
|
|
26
|
+
"url": "https://github.com/haryai-com/n8n-nodes-haryai.git"
|
|
24
27
|
},
|
|
25
28
|
"scripts": {
|
|
26
29
|
"build": "n8n-node build",
|
|
@@ -40,7 +43,8 @@
|
|
|
40
43
|
"dist/credentials/HaryAiApi.credentials.js"
|
|
41
44
|
],
|
|
42
45
|
"nodes": [
|
|
43
|
-
"dist/nodes/HaryAiSeedance/HaryAiSeedance.node.js"
|
|
46
|
+
"dist/nodes/HaryAiSeedance/HaryAiSeedance.node.js",
|
|
47
|
+
"dist/nodes/HaryAiImage/HaryAiImage.node.js"
|
|
44
48
|
]
|
|
45
49
|
},
|
|
46
50
|
"devDependencies": {
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-haryai",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "n8n
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "n8n nodes for HaryAI: Seedance 2.5 video (text to video, first and last frame, reference images, videos and audio, sound) and Seedream 5.5 / Nano Banana images (text to image, reference images, edits).",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"homepage": "https://github.com/
|
|
6
|
+
"homepage": "https://github.com/haryai-com/n8n-nodes-haryai",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"n8n-community-node-package",
|
|
9
9
|
"n8n",
|
|
@@ -12,7 +12,10 @@
|
|
|
12
12
|
"bytedance",
|
|
13
13
|
"video-generation",
|
|
14
14
|
"ai-video",
|
|
15
|
-
"haryai"
|
|
15
|
+
"haryai",
|
|
16
|
+
"seedream",
|
|
17
|
+
"nano-banana",
|
|
18
|
+
"image-generation"
|
|
16
19
|
],
|
|
17
20
|
"author": {
|
|
18
21
|
"name": "HaryAI",
|
|
@@ -20,7 +23,7 @@
|
|
|
20
23
|
},
|
|
21
24
|
"repository": {
|
|
22
25
|
"type": "git",
|
|
23
|
-
"url": "https://github.com/
|
|
26
|
+
"url": "https://github.com/haryai-com/n8n-nodes-haryai.git"
|
|
24
27
|
},
|
|
25
28
|
"scripts": {
|
|
26
29
|
"build": "n8n-node build",
|
|
@@ -40,7 +43,8 @@
|
|
|
40
43
|
"dist/credentials/HaryAiApi.credentials.js"
|
|
41
44
|
],
|
|
42
45
|
"nodes": [
|
|
43
|
-
"dist/nodes/HaryAiSeedance/HaryAiSeedance.node.js"
|
|
46
|
+
"dist/nodes/HaryAiSeedance/HaryAiSeedance.node.js",
|
|
47
|
+
"dist/nodes/HaryAiImage/HaryAiImage.node.js"
|
|
44
48
|
]
|
|
45
49
|
},
|
|
46
50
|
"devDependencies": {
|