{ "apiVersion": "yingce.plugin/v2", "id": "km-kemei-seedream", "name": "KM 可美 Seedream 5.0", "version": "1.0.0", "author": "KM 可美 / 影绘", "description": "适配可美 Seedream 5.0 Pro 与 Flash,单张生成、参考图与全部结果提取。", "enabled": true, "installable": true, "permissions": [ "generation.run", "media.read" ], "configuration": { "fields": [ { "name": "apiKey", "type": "secret", "label": "API Key", "required": true } ] }, "contributes": { "providers": [ { "id": "km-kemei-seedream", "label": "KM 可美 Seedream 5.0", "capabilities": [ "image" ], "scopes": [ "admin.system-channel", "user.custom-channel", "canvas", "creation", "agent" ], "baseUrl": "https://token.xinhankr.com", "requiresPublicMediaUrls": false, "auth": { "type": "bearer", "field": "apiKey" }, "parameters": [ { "name": "model", "type": "string", "required": true, "mapping": "model", "description": "精确 ID:doubao-seedream-5-0-pro-260628 / doubao-seedream-5-0-flash-260915。" }, { "name": "prompt", "type": "string", "required": true, "mapping": "prompt", "description": "图片提示词;宿主限制 32000 字符。" }, { "name": "imageCount", "type": "integer", "required": false, "mapping": "n=1", "description": "仅单张生成;图层分解返回的所有图层均保存。" }, { "name": "aspectRatio", "type": "string", "required": false, "mapping": "size", "description": "默认 2048x2048(2K、1:1);支持 1K / 1.5K / 2K、八种比例或合法像素尺寸。" }, { "name": "images", "type": "media[]", "required": false, "mapping": "image", "description": "最多 10 张;URL / Base64;不支持蒙版。" }, { "name": "providerOptions", "type": "object", "required": false, "mapping": "providerOptions.km-kemei-seedream", "description": "可选 response_format / output_format / watermark / background / layer_decomposition。" } ], "validations": [ { "assert": { "$in": [ { "$ref": "request.model" }, [ "doubao-seedream-5-0-pro-260628", "doubao-seedream-5-0-flash-260915" ] ] }, "message": "此协议只适用于可美 Seedream 5.0 Pro / Flash 的已确认模型 ID。" }, { "assert": { "$lte": [ { "$ref": "request.imageCount" }, 1 ] }, "message": "Seedream 5.0 Pro / Flash 仅支持单张生成,n 只能为 1。" }, { "assert": { "$or": [ { "$gt": [ { "$len": { "$trim": { "$ref": "request.prompt" } } }, 0 ] }, { "$eq": [ { "$coalesce": [ { "$ref": "request.providerOptions.km-kemei-seedream.layer_decomposition" }, false ] }, true ] } ] }, "message": "提示词不能为空;仅图层分解模式可省略提示词。" }, { "assert": { "$lte": [ { "$len": { "$ref": "request.prompt" } }, 32000 ] }, "message": "提示词超过宿主配置的 32000 字符上限。" }, { "assert": { "$lte": [ { "$len": { "$ref": "request.images" } }, 10 ] }, "message": "Seedream 5.0 参考图最多 10 张。" }, { "assert": { "$eq": [ { "$len": { "$filter": { "from": { "$ref": "request.images" }, "as": "media", "where": { "$eq": [ { "$ref": "media.role" }, "mask" ] } } } }, 0 ] }, "message": "此协议不支持蒙版编辑。" }, { "assert": { "$eq": [ { "$len": { "$filter": { "from": { "$ref": "request.images" }, "as": "media", "where": { "$gt": [ { "$coalesce": [ { "$ref": "media.metadata.bytes" }, 0 ] }, 31457280 ] } } } }, 0 ] }, "message": "单张参考图不得超过 30 MB。" }, { "assert": { "$or": [ { "$in": [ { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } }, [ "", "auto", "1k", "1.5k", "2k", "1:1", "4:3", "3:4", "16:9", "9:16", "3:2", "2:3", "21:9" ] ] }, { "$and": [ { "$eq": [ { "$len": { "$split": [ { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } }, "x" ] } }, 2 ] }, { "$gt": [ { "$toInt": { "$at": [ { "$split": [ { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } }, "x" ] }, 0 ] } }, 0 ] }, { "$gt": [ { "$toInt": { "$at": [ { "$split": [ { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } }, "x" ] }, 1 ] } }, 0 ] }, { "$gte": [ { "$multiply": [ { "$toInt": { "$at": [ { "$split": [ { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } }, "x" ] }, 0 ] } }, { "$toInt": { "$at": [ { "$split": [ { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } }, "x" ] }, 1 ] } } ] }, 921600 ] }, { "$lte": [ { "$multiply": [ { "$toInt": { "$at": [ { "$split": [ { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } }, "x" ] }, 0 ] } }, { "$toInt": { "$at": [ { "$split": [ { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } }, "x" ] }, 1 ] } } ] }, 4624220 ] }, { "$lte": [ { "$toInt": { "$at": [ { "$split": [ { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } }, "x" ] }, 0 ] } }, { "$multiply": [ { "$toInt": { "$at": [ { "$split": [ { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } }, "x" ] }, 1 ] } }, 16 ] } ] }, { "$lte": [ { "$toInt": { "$at": [ { "$split": [ { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } }, "x" ] }, 1 ] } }, { "$multiply": [ { "$toInt": { "$at": [ { "$split": [ { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } }, "x" ] }, 0 ] } }, 16 ] } ] } ] } ] }, "message": "size 必须为 1K / 1.5K / 2K 或合法像素尺寸;像素总数 921600–4624220,比例 1:16–16:1。" }, { "assert": { "$in": [ { "$coalesce": [ { "$ref": "request.providerOptions.km-kemei-seedream.response_format" }, "url" ] }, [ "url", "b64_json" ] ] }, "message": "response_format 仅支持 url / b64_json。" }, { "assert": { "$in": [ { "$coalesce": [ { "$ref": "request.providerOptions.km-kemei-seedream.output_format" }, "jpeg" ] }, [ "jpeg", "png" ] ] }, "message": "output_format 仅支持 jpeg / png。" }, { "assert": { "$in": [ { "$coalesce": [ { "$ref": "request.providerOptions.km-kemei-seedream.background" }, "opaque" ] }, [ "opaque", "transparent" ] ] }, "message": "background 仅支持 opaque / transparent。" }, { "assert": { "$or": [ { "$ne": [ { "$coalesce": [ { "$ref": "request.providerOptions.km-kemei-seedream.background" }, "opaque" ] }, "transparent" ] }, { "$and": [ { "$eq": [ { "$len": { "$ref": "request.images" } }, 1 ] }, { "$eq": [ { "$coalesce": [ { "$ref": "request.providerOptions.km-kemei-seedream.output_format" }, "jpeg" ] }, "png" ] } ] } ] }, "message": "透明背景仅用于一张带透明通道的参考图,输出必须为 png。" }, { "assert": { "$in": [ { "$coalesce": [ { "$ref": "request.providerOptions.km-kemei-seedream.layer_decomposition" }, false ] }, [ true, false ] ] }, "message": "layer_decomposition 必须为布尔值。" }, { "assert": { "$or": [ { "$ne": [ { "$coalesce": [ { "$ref": "request.providerOptions.km-kemei-seedream.layer_decomposition" }, false ] }, true ] }, { "$and": [ { "$eq": [ { "$len": { "$ref": "request.images" } }, 1 ] }, { "$in": [ { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } }, [ "", "auto", "1k", "1.5k", "2k" ] ] } ] } ] }, "message": "图层分解仅支持一张参考图,size 使用 1K / 1.5K / 2K / auto 档位。" }, { "assert": { "$eq": [ { "$ref": "request.providerOptions.km-kemei-seedream.sequential_image_generation" }, null ] }, "message": "sequential_image_generation 不适用于 Seedream 5.0 Pro / Flash,已拒绝请求。" }, { "assert": { "$eq": [ { "$ref": "request.providerOptions.km-kemei-seedream.sequential_image_generation_options" }, null ] }, "message": "sequential_image_generation_options 不适用于 Seedream 5.0 Pro / Flash,已拒绝请求。" }, { "assert": { "$eq": [ { "$ref": "request.providerOptions.km-kemei-seedream.web_search" }, null ] }, "message": "web_search 不适用于 Seedream 5.0 Pro / Flash,已拒绝请求。" }, { "assert": { "$eq": [ { "$ref": "request.providerOptions.km-kemei-seedream.stream" }, null ] }, "message": "stream 不适用于 Seedream 5.0 Pro / Flash,已拒绝请求。" }, { "assert": { "$eq": [ { "$ref": "request.providerOptions.km-kemei-seedream.tools" }, null ] }, "message": "tools 不适用于 Seedream 5.0 Pro / Flash,已拒绝请求。" } ], "create": { "method": "POST", "path": "/v1/images/generations", "contentType": "application/json", "body": { "model": { "$ref": "request.model" }, "prompt": { "$ref": "request.prompt" }, "n": 1, "size": { "$if": { "condition": { "$eq": [ { "$coalesce": [ { "$ref": "request.providerOptions.km-kemei-seedream.layer_decomposition" }, false ] }, true ] }, "then": { "$if": { "condition": { "$in": [ { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } }, [ "", "auto" ] ] }, "then": "auto", "else": { "$switch": { "cases": [ { "when": { "$in": [ { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } }, [ "", "auto", "2k" ] ] }, "then": "2K" }, { "when": { "$eq": [ { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } }, "1k" ] }, "then": "1K" }, { "when": { "$eq": [ { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } }, "1.5k" ] }, "then": "1.5K" }, { "when": { "$eq": [ { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } }, "1:1" ] }, "then": "2048x2048" }, { "when": { "$eq": [ { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } }, "4:3" ] }, "then": "2368x1776" }, { "when": { "$eq": [ { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } }, "3:4" ] }, "then": "1776x2368" }, { "when": { "$eq": [ { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } }, "16:9" ] }, "then": "2816x1584" }, { "when": { "$eq": [ { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } }, "9:16" ] }, "then": "1584x2816" }, { "when": { "$eq": [ { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } }, "3:2" ] }, "then": "2496x1664" }, { "when": { "$eq": [ { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } }, "2:3" ] }, "then": "1664x2496" }, { "when": { "$eq": [ { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } }, "21:9" ] }, "then": "3136x1344" } ], "default": { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } } } } } }, "else": { "$switch": { "cases": [ { "when": { "$in": [ { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } }, [ "", "auto", "2k" ] ] }, "then": "2K" }, { "when": { "$eq": [ { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } }, "1k" ] }, "then": "1K" }, { "when": { "$eq": [ { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } }, "1.5k" ] }, "then": "1.5K" }, { "when": { "$eq": [ { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } }, "1:1" ] }, "then": "2048x2048" }, { "when": { "$eq": [ { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } }, "4:3" ] }, "then": "2368x1776" }, { "when": { "$eq": [ { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } }, "3:4" ] }, "then": "1776x2368" }, { "when": { "$eq": [ { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } }, "16:9" ] }, "then": "2816x1584" }, { "when": { "$eq": [ { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } }, "9:16" ] }, "then": "1584x2816" }, { "when": { "$eq": [ { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } }, "3:2" ] }, "then": "2496x1664" }, { "when": { "$eq": [ { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } }, "2:3" ] }, "then": "1664x2496" }, { "when": { "$eq": [ { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } }, "21:9" ] }, "then": "3136x1344" } ], "default": { "$lower": { "$trim": { "$coalesce": [ { "$ref": "request.aspectRatio" }, "2k" ] } } } } } } }, "image": { "$omitEmpty": { "$if": { "condition": { "$eq": [ { "$len": { "$ref": "request.images" } }, 1 ] }, "then": { "$first": { "$map": { "from": { "$sortByOrder": { "$ref": "request.images" } }, "as": "media", "in": { "$ref": "media.value" } } } }, "else": { "$map": { "from": { "$sortByOrder": { "$ref": "request.images" } }, "as": "media", "in": { "$ref": "media.value" } } } } } }, "response_format": { "$coalesce": [ { "$ref": "request.providerOptions.km-kemei-seedream.response_format" }, "url" ] }, "output_format": { "$coalesce": [ { "$ref": "request.providerOptions.km-kemei-seedream.output_format" }, "jpeg" ] }, "watermark": { "$coalesce": [ { "$ref": "request.providerOptions.km-kemei-seedream.watermark" }, false ] }, "background": { "$coalesce": [ { "$ref": "request.providerOptions.km-kemei-seedream.background" }, "opaque" ] }, "layer_decomposition": { "$omitEmpty": { "$ref": "request.providerOptions.km-kemei-seedream.layer_decomposition" } } } }, "response": { "status": "succeeded", "images": { "$ref": "response.data" }, "usage": { "$ref": "response.usage" }, "errorPaths": [ "error.code", "error.message" ], "messagePaths": [ "error.message" ] } } ] }, "documentation": "# KM 可美 Seedream 5.0\n\n`yingce.plugin/v2` 声明式图片协议包。使用渠道凭证,宿主统一负责 HTTPS、SSRF 校验、超时与媒体持久化;不包含脚本运行时或密钥。\n\n适配精确模型 ID:`doubao-seedream-5-0-pro-260628`、`doubao-seedream-5-0-flash-260915`。\n\n选择协议时“能力与参数”默认设为:2K / 1:1(2048x2048)、单张生成、最多 10 张参考图、单图 30 MB、关闭蒙版、关闭通用 quality 和透明背景开关。1K / 1.5K / 2K 各有八种官方精确尺寸。响应默认 URL、输出 JPEG、关闭水印;所有返回图片及用量交给宿主消费。\n\n详情见 [接口说明](docs/interface.md)。\n\n---\n\n# KM 可美 Seedream 5.0 接口\n\n## 来源与范围\n\n- [供应商图像文档](https://token.xinhankr.com/docs/quickstart/doc0002),公开文档 `volc-image`:OpenAI 兼容端点、Pro 的限制与默认值。\n- [火山引擎 Image generation API](https://docs.volcengine.com/docs/ark/image-generation-api?lang=zh&redirect=1):Pro / Flash 的精确模型 ID、尺寸、参考图、格式和能力限制。\n- 供应商模型市场确认两个精确模型 ID 可用。市场计费档不是参考图或组图数量上限。\n\n## 请求\n\n`POST https://token.xinhankr.com/v1/images/generations`,JSON,渠道 API Key 作为 Bearer Token。\n\n```json\n{\n \"model\": \"doubao-seedream-5-0-pro-260628\",\n \"prompt\": \"暖色书房中的橘猫,写实照片,正方形构图\",\n \"n\": 1,\n \"size\": \"2048x2048\",\n \"response_format\": \"url\",\n \"output_format\": \"jpeg\",\n \"watermark\": false,\n \"background\": \"opaque\"\n}\n```\n\nFlash 使用 `doubao-seedream-5-0-flash-260915`。图生图仍使用同一端点;参考图映射为 `image`,单图是字符串,多图是数组,保持输入顺序,支持 URL / Base64。最多 10 张,每张不超过 30 MB。官方还要求参考图边长大于 14、总像素 196–36000000、比例 1:16–16:1;这些条件需素材本身满足。没有蒙版接口。\n\n`size` 支持 `1K` / `1.5K` / `2K`,或像素字符串。空值 / auto 默认 2K;宿主比例值映射为官方 2K 像素。自定义总像素 921600–4624220,比例 1:16–16:1。宿主交互控件还保留全站的 16px 步长、最长边 3840 与 3:1 比例约束。提示词 32000 字符是宿主限制,未声称是供应商的上限。\n\n| 比例 | 1K | 1.5K | 2K |\n| --- | --- | --- | --- |\n| 1:1 | 1024x1024 | 1536x1536 | 2048x2048 |\n| 4:3 | 1152x864 | 1792x1344 | 2368x1776 |\n| 3:4 | 864x1152 | 1344x1792 | 1776x2368 |\n| 16:9 | 1424x800 | 2048x1152 | 2816x1584 |\n| 9:16 | 800x1424 | 1152x2048 | 1584x2816 |\n| 3:2 | 1248x832 | 1872x1248 | 2496x1664 |\n| 2:3 | 832x1248 | 1248x1872 | 1664x2496 |\n| 21:9 | 1568x672 | 2352x1008 | 3136x1344 |\n\n## 命名空间扩展\n\n`providerOptions.km-kemei-seedream`:\n\n- `response_format`:url(默认)/ b64_json。\n- `output_format`:jpeg(默认)/ png。\n- `watermark`:false(默认)/ true。\n- `background`:opaque(默认)/ transparent。透明只用于一张带 alpha 的输入图,且输出 png;插件校验单图与 png 条件,alpha 条件由供应商检查。宿主通用透明开关默认关闭,避免把任意文生图伪装成此能力。\n- `layer_decomposition`:布尔值,仅一张输入图,尺寸使用档位或 auto;此时允许空提示词,保存全部图层,不按 n=1 截断。\n\nPro / Flash 不支持 sequential_image_generation、组图、联网搜索、流式输出。插件拒绝相关扩展字段,不发送通用 quality、resolution、seed。\n\n## 响应与失败\n\n同步响应中的 `data[]` 全部提取,兼容 url / b64_json,并透传 usage。供应商 URL 有有效期,宿主必须持久化结果。HTTP 错误由宿主处理,JSON 的 error.code / error.message 映射为失败;不以空结果冒充成功。\n\n安装包不携带渠道密钥;管理员通过正常插件安装机制启用,再给渠道模型选择此协议。模型价格与启用状态由管理员独立配置。\n\n\n## Manifest 完整接口定义\n\n以下 JSON 与插件包内实际 `manifest.json` 逐字段一致,覆盖插件身份、权限、配置、鉴权、参数、校验、创建、Agent、查询、取消、结果下载、响应和 Agent 响应映射。`documentation` 字段的值就是当前完整文档;为避免文档在自身内部无限递归,JSON 中仅用等义占位文本表示正文。\n\n```json\n{\n \"apiVersion\": \"yingce.plugin/v2\",\n \"id\": \"km-kemei-seedream\",\n \"name\": \"KM 可美 Seedream 5.0\",\n \"version\": \"1.0.0\",\n \"author\": \"KM 可美 / 影绘\",\n \"description\": \"适配可美 Seedream 5.0 Pro 与 Flash,单张生成、参考图与全部结果提取。\",\n \"enabled\": true,\n \"installable\": true,\n \"permissions\": [\n \"generation.run\",\n \"media.read\"\n ],\n \"configuration\": {\n \"fields\": [\n {\n \"name\": \"apiKey\",\n \"type\": \"secret\",\n \"label\": \"API Key\",\n \"required\": true\n }\n ]\n },\n \"contributes\": {\n \"providers\": [\n {\n \"id\": \"km-kemei-seedream\",\n \"label\": \"KM 可美 Seedream 5.0\",\n \"capabilities\": [\n \"image\"\n ],\n \"scopes\": [\n \"admin.system-channel\",\n \"user.custom-channel\",\n \"canvas\",\n \"creation\",\n \"agent\"\n ],\n \"baseUrl\": \"https://token.xinhankr.com\",\n \"requiresPublicMediaUrls\": false,\n \"auth\": {\n \"type\": \"bearer\",\n \"field\": \"apiKey\"\n },\n \"parameters\": [\n {\n \"name\": \"model\",\n \"type\": \"string\",\n \"required\": true,\n \"mapping\": \"model\",\n \"description\": \"精确 ID:doubao-seedream-5-0-pro-260628 / doubao-seedream-5-0-flash-260915。\"\n },\n {\n \"name\": \"prompt\",\n \"type\": \"string\",\n \"required\": true,\n \"mapping\": \"prompt\",\n \"description\": \"图片提示词;宿主限制 32000 字符。\"\n },\n {\n \"name\": \"imageCount\",\n \"type\": \"integer\",\n \"required\": false,\n \"mapping\": \"n=1\",\n \"description\": \"仅单张生成;图层分解返回的所有图层均保存。\"\n },\n {\n \"name\": \"aspectRatio\",\n \"type\": \"string\",\n \"required\": false,\n \"mapping\": \"size\",\n \"description\": \"默认 2048x2048(2K、1:1);支持 1K / 1.5K / 2K、八种比例或合法像素尺寸。\"\n },\n {\n \"name\": \"images\",\n \"type\": \"media[]\",\n \"required\": false,\n \"mapping\": \"image\",\n \"description\": \"最多 10 张;URL / Base64;不支持蒙版。\"\n },\n {\n \"name\": \"providerOptions\",\n \"type\": \"object\",\n \"required\": false,\n \"mapping\": \"providerOptions.km-kemei-seedream\",\n \"description\": \"可选 response_format / output_format / watermark / background / layer_decomposition。\"\n }\n ],\n \"validations\": [\n {\n \"assert\": {\n \"$in\": [\n {\n \"$ref\": \"request.model\"\n },\n [\n \"doubao-seedream-5-0-pro-260628\",\n \"doubao-seedream-5-0-flash-260915\"\n ]\n ]\n },\n \"message\": \"此协议只适用于可美 Seedream 5.0 Pro / Flash 的已确认模型 ID。\"\n },\n {\n \"assert\": {\n \"$lte\": [\n {\n \"$ref\": \"request.imageCount\"\n },\n 1\n ]\n },\n \"message\": \"Seedream 5.0 Pro / Flash 仅支持单张生成,n 只能为 1。\"\n },\n {\n \"assert\": {\n \"$or\": [\n {\n \"$gt\": [\n {\n \"$len\": {\n \"$trim\": {\n \"$ref\": \"request.prompt\"\n }\n }\n },\n 0\n ]\n },\n {\n \"$eq\": [\n {\n \"$coalesce\": [\n {\n \"$ref\": \"request.providerOptions.km-kemei-seedream.layer_decomposition\"\n },\n false\n ]\n },\n true\n ]\n }\n ]\n },\n \"message\": \"提示词不能为空;仅图层分解模式可省略提示词。\"\n },\n {\n \"assert\": {\n \"$lte\": [\n {\n \"$len\": {\n \"$ref\": \"request.prompt\"\n }\n },\n 32000\n ]\n },\n \"message\": \"提示词超过宿主配置的 32000 字符上限。\"\n },\n {\n \"assert\": {\n \"$lte\": [\n {\n \"$len\": {\n \"$ref\": \"request.images\"\n }\n },\n 10\n ]\n },\n \"message\": \"Seedream 5.0 参考图最多 10 张。\"\n },\n {\n \"assert\": {\n \"$eq\": [\n {\n \"$len\": {\n \"$filter\": {\n \"from\": {\n \"$ref\": \"request.images\"\n },\n \"as\": \"media\",\n \"where\": {\n \"$eq\": [\n {\n \"$ref\": \"media.role\"\n },\n \"mask\"\n ]\n }\n }\n }\n },\n 0\n ]\n },\n \"message\": \"此协议不支持蒙版编辑。\"\n },\n {\n \"assert\": {\n \"$eq\": [\n {\n \"$len\": {\n \"$filter\": {\n \"from\": {\n \"$ref\": \"request.images\"\n },\n \"as\": \"media\",\n \"where\": {\n \"$gt\": [\n {\n \"$coalesce\": [\n {\n \"$ref\": \"media.metadata.bytes\"\n },\n 0\n ]\n },\n 31457280\n ]\n }\n }\n }\n },\n 0\n ]\n },\n \"message\": \"单张参考图不得超过 30 MB。\"\n },\n {\n \"assert\": {\n \"$or\": [\n {\n \"$in\": [\n {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n },\n [\n \"\",\n \"auto\",\n \"1k\",\n \"1.5k\",\n \"2k\",\n \"1:1\",\n \"4:3\",\n \"3:4\",\n \"16:9\",\n \"9:16\",\n \"3:2\",\n \"2:3\",\n \"21:9\"\n ]\n ]\n },\n {\n \"$and\": [\n {\n \"$eq\": [\n {\n \"$len\": {\n \"$split\": [\n {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n },\n \"x\"\n ]\n }\n },\n 2\n ]\n },\n {\n \"$gt\": [\n {\n \"$toInt\": {\n \"$at\": [\n {\n \"$split\": [\n {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n },\n \"x\"\n ]\n },\n 0\n ]\n }\n },\n 0\n ]\n },\n {\n \"$gt\": [\n {\n \"$toInt\": {\n \"$at\": [\n {\n \"$split\": [\n {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n },\n \"x\"\n ]\n },\n 1\n ]\n }\n },\n 0\n ]\n },\n {\n \"$gte\": [\n {\n \"$multiply\": [\n {\n \"$toInt\": {\n \"$at\": [\n {\n \"$split\": [\n {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n },\n \"x\"\n ]\n },\n 0\n ]\n }\n },\n {\n \"$toInt\": {\n \"$at\": [\n {\n \"$split\": [\n {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n },\n \"x\"\n ]\n },\n 1\n ]\n }\n }\n ]\n },\n 921600\n ]\n },\n {\n \"$lte\": [\n {\n \"$multiply\": [\n {\n \"$toInt\": {\n \"$at\": [\n {\n \"$split\": [\n {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n },\n \"x\"\n ]\n },\n 0\n ]\n }\n },\n {\n \"$toInt\": {\n \"$at\": [\n {\n \"$split\": [\n {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n },\n \"x\"\n ]\n },\n 1\n ]\n }\n }\n ]\n },\n 4624220\n ]\n },\n {\n \"$lte\": [\n {\n \"$toInt\": {\n \"$at\": [\n {\n \"$split\": [\n {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n },\n \"x\"\n ]\n },\n 0\n ]\n }\n },\n {\n \"$multiply\": [\n {\n \"$toInt\": {\n \"$at\": [\n {\n \"$split\": [\n {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n },\n \"x\"\n ]\n },\n 1\n ]\n }\n },\n 16\n ]\n }\n ]\n },\n {\n \"$lte\": [\n {\n \"$toInt\": {\n \"$at\": [\n {\n \"$split\": [\n {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n },\n \"x\"\n ]\n },\n 1\n ]\n }\n },\n {\n \"$multiply\": [\n {\n \"$toInt\": {\n \"$at\": [\n {\n \"$split\": [\n {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n },\n \"x\"\n ]\n },\n 0\n ]\n }\n },\n 16\n ]\n }\n ]\n }\n ]\n }\n ]\n },\n \"message\": \"size 必须为 1K / 1.5K / 2K 或合法像素尺寸;像素总数 921600–4624220,比例 1:16–16:1。\"\n },\n {\n \"assert\": {\n \"$in\": [\n {\n \"$coalesce\": [\n {\n \"$ref\": \"request.providerOptions.km-kemei-seedream.response_format\"\n },\n \"url\"\n ]\n },\n [\n \"url\",\n \"b64_json\"\n ]\n ]\n },\n \"message\": \"response_format 仅支持 url / b64_json。\"\n },\n {\n \"assert\": {\n \"$in\": [\n {\n \"$coalesce\": [\n {\n \"$ref\": \"request.providerOptions.km-kemei-seedream.output_format\"\n },\n \"jpeg\"\n ]\n },\n [\n \"jpeg\",\n \"png\"\n ]\n ]\n },\n \"message\": \"output_format 仅支持 jpeg / png。\"\n },\n {\n \"assert\": {\n \"$in\": [\n {\n \"$coalesce\": [\n {\n \"$ref\": \"request.providerOptions.km-kemei-seedream.background\"\n },\n \"opaque\"\n ]\n },\n [\n \"opaque\",\n \"transparent\"\n ]\n ]\n },\n \"message\": \"background 仅支持 opaque / transparent。\"\n },\n {\n \"assert\": {\n \"$or\": [\n {\n \"$ne\": [\n {\n \"$coalesce\": [\n {\n \"$ref\": \"request.providerOptions.km-kemei-seedream.background\"\n },\n \"opaque\"\n ]\n },\n \"transparent\"\n ]\n },\n {\n \"$and\": [\n {\n \"$eq\": [\n {\n \"$len\": {\n \"$ref\": \"request.images\"\n }\n },\n 1\n ]\n },\n {\n \"$eq\": [\n {\n \"$coalesce\": [\n {\n \"$ref\": \"request.providerOptions.km-kemei-seedream.output_format\"\n },\n \"jpeg\"\n ]\n },\n \"png\"\n ]\n }\n ]\n }\n ]\n },\n \"message\": \"透明背景仅用于一张带透明通道的参考图,输出必须为 png。\"\n },\n {\n \"assert\": {\n \"$in\": [\n {\n \"$coalesce\": [\n {\n \"$ref\": \"request.providerOptions.km-kemei-seedream.layer_decomposition\"\n },\n false\n ]\n },\n [\n true,\n false\n ]\n ]\n },\n \"message\": \"layer_decomposition 必须为布尔值。\"\n },\n {\n \"assert\": {\n \"$or\": [\n {\n \"$ne\": [\n {\n \"$coalesce\": [\n {\n \"$ref\": \"request.providerOptions.km-kemei-seedream.layer_decomposition\"\n },\n false\n ]\n },\n true\n ]\n },\n {\n \"$and\": [\n {\n \"$eq\": [\n {\n \"$len\": {\n \"$ref\": \"request.images\"\n }\n },\n 1\n ]\n },\n {\n \"$in\": [\n {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n },\n [\n \"\",\n \"auto\",\n \"1k\",\n \"1.5k\",\n \"2k\"\n ]\n ]\n }\n ]\n }\n ]\n },\n \"message\": \"图层分解仅支持一张参考图,size 使用 1K / 1.5K / 2K / auto 档位。\"\n },\n {\n \"assert\": {\n \"$eq\": [\n {\n \"$ref\": \"request.providerOptions.km-kemei-seedream.sequential_image_generation\"\n },\n null\n ]\n },\n \"message\": \"sequential_image_generation 不适用于 Seedream 5.0 Pro / Flash,已拒绝请求。\"\n },\n {\n \"assert\": {\n \"$eq\": [\n {\n \"$ref\": \"request.providerOptions.km-kemei-seedream.sequential_image_generation_options\"\n },\n null\n ]\n },\n \"message\": \"sequential_image_generation_options 不适用于 Seedream 5.0 Pro / Flash,已拒绝请求。\"\n },\n {\n \"assert\": {\n \"$eq\": [\n {\n \"$ref\": \"request.providerOptions.km-kemei-seedream.web_search\"\n },\n null\n ]\n },\n \"message\": \"web_search 不适用于 Seedream 5.0 Pro / Flash,已拒绝请求。\"\n },\n {\n \"assert\": {\n \"$eq\": [\n {\n \"$ref\": \"request.providerOptions.km-kemei-seedream.stream\"\n },\n null\n ]\n },\n \"message\": \"stream 不适用于 Seedream 5.0 Pro / Flash,已拒绝请求。\"\n },\n {\n \"assert\": {\n \"$eq\": [\n {\n \"$ref\": \"request.providerOptions.km-kemei-seedream.tools\"\n },\n null\n ]\n },\n \"message\": \"tools 不适用于 Seedream 5.0 Pro / Flash,已拒绝请求。\"\n }\n ],\n \"create\": {\n \"method\": \"POST\",\n \"path\": \"/v1/images/generations\",\n \"contentType\": \"application/json\",\n \"body\": {\n \"model\": {\n \"$ref\": \"request.model\"\n },\n \"prompt\": {\n \"$ref\": \"request.prompt\"\n },\n \"n\": 1,\n \"size\": {\n \"$if\": {\n \"condition\": {\n \"$eq\": [\n {\n \"$coalesce\": [\n {\n \"$ref\": \"request.providerOptions.km-kemei-seedream.layer_decomposition\"\n },\n false\n ]\n },\n true\n ]\n },\n \"then\": {\n \"$if\": {\n \"condition\": {\n \"$in\": [\n {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n },\n [\n \"\",\n \"auto\"\n ]\n ]\n },\n \"then\": \"auto\",\n \"else\": {\n \"$switch\": {\n \"cases\": [\n {\n \"when\": {\n \"$in\": [\n {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n },\n [\n \"\",\n \"auto\",\n \"2k\"\n ]\n ]\n },\n \"then\": \"2K\"\n },\n {\n \"when\": {\n \"$eq\": [\n {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n },\n \"1k\"\n ]\n },\n \"then\": \"1K\"\n },\n {\n \"when\": {\n \"$eq\": [\n {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n },\n \"1.5k\"\n ]\n },\n \"then\": \"1.5K\"\n },\n {\n \"when\": {\n \"$eq\": [\n {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n },\n \"1:1\"\n ]\n },\n \"then\": \"2048x2048\"\n },\n {\n \"when\": {\n \"$eq\": [\n {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n },\n \"4:3\"\n ]\n },\n \"then\": \"2368x1776\"\n },\n {\n \"when\": {\n \"$eq\": [\n {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n },\n \"3:4\"\n ]\n },\n \"then\": \"1776x2368\"\n },\n {\n \"when\": {\n \"$eq\": [\n {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n },\n \"16:9\"\n ]\n },\n \"then\": \"2816x1584\"\n },\n {\n \"when\": {\n \"$eq\": [\n {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n },\n \"9:16\"\n ]\n },\n \"then\": \"1584x2816\"\n },\n {\n \"when\": {\n \"$eq\": [\n {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n },\n \"3:2\"\n ]\n },\n \"then\": \"2496x1664\"\n },\n {\n \"when\": {\n \"$eq\": [\n {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n },\n \"2:3\"\n ]\n },\n \"then\": \"1664x2496\"\n },\n {\n \"when\": {\n \"$eq\": [\n {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n },\n \"21:9\"\n ]\n },\n \"then\": \"3136x1344\"\n }\n ],\n \"default\": {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n }\n }\n }\n }\n },\n \"else\": {\n \"$switch\": {\n \"cases\": [\n {\n \"when\": {\n \"$in\": [\n {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n },\n [\n \"\",\n \"auto\",\n \"2k\"\n ]\n ]\n },\n \"then\": \"2K\"\n },\n {\n \"when\": {\n \"$eq\": [\n {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n },\n \"1k\"\n ]\n },\n \"then\": \"1K\"\n },\n {\n \"when\": {\n \"$eq\": [\n {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n },\n \"1.5k\"\n ]\n },\n \"then\": \"1.5K\"\n },\n {\n \"when\": {\n \"$eq\": [\n {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n },\n \"1:1\"\n ]\n },\n \"then\": \"2048x2048\"\n },\n {\n \"when\": {\n \"$eq\": [\n {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n },\n \"4:3\"\n ]\n },\n \"then\": \"2368x1776\"\n },\n {\n \"when\": {\n \"$eq\": [\n {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n },\n \"3:4\"\n ]\n },\n \"then\": \"1776x2368\"\n },\n {\n \"when\": {\n \"$eq\": [\n {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n },\n \"16:9\"\n ]\n },\n \"then\": \"2816x1584\"\n },\n {\n \"when\": {\n \"$eq\": [\n {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n },\n \"9:16\"\n ]\n },\n \"then\": \"1584x2816\"\n },\n {\n \"when\": {\n \"$eq\": [\n {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n },\n \"3:2\"\n ]\n },\n \"then\": \"2496x1664\"\n },\n {\n \"when\": {\n \"$eq\": [\n {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n },\n \"2:3\"\n ]\n },\n \"then\": \"1664x2496\"\n },\n {\n \"when\": {\n \"$eq\": [\n {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n },\n \"21:9\"\n ]\n },\n \"then\": \"3136x1344\"\n }\n ],\n \"default\": {\n \"$lower\": {\n \"$trim\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.aspectRatio\"\n },\n \"2k\"\n ]\n }\n }\n }\n }\n }\n }\n },\n \"image\": {\n \"$omitEmpty\": {\n \"$if\": {\n \"condition\": {\n \"$eq\": [\n {\n \"$len\": {\n \"$ref\": \"request.images\"\n }\n },\n 1\n ]\n },\n \"then\": {\n \"$first\": {\n \"$map\": {\n \"from\": {\n \"$sortByOrder\": {\n \"$ref\": \"request.images\"\n }\n },\n \"as\": \"media\",\n \"in\": {\n \"$ref\": \"media.value\"\n }\n }\n }\n },\n \"else\": {\n \"$map\": {\n \"from\": {\n \"$sortByOrder\": {\n \"$ref\": \"request.images\"\n }\n },\n \"as\": \"media\",\n \"in\": {\n \"$ref\": \"media.value\"\n }\n }\n }\n }\n }\n },\n \"response_format\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.providerOptions.km-kemei-seedream.response_format\"\n },\n \"url\"\n ]\n },\n \"output_format\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.providerOptions.km-kemei-seedream.output_format\"\n },\n \"jpeg\"\n ]\n },\n \"watermark\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.providerOptions.km-kemei-seedream.watermark\"\n },\n false\n ]\n },\n \"background\": {\n \"$coalesce\": [\n {\n \"$ref\": \"request.providerOptions.km-kemei-seedream.background\"\n },\n \"opaque\"\n ]\n },\n \"layer_decomposition\": {\n \"$omitEmpty\": {\n \"$ref\": \"request.providerOptions.km-kemei-seedream.layer_decomposition\"\n }\n }\n }\n },\n \"response\": {\n \"status\": \"succeeded\",\n \"images\": {\n \"$ref\": \"response.data\"\n },\n \"usage\": {\n \"$ref\": \"response.usage\"\n },\n \"errorPaths\": [\n \"error.code\",\n \"error.message\"\n ],\n \"messagePaths\": [\n \"error.message\"\n ]\n }\n }\n ]\n },\n \"documentation\": \"<当前插件的完整 documentation,由 README.md 与 docs/interface.md 拼接而成;为避免 JSON 递归,此处不重复展开正文。>\"\n}\n```\n\n" }