CYAI 图像生成 (中转站)
Seedream stills in ComfyUI, plus the escape hatch for any relay
- image
- images
Most people install this pack for the video node and then wonder why the image node is in there. Two reasons. First, the obvious pipeline: generate a keyframe with Seedream, drop the images output straight into the video node's first_frame, and you've got text-to-image → image-to-video without a save/load round trip. Second, and more interesting if you're comfortable with JSON, this node barely cares which image API you point it at.
It defaults to ByteDance's doubao-seedream line through the Ark-shaped /api/v3/images/generations endpoint - a sync call, no polling, image back in the same response. That's the happy path with the relay's key. The rest of the node exists because relays never agree on field names.
How it works
The request body is a template. Out of the box it renders:
{"model": "...", "prompt": "...", "size": "2K", "seed": -1,
"watermark": false, "response_format": "url", "n": 1}
and POSTs it with Authorization: Bearer <api_key>. The response is parsed by walking a dot path (result_path, default data), then each item in that array is read for a URL field or a base64 field. Whichever it finds gets downloaded or decoded, converted to a float tensor in 0–1, and torch.cat'd into a single IMAGE batch when n came back with more than one picture. The download step sends a browser User-Agent and strips the Authorization header first - that's a real fix in the source, because a bare python-urllib UA gets Cloudflare-403'd on plenty of CDNs and you shouldn't be shipping your relay key to a CDN anyway.
The inputs that matter
Required: api_key, base_url, model (default doubao-seedream-4-0-250828, free text so 4-5 and 5-0 work), prompt, and size. That last one is a plain string, not a dropdown: 1K/2K/3K/4K tiers or literal pixels like 2048x2048. Because it isn't validated locally, a typo goes all the way upstream and comes back as a vendor error - annoying, but it also means whatever exotic size your relay supports just works.
Optional: seed (-1 = random), watermark, image for img2img. That image port is a full IMAGE input, so one image goes up as a string and several go up as an array - and if you feed it a batch from CYAI 图像合并 you get a multi-image fusion without extra wiring.
The rule-of-thumb for a beginner: ignore everything else. The remaining fields - recipe, submit_url, response_format, extra_body, url_field, b64_field, result_path, image_field, n - are a compatibility layer. Reach for them only when a generic error tells you the JSON doesn't match.
Output is one images port (an IMAGE batch). Preview it, save it, or wire it into first_frame / reference_images on the video node.
Installing it
Same pack, same procedure. ComfyUI Manager → Custom Nodes Manager → search CYAI Seedance (the pack's registry display name is the video node, which is confusing when you're after this one) → install → restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/Gin3601/comfyui_transit_node.git
Restart and look under the CYAI/Image category. No model downloads, no pip packages - the pack declares zero dependencies and uses only what ComfyUI already ships.
Where people get burned
"响应里找不到图像(路径 data)" means the relay speaks a different dialect. The image isn't missing, your result_path is wrong. Try result.images, output, or data first, then check whether items carry image_url instead of url and fix url_field. If the whole body is wrong - different port, width/height instead of size - submit_url plus an extra_body object like {"width": 1024, "height": 1024} gets you there without writing a full recipe. extra_body merges into the request and overrides same-named fields, so it's also how you inject parameters the node doesn't know about.
n above 1 is not portable. Some relays honour it, some silently return one image, some 400. Keep it at 1 unless you've confirmed the endpoint supports it - and remember that when it does work, you get a batch, so the downstream node has to handle batches.
Your key is in a text widget on the canvas. Every node in this pack stores api_key in plain text, and the workflow JSON (and any PNG you share from that workflow) carries it. This is the structural risk of the entire API-node category, not a flaw specific to this author - but this is a small single-author pack wrapping one specific relay, so treat the key as disposable: a low balance, rotated when you're done, never the one tied to your main account.
Text-to-image only gets you so far. Seedream's prompt adherence is good, but if you're chasing a specific person or a consistent character, generating one good still and reusing it as a reference beats re-rolling the prompt - the same logic as building a turnaround sheet before feeding a model reference frames. Generate once, keep the seed, reuse the image.
Inputs (17)
| Name | Type | Default | Description |
|---|---|---|---|
| api_key | STRING | 中转站 API Key(sk-xxx) | |
| base_url | STRING | https://www.cyai.club | 中转站地址 |
| model | STRING | doubao-seedream-4-0-250828 | 图像生成模型名(可自由输入;常见 doubao-seedream-4-0 / 4-5 / 5-0 系列) |
| prompt | STRING | 图像描述提示词 | |
| size | STRING | 2K | 输出尺寸:1K/2K/3K/4K 档位,或像素尺寸如 2048x2048 |
| imageopt | IMAGE | 可选:图生图参考图(多张 = 多图融合) | |
| seedopt | INT | -1-1–2147483647 | 随机种子(-1 表示随机) |
| watermarkopt | BOOLEAN | false | 是否添加 AI 水印 |
| recipeopt | STRING | 协议配方:内置名 ark_seedream(火山方舟 doubao-seedream),或贴 recipe JSON / 填文件路径接入其它图像 API。留空 = 默认 ark_seedream | |
| submit_urlopt | STRING | 可选:提交接口地址(相对 base_url 或完整 URL)。留空用配方/内置默认;中转站端口不同时直接改这里,不必写整份 recipe | |
| response_formatopt | COMBO | url | 返回格式:url = 临时下载链接,b64_json = base64 内嵌。按中转站支持情况选 |
| extra_bodyopt | STRING | 可选:额外请求体字段(JSON 对象),合并进请求体并覆盖同名字段。中转站字段命名/结构与默认不同时,在这里自由声明任意字段,如 {"width": 1024, "height": 1024, "cfg_scale": 7.5} | |
| url_fieldopt | STRING | url | 响应里图片 URL 的字段名(图片项内)。中转站命名不同时改,如 url / image_url / link |
| b64_fieldopt | STRING | b64_json | 响应里图片 base64 的字段名(图片项内),如 b64_json / base64 / image_b64 |
| result_pathopt | STRING | data | 响应里图片数组的字段路径(点路径),如 data / result.images / output。也支持直接指向字符串 URL 或字符串数组 |
| image_fieldopt | STRING | image | 图生图参考字段名(请求体里承载参考图的字段)。中转站命名不同时改,如 image / init_image / input_image / image_url |
| nopt | INT | 11–10 | 一次生成张数(n)。部分中转站支持一次多张;不支持的中转站会忽略或报错,保持 1 即可 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | 生成的图像(ComfyUI IMAGE 张量,可接预览/保存,或视频节点的参考图) |