@neta-art/generation 0.1.7 → 0.1.9

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 CHANGED
@@ -67,6 +67,18 @@ Live provider tests are separate from `pnpm test` because they use the real SDK
67
67
  pnpm test:live:suno
68
68
  ```
69
69
 
70
+ Seedance live smoke tests exercise text-to-video, first/last frame video, and multi-reference-image plus reference-video
71
+ requests through the built SDK:
72
+
73
+ ```bash
74
+ pnpm test:live:seedance
75
+ ```
76
+
77
+ The script reads `NETA_ROUTER_API_KEY` or `NETA_API_KEY`, falling back to `/tmp/neta-router-key`, and writes reusable
78
+ JSON results under `/tmp/neta-generation-live/seedance`. Use `-- --download` to also save generated media files.
79
+ It also writes `visual-review.html`, which places the inputs and outputs side by side so the result can be checked for
80
+ actual first/last-frame or reference-media effect. Rebuild that report from an existing run with `-- --report-only`.
81
+
70
82
  You can also call providers through the CLI:
71
83
 
72
84
  ```bash
@@ -209,7 +221,7 @@ const output = await client.generate({
209
221
  });
210
222
  ```
211
223
 
212
- Frame and reference-image video modes use `meta.role`:
224
+ Seedance frame and reference media video modes use `meta.role` with public URL media sources:
213
225
 
214
226
  ```ts
215
227
  await client.generate({
@@ -222,6 +234,17 @@ await client.generate({
222
234
  });
223
235
  ```
224
236
 
237
+ ```ts
238
+ await client.generate({
239
+ model: "seedance-2-0-fast",
240
+ content: [
241
+ { type: "text", text: "keep the subject from the image and the motion style from the video" },
242
+ { type: "image", source: { type: "url", url: "https://example.com/subject.jpg" }, meta: { role: "reference_image" } },
243
+ { type: "video", source: { type: "url", url: "https://example.com/motion.mp4" }, meta: { role: "reference_video" } },
244
+ ],
245
+ });
246
+ ```
247
+
225
248
  Kling exposes stable capability model ids while the adapter sends the latest upstream `model_name` for each capability:
226
249
 
227
250
  ```ts
@@ -335,6 +358,8 @@ type GenerationSource =
335
358
  | { type: "base64"; mediaType: string; data: string };
336
359
  ```
337
360
 
361
+ The content block `type` selects the media kind (`image`, `video`, or `audio`). The source `type` selects how that media is supplied (`url` or `base64`). When a model declares `roles`, `meta.role` selects the media's provider-specific purpose. When it also sets `roleRequired`, that role must be present.
362
+
338
363
  ## Adapter types
339
364
 
340
365
  Built-in adapters:
@@ -32,6 +32,8 @@ type GenerationContentSpec = {
32
32
  min?: number;
33
33
  max?: number;
34
34
  sources?: Array<GenerationSource["type"]>;
35
+ roles?: string[];
36
+ roleRequired?: boolean;
35
37
  merge?: "newline" | "space" | "concat";
36
38
  meta?: Record<string, unknown>;
37
39
  description?: string;
@@ -185,4 +187,4 @@ declare function getBuiltinGenerationModel(model: string): GenerationModelDeclar
185
187
  declare function listBuiltinGenerationModels(): GenerationModelDeclaration[];
186
188
  //#endregion
187
189
  export { GenerationSourceResolver as C, GenerationSource as S, ResolvedGenerationRequest as T, GenerationMetaFieldSpec as _, GenerateRequest as a, GenerationModelDeclaration as b, GenerationAdapterInput as c, GenerationContentBlockMeta as d, GenerationContentSpec as f, GenerationDebugOptions as g, GenerationDebugLogger as h, CreateGenerationClientOptions as i, GenerationClient as l, GenerationDebugEvent as m, getBuiltinGenerationModel as n, GenerationAdapter as o, GenerationDebugConfig as p, listBuiltinGenerationModels as r, GenerationAdapterContext as s, builtinGenerationModels as t, GenerationContentBlock as u, GenerationMetaSpec as v, MODEL_SCHEMA as w, GenerationParameterSpec as x, GenerationMetaTaskVariantSpec as y };
188
- //# sourceMappingURL=builtins-C-_aGhT8.d.ts.map
190
+ //# sourceMappingURL=builtins-CWEB_GK4.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtins-CWEB_GK4.d.ts","names":[],"sources":["../src/types.ts","../src/builtins.ts"],"sourcesContent":[],"mappings":";cAAa;AAAA,KAED,gBAAA,GAFmD;EAEnD,IAAA,EAAA,KAAA;EAEA,GAAA,EAAA,MAAA;AAEZ,CAAA,GAAY;EAC6B,IAAA,EAAA,QAAA;EACZ,SAAA,EAAA,MAAA;EAAyB,IAAA,EAAA,MAAA;CACzB;AA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SACrB;aACI;;aAEA;;;KAID,eAAA;;WAED;eACI;SACN;;aAEI;;;;KAKD,yBAAA;eACG;WACJ;cACG;QACN;;KAGI,wBAAA,YAAoC,qBAAqB;KAEzD,oBAAA;;;;WAKG;;;;;;;WAQA;SACF;;;;KAKD,qBAAA,WAAgC;KAEhC,sBAAA;;;;WAID;;KAGC,qBAAA,GAAwB;;;;UAI1B;;KAGE,wBAAA;;;gBAGI;iBACC;;KAGL,sBAAA,GAAyB;WAC1B;;KAGC,iBAAA,WAA4B,2BAA2B,QAAQ;KAE/D,6BAAA;;;WAGD;;iBAEM;mBACE;aACN,eAAe;oBACR;;KAGR,gBAAA;oBACQ,kBAAkB,QAAQ;oBAC1B,kBAAkB;gBACtB;2BACW;;;;sDAE2B;yCACb;;;;AAvL5B,cC+7BA,uBD/7BkD,EC+7BzB,0BD/7ByB,EAAA;AAEnD,iBC+7BI,yBAAA,CD/7BY,KAAA,EAAA,MAAA,CAAA,EC+7B8B,0BD/7B9B,GAAA,IAAA;AAEhB,iBCi8BI,2BAAA,CAAA,CDj8B+B,ECi8BA,0BDj8BA,EAAA"}
@@ -1097,20 +1097,37 @@ const builtinModels = [
1097
1097
  title: "Seedance 2.0",
1098
1098
  description: "Higher quality Ark video generation model for final production outputs.",
1099
1099
  adapter: { type: "ark.videoGenerations" },
1100
- content: { input: [{
1101
- type: "text",
1102
- required: true,
1103
- min: 1,
1104
- max: 16,
1105
- merge: "newline",
1106
- description: "Video prompt."
1107
- }, {
1108
- type: "image",
1109
- required: false,
1110
- max: 9,
1111
- sources: ["url", "base64"],
1112
- description: "Optional image input. Use meta.role as first_frame, last_frame, or reference_image."
1113
- }] },
1100
+ content: { input: [
1101
+ {
1102
+ type: "text",
1103
+ required: true,
1104
+ min: 1,
1105
+ max: 16,
1106
+ merge: "newline",
1107
+ description: "Video prompt."
1108
+ },
1109
+ {
1110
+ type: "image",
1111
+ required: false,
1112
+ max: 9,
1113
+ sources: ["url"],
1114
+ roles: [
1115
+ "first_frame",
1116
+ "last_frame",
1117
+ "reference_image"
1118
+ ],
1119
+ description: "Optional public URL image input. Use meta.role as first_frame, last_frame, or reference_image."
1120
+ },
1121
+ {
1122
+ type: "video",
1123
+ required: false,
1124
+ max: 1,
1125
+ sources: ["url"],
1126
+ roles: ["reference_video"],
1127
+ roleRequired: true,
1128
+ description: "Optional public URL reference video input. Use meta.role as reference_video."
1129
+ }
1130
+ ] },
1114
1131
  parameters: videoParameters({
1115
1132
  resolution: "1080p",
1116
1133
  maxWait: 900
@@ -1137,20 +1154,37 @@ const builtinModels = [
1137
1154
  title: "Seedance 2.0 Fast",
1138
1155
  description: "Fast Ark video generation model for drafts, rapid iteration, text-to-video, image-to-video, and reference-guided video generation.",
1139
1156
  adapter: { type: "ark.videoGenerations" },
1140
- content: { input: [{
1141
- type: "text",
1142
- required: true,
1143
- min: 1,
1144
- max: 16,
1145
- merge: "newline",
1146
- description: "Video prompt."
1147
- }, {
1148
- type: "image",
1149
- required: false,
1150
- max: 9,
1151
- sources: ["url", "base64"],
1152
- description: "Optional image input. Use meta.role as first_frame, last_frame, or reference_image."
1153
- }] },
1157
+ content: { input: [
1158
+ {
1159
+ type: "text",
1160
+ required: true,
1161
+ min: 1,
1162
+ max: 16,
1163
+ merge: "newline",
1164
+ description: "Video prompt."
1165
+ },
1166
+ {
1167
+ type: "image",
1168
+ required: false,
1169
+ max: 9,
1170
+ sources: ["url"],
1171
+ roles: [
1172
+ "first_frame",
1173
+ "last_frame",
1174
+ "reference_image"
1175
+ ],
1176
+ description: "Optional public URL image input. Use meta.role as first_frame, last_frame, or reference_image."
1177
+ },
1178
+ {
1179
+ type: "video",
1180
+ required: false,
1181
+ max: 1,
1182
+ sources: ["url"],
1183
+ roles: ["reference_video"],
1184
+ roleRequired: true,
1185
+ description: "Optional public URL reference video input. Use meta.role as reference_video."
1186
+ }
1187
+ ] },
1154
1188
  parameters: videoParameters({
1155
1189
  resolution: "720p",
1156
1190
  maxWait: 600
@@ -1183,4 +1217,4 @@ function listBuiltinGenerationModels() {
1183
1217
 
1184
1218
  //#endregion
1185
1219
  export { compactArray as a, slugifyFileName as c, cloneJson as i, MODEL_SCHEMA as l, getBuiltinGenerationModel as n, compactObject as o, listBuiltinGenerationModels as r, getBlockMeta as s, builtinGenerationModels as t };
1186
- //# sourceMappingURL=builtins-NAtI9FFU.js.map
1220
+ //# sourceMappingURL=builtins-CcfifHB4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtins-CcfifHB4.js","names":["parameters: GenerationModelDeclaration[\"parameters\"]","input: GenerationModelDeclaration[\"content\"][\"input\"]","builtinGenerationModels: GenerationModelDeclaration[]"],"sources":["../src/types.ts","../src/utils.ts","../src/builtins.ts"],"sourcesContent":["export const MODEL_SCHEMA = \"neta.generation.model.v1\" as const;\n\nexport type GenerationSource = { type: \"url\"; url: string } | { type: \"base64\"; mediaType: string; data: string };\n\nexport type GenerationContentBlockMeta = Record<string, unknown>;\n\nexport type GenerationContentBlock =\n | { type: \"text\"; text: string; meta?: GenerationContentBlockMeta }\n | { type: \"image\"; source: GenerationSource; meta?: GenerationContentBlockMeta }\n | { type: \"video\"; source: GenerationSource; meta?: GenerationContentBlockMeta }\n | { type: \"audio\"; source: GenerationSource; meta?: GenerationContentBlockMeta };\n\nexport type GenerationContentSpec = {\n type: \"text\" | \"image\" | \"video\" | \"audio\";\n required?: boolean;\n min?: number;\n max?: number;\n sources?: Array<GenerationSource[\"type\"]>;\n roles?: string[];\n roleRequired?: boolean;\n merge?: \"newline\" | \"space\" | \"concat\";\n meta?: Record<string, unknown>;\n description?: string;\n};\n\nexport type GenerationParameterSpec =\n | {\n type: \"string\";\n optional?: boolean;\n default?: string;\n enum?: string[];\n description?: string;\n examples?: string[];\n }\n | {\n type: \"number\";\n optional?: boolean;\n default?: number;\n min?: number;\n max?: number;\n description?: string;\n examples?: number[];\n }\n | {\n type: \"integer\";\n optional?: boolean;\n default?: number;\n min?: number;\n max?: number;\n description?: string;\n examples?: number[];\n }\n | {\n type: \"boolean\";\n optional?: boolean;\n default?: boolean;\n description?: string;\n examples?: boolean[];\n };\n\nexport type GenerationMetaFieldSpec =\n | GenerationParameterSpec\n | { type: \"object\"; optional?: boolean; description?: string };\n\nexport type GenerationMetaTaskVariantSpec = {\n description?: string;\n required?: string[];\n requiredContent?: Array<GenerationContentSpec[\"type\"]>;\n sendTask?: boolean;\n};\n\nexport type GenerationMetaSpec = {\n fields?: Record<string, GenerationMetaFieldSpec>;\n taskField?: string;\n taskVariants?: Record<string, GenerationMetaTaskVariantSpec>;\n};\n\nexport type GenerationModelDeclaration = {\n schema: typeof MODEL_SCHEMA;\n model: string;\n title?: string;\n description?: string;\n allowUnknownParameters?: boolean;\n adapter: {\n type: string;\n } & Record<string, unknown>;\n content: {\n input: GenerationContentSpec[];\n };\n parameters?: Record<string, GenerationParameterSpec>;\n meta?: GenerationMetaSpec;\n examples?: Array<{\n title?: string;\n request: GenerateRequest;\n }>;\n};\n\nexport type GenerateRequest = {\n model: string;\n content: GenerationContentBlock[];\n parameters?: Record<string, unknown>;\n meta?: Record<string, unknown>;\n /** @deprecated Use meta. */\n metadata?: Record<string, unknown>;\n apiKey?: string;\n baseUrl?: string;\n};\n\nexport type ResolvedGenerationRequest = {\n declaration: GenerationModelDeclaration;\n request: GenerateRequest;\n parameters: Record<string, unknown>;\n meta: Record<string, unknown>;\n};\n\nexport type GenerationSourceResolver = (source: GenerationSource) => Promise<string> | string;\n\nexport type GenerationDebugEvent =\n | {\n type: \"request\";\n url: string;\n method: string;\n headers: Record<string, string>;\n body?: unknown;\n }\n | {\n type: \"response\";\n url: string;\n status: number;\n statusText: string;\n headers: Record<string, string>;\n trace: Record<string, string>;\n elapsedMs: number;\n body?: unknown;\n };\n\nexport type GenerationDebugLogger = (event: GenerationDebugEvent) => void;\n\nexport type GenerationDebugOptions = {\n enabled?: boolean;\n includeSensitive?: boolean;\n includeResponseBody?: boolean;\n logger?: GenerationDebugLogger;\n};\n\nexport type GenerationDebugConfig = GenerationDebugOptions & {\n enabled: boolean;\n includeSensitive: boolean;\n includeResponseBody: boolean;\n logger: GenerationDebugLogger;\n};\n\nexport type GenerationAdapterContext = {\n apiKey: string;\n baseUrl: string;\n fetch: typeof fetch;\n resolveSource: GenerationSourceResolver;\n};\n\nexport type GenerationAdapterInput = ResolvedGenerationRequest & {\n context: GenerationAdapterContext;\n};\n\nexport type GenerationAdapter = (input: GenerationAdapterInput) => Promise<GenerationContentBlock[]>;\n\nexport type CreateGenerationClientOptions = {\n apiKey?: string;\n baseUrl?: string;\n models?: GenerationModelDeclaration[];\n includeBuiltinModels?: boolean;\n fetch?: typeof fetch;\n sourceResolver?: GenerationSourceResolver;\n adapters?: Record<string, GenerationAdapter>;\n debug?: boolean | GenerationDebugOptions;\n};\n\nexport type GenerationClient = {\n generate(request: GenerateRequest): Promise<GenerationContentBlock[]>;\n validate(request: GenerateRequest): ResolvedGenerationRequest;\n listModels(): GenerationModelDeclaration[];\n getModel(model: string): GenerationModelDeclaration | null;\n stringifyModelConfig(model: string, options?: { format?: \"yaml\" | \"json\" }): string;\n exportModelConfig(model: string, filePath: string): Promise<void>;\n exportModelConfigs(directory: string): Promise<void>;\n};\n","import type { GenerationContentBlock } from \"./types.js\";\n\nexport function cloneJson<T>(value: T): T {\n return JSON.parse(JSON.stringify(value)) as T;\n}\n\nexport function slugifyFileName(value: string): string {\n return (\n value\n .trim()\n .toLowerCase()\n .replace(/[^a-z0-9._-]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\") || \"model\"\n );\n}\n\nexport function getBlockMeta(block: GenerationContentBlock): Record<string, unknown> | undefined {\n return \"meta\" in block ? block.meta : undefined;\n}\n\nexport function compactArray<T>(values: T[]): T[] | undefined {\n return values.length > 0 ? values : undefined;\n}\n\nexport function compactObject<T extends Record<string, unknown>>(value: T): T {\n for (const key of Object.keys(value)) if (value[key] === undefined) delete value[key];\n return value;\n}\n","import type { GenerationModelDeclaration } from \"./types.js\";\nimport { MODEL_SCHEMA } from \"./types.js\";\nimport { cloneJson } from \"./utils.js\";\n\nconst imageSizeParameters = {\n size: {\n type: \"string\",\n optional: true,\n default: \"1024x1024\",\n description: \"Output image size.\",\n examples: [\"auto\", \"1024x1024\", \"1536x1024\", \"1024x1536\", \"2048x2048\", \"2048x1152\", \"3840x2160\", \"2160x3840\"],\n },\n quality: {\n type: \"string\",\n optional: true,\n default: \"auto\",\n enum: [\"auto\", \"low\", \"medium\", \"high\"],\n description: \"Image quality.\",\n },\n} satisfies GenerationModelDeclaration[\"parameters\"];\n\nconst zImageTurboParameters = {\n size: {\n type: \"string\",\n optional: true,\n default: \"1024*1024\",\n enum: [\"1024*1024\", \"1536*1024\", \"1024*1536\", \"2048*2048\"],\n description: \"Output image size.\",\n },\n} satisfies GenerationModelDeclaration[\"parameters\"];\n\nconst qwenImageEditParameters = {\n size: {\n type: \"string\",\n optional: true,\n default: \"1024x1024\",\n description: \"Output image size.\",\n examples: [\"1024x1024\", \"768x1024\", \"1024x768\"],\n },\n} satisfies GenerationModelDeclaration[\"parameters\"];\n\nconst noobxlImageParameters = {\n size: {\n type: \"string\",\n optional: true,\n default: \"1024x1024\",\n description: \"Output image size as WIDTHxHEIGHT.\",\n examples: [\"1024x1024\", \"768x1024\", \"1024x768\"],\n },\n negative_prompt: {\n type: \"string\",\n optional: true,\n description: \"Content to avoid in generated images.\",\n },\n seed: {\n type: \"integer\",\n optional: true,\n min: 0,\n description: \"Random seed for reproducibility.\",\n },\n} satisfies GenerationModelDeclaration[\"parameters\"];\n\nconst noobxlImageToImageParameters = {\n ...noobxlImageParameters,\n controlnet_weight: {\n type: \"number\",\n optional: true,\n min: 0,\n max: 2,\n description: \"ControlNet tile weight. The provider default is 0.8.\",\n },\n ipadapter_face_image_ref: {\n type: \"string\",\n optional: true,\n description: \"Optional face reference image URL for IP-Adapter.\",\n },\n ipadapter_face_weight: {\n type: \"number\",\n optional: true,\n min: 0,\n max: 2,\n description: \"IP-Adapter face weight. The provider default is 0.6 when a face reference is supplied.\",\n },\n} satisfies GenerationModelDeclaration[\"parameters\"];\n\nfunction videoParameters(defaults: { resolution: string; maxWait: number }) {\n return {\n duration: {\n type: \"integer\",\n optional: true,\n default: 5,\n min: 4,\n max: 15,\n description: \"Video duration in seconds.\",\n },\n resolution: {\n type: \"string\",\n optional: true,\n default: defaults.resolution,\n enum: [\"480p\", \"720p\", \"1080p\", \"2K\"],\n description: \"Output video resolution.\",\n },\n aspect_ratio: {\n type: \"string\",\n optional: true,\n default: \"16:9\",\n enum: [\"16:9\", \"9:16\", \"1:1\", \"4:3\", \"3:2\", \"2:3\", \"3:4\", \"21:9\", \"adaptive\"],\n description: \"Output aspect ratio. Use adaptive to let the model choose.\",\n },\n fps: { type: \"integer\", optional: true, default: 30, min: 1, max: 60, description: \"Frames per second.\" },\n seed: { type: \"integer\", optional: true, description: \"Random seed for reproducibility.\" },\n generate_audio: { type: \"boolean\", optional: true, default: true, description: \"Generate synchronized audio.\" },\n return_last_frame: {\n type: \"boolean\",\n optional: true,\n default: true,\n description: \"Return the last frame as an image for chaining video segments.\",\n },\n camera_fixed: {\n type: \"boolean\",\n optional: true,\n default: false,\n description: \"Fix camera position when supported.\",\n },\n watermark: { type: \"boolean\", optional: true, default: false, description: \"Add AI Generated watermark.\" },\n poll_interval: {\n type: \"integer\",\n optional: true,\n default: 2,\n min: 1,\n max: 30,\n description: \"Seconds between task status checks.\",\n },\n max_wait: {\n type: \"integer\",\n optional: true,\n default: defaults.maxWait,\n min: 30,\n max: 1800,\n description: \"Maximum seconds to wait for task completion.\",\n },\n } satisfies GenerationModelDeclaration[\"parameters\"];\n}\n\nfunction klingVideoParameters(options: {\n maxDuration: number;\n negativePrompt?: boolean;\n seed?: boolean;\n sound?: boolean;\n}) {\n const parameters: GenerationModelDeclaration[\"parameters\"] = {\n duration: {\n type: \"integer\",\n optional: true,\n default: 5,\n min: 5,\n max: options.maxDuration,\n description: \"Video duration in seconds.\",\n },\n aspect_ratio: {\n type: \"string\",\n optional: true,\n default: \"16:9\",\n enum: [\"16:9\", \"9:16\", \"1:1\"],\n description: \"Output aspect ratio.\",\n },\n mode: {\n type: \"string\",\n optional: true,\n default: \"std\",\n enum: [\"std\", \"pro\"],\n description: \"Kling generation mode.\",\n },\n cfg_scale: {\n type: \"number\",\n optional: true,\n default: 0.5,\n min: 0,\n max: 1,\n description: \"Prompt adherence scale.\",\n },\n poll_interval: {\n type: \"integer\",\n optional: true,\n default: 5,\n min: 1,\n max: 30,\n description: \"Seconds between task status checks.\",\n },\n max_wait: {\n type: \"integer\",\n optional: true,\n default: 900,\n min: 30,\n max: 1800,\n description: \"Maximum seconds to wait for task completion.\",\n },\n };\n if (options.negativePrompt) {\n parameters.negative_prompt = {\n type: \"string\",\n optional: true,\n description: \"Negative prompt.\",\n };\n }\n if (options.seed) {\n parameters.seed = {\n type: \"integer\",\n optional: true,\n description: \"Random seed for reproducibility.\",\n };\n }\n if (options.sound) {\n parameters.sound = {\n type: \"string\",\n optional: true,\n enum: [\"on\", \"off\"],\n description: \"Enable or disable generated sound when supported.\",\n };\n }\n return parameters;\n}\n\nconst sunoTaskParameters = {\n poll_interval: {\n type: \"integer\",\n optional: true,\n default: 5,\n min: 1,\n max: 60,\n description: \"Seconds between task status checks.\",\n },\n max_wait: {\n type: \"integer\",\n optional: true,\n default: 600,\n min: 30,\n max: 3600,\n description: \"Maximum seconds to wait for task completion.\",\n },\n} satisfies GenerationModelDeclaration[\"parameters\"];\n\nconst sunoCommonMetaFields = {\n title: { type: \"string\", optional: true, description: \"Suno song title.\" },\n tags: { type: \"string\", optional: true, description: \"Comma-separated Suno music style tags.\" },\n gpt_description_prompt: { type: \"string\", optional: true, description: \"Suno inspiration-mode prompt.\" },\n negative_tags: { type: \"string\", optional: true, description: \"Styles to avoid.\" },\n generation_type: { type: \"string\", optional: true, description: \"Suno generation type.\" },\n make_instrumental: { type: \"boolean\", optional: true, default: false, description: \"Generate instrumental music.\" },\n metadata: { type: \"object\", optional: true, description: \"Suno provider metadata payload.\" },\n metadata_params: {\n type: \"object\",\n optional: true,\n description: \"Suno task-specific metadata payload.\",\n },\n} satisfies NonNullable<GenerationModelDeclaration[\"meta\"]>[\"fields\"];\n\nconst sunoTaskVariants = {\n extend: { required: [\"continue_clip_id\"] },\n upload_extend: { required: [\"continue_clip_id\"] },\n infill: { required: [\"continue_clip_id\", \"metadata_params\"] },\n fixed_infill: { required: [\"continue_clip_id\", \"metadata_params\"] },\n infill_intro: { required: [\"continue_clip_id\", \"metadata_params\"] },\n infill_outro: { required: [\"continue_clip_id\", \"metadata_params\"] },\n cover_infill: { required: [\"continue_clip_id\", \"metadata_params\"] },\n cover_extend: { required: [\"continue_clip_id\"] },\n artist_infill: { required: [\"continue_clip_id\", \"metadata_params\"] },\n artist_consistency: { required: [\"persona_id\", \"artist_clip_id\"] },\n cover: { required: [\"task_id\", \"continue_clip_id\"] },\n image_to_song: { requiredContent: [\"image\"], required: [\"metadata_params\"] },\n video_to_song: { requiredContent: [\"video\"], required: [\"metadata_params\"] },\n concat: { required: [\"clip_id\"] },\n sound: { required: [\"metadata_params\"] },\n underpainting: { required: [\"metadata_params\"] },\n overpainting: { required: [\"metadata_params\"] },\n remaster: { required: [\"metadata_params\"] },\n vox: { required: [\"artist_clip_id\"] },\n chop_sample_condition: { required: [\"metadata_params\"] },\n mashup_condition: { required: [\"metadata_params\"] },\n playlist_condition: { required: [\"metadata_params\"] },\n} satisfies NonNullable<GenerationModelDeclaration[\"meta\"]>[\"taskVariants\"];\n\nfunction sunoContentInput(\n options: { text?: \"required\" | \"optional\" | \"none\"; audio?: boolean; image?: boolean; video?: boolean } = {},\n): GenerationModelDeclaration[\"content\"][\"input\"] {\n const input: GenerationModelDeclaration[\"content\"][\"input\"] = [];\n if (options.text !== \"none\") {\n input.push({\n type: \"text\",\n required: options.text === \"required\",\n max: 16,\n merge: \"newline\",\n description:\n \"Prompt text. The adapter maps merged text to the operation's text field when that field is not provided.\",\n });\n }\n if (options.audio) {\n input.push({\n type: \"audio\",\n required: true,\n max: 1,\n sources: [\"url\", \"base64\"],\n description: \"Reference audio.\",\n });\n }\n if (options.image) {\n input.push({\n type: \"image\",\n required: true,\n max: 1,\n sources: [\"url\", \"base64\"],\n description: \"Reference image.\",\n });\n }\n if (options.video) {\n input.push({\n type: \"video\",\n required: true,\n max: 1,\n sources: [\"url\", \"base64\"],\n description: \"Reference video.\",\n });\n }\n return input;\n}\n\nconst sunoVersions = [\n { model: \"suno_music_chirp_fenix\", title: \"Suno Music Chirp Fenix v5.5\", mv: \"chirp-fenix\" },\n] as const;\n\nconst sunoMusicExample = {\n title: \"Music generation\",\n request: {\n model: \"suno_music_chirp_fenix\",\n content: [{ type: \"text\", text: \"uplifting cinematic pop with warm piano and clear chorus\" }],\n meta: {\n title: \"Warm Horizon\",\n tags: \"cinematic pop, warm piano\",\n make_instrumental: false,\n },\n },\n} satisfies NonNullable<GenerationModelDeclaration[\"examples\"]>[number];\n\nfunction sunoVersionModel(version: (typeof sunoVersions)[number]): GenerationModelDeclaration {\n return {\n schema: MODEL_SCHEMA,\n model: version.model,\n title: version.title,\n description: \"Suno text-to-music model with a fixed Suno model version.\",\n adapter: { type: \"suno.tasks\", operation: \"music\", payload: { mv: version.mv } },\n content: {\n input: sunoContentInput({ text: \"required\" }),\n },\n parameters: sunoTaskParameters,\n meta: {\n fields: sunoCommonMetaFields,\n },\n ...(version.model === \"suno_music_chirp_fenix\" ? { examples: [sunoMusicExample] } : {}),\n };\n}\n\nfunction sunoTaskModel(options: {\n model: string;\n title: string;\n description: string;\n task: string;\n mv?: string;\n content?: Parameters<typeof sunoContentInput>[0];\n fields?: NonNullable<GenerationModelDeclaration[\"meta\"]>[\"fields\"];\n examples?: GenerationModelDeclaration[\"examples\"];\n}): GenerationModelDeclaration {\n return {\n schema: MODEL_SCHEMA,\n model: options.model,\n title: options.title,\n description: options.description,\n adapter: {\n type: \"suno.tasks\",\n operation: \"music\",\n task: options.task,\n payload: { mv: options.mv ?? \"chirp-v5\" },\n },\n content: {\n input: sunoContentInput(options.content ?? { text: \"optional\" }),\n },\n parameters: sunoTaskParameters,\n meta: {\n fields: {\n ...sunoCommonMetaFields,\n ...options.fields,\n },\n taskVariants: sunoTaskVariants,\n },\n ...(options.examples ? { examples: options.examples } : {}),\n };\n}\n\nconst sunoModels = [\n ...sunoVersions.map(sunoVersionModel),\n {\n schema: MODEL_SCHEMA,\n model: \"suno_style_tags\",\n title: \"Suno Style Tags\",\n description: \"Suno style tag upsampling model.\",\n adapter: { type: \"suno.tasks\", operation: \"upsample_tags\" },\n content: {\n input: sunoContentInput({ text: \"required\" }),\n },\n },\n {\n schema: MODEL_SCHEMA,\n model: \"suno_upload_audio\",\n title: \"Suno Upload Audio\",\n description: \"Suno reference-audio upload model.\",\n adapter: { type: \"suno.tasks\", operation: \"upload_audio\", defaults: { name: \"reference-audio\", timeout: 120 } },\n content: {\n input: sunoContentInput({ text: \"none\", audio: true }),\n },\n parameters: sunoTaskParameters,\n meta: {\n fields: {\n name: { type: \"string\", optional: true, description: \"Upload name.\" },\n timeout: { type: \"integer\", optional: true, description: \"Upload timeout in seconds.\" },\n },\n },\n },\n sunoTaskModel({\n model: \"suno_image_to_song_chirp_v5\",\n title: \"Suno Image to Song Chirp v5.0\",\n description: \"Suno image-to-song task with a fixed chirp-v5 engine.\",\n task: \"image_to_song\",\n content: { text: \"optional\", image: true },\n fields: {\n metadata_params: { type: \"object\", description: \"Image-to-song metadata payload.\" },\n },\n }),\n sunoTaskModel({\n model: \"suno_video_to_song_chirp_v5\",\n title: \"Suno Video to Song Chirp v5.0\",\n description: \"Suno video-to-song task with a fixed chirp-v5 engine.\",\n task: \"video_to_song\",\n content: { text: \"optional\", video: true },\n fields: {\n metadata_params: { type: \"object\", description: \"Video-to-song metadata payload.\" },\n },\n }),\n sunoTaskModel({\n model: \"suno_sound_chirp_v5\",\n title: \"Suno Sound Chirp v5.0\",\n description: \"Suno sound-effect generation task with a fixed chirp-v5 engine.\",\n task: \"sound\",\n content: { text: \"optional\" },\n fields: {\n metadata_params: { type: \"object\", description: \"Sound task metadata payload.\" },\n },\n }),\n sunoTaskModel({\n model: \"suno_cover_chirp_v5\",\n title: \"Suno Cover Chirp v5.0\",\n description: \"Suno cover task with a fixed chirp-v5 engine.\",\n task: \"cover\",\n content: { text: \"optional\" },\n fields: {\n cover_clip_id: { type: \"string\", description: \"Clip id to cover.\" },\n task_id: { type: \"string\", description: \"Source Suno task id used for cover routing.\" },\n continue_clip_id: { type: \"string\", description: \"Source clip id used for cover generation.\" },\n continue_at: { type: \"number\", optional: true, description: \"Source clip continuation position in seconds.\" },\n },\n }),\n sunoTaskModel({\n model: \"suno_infill_chirp_v5\",\n title: \"Suno Infill Chirp v5.0\",\n description: \"Suno local edit task with a fixed chirp-v5 engine.\",\n task: \"infill\",\n content: { text: \"optional\" },\n fields: {\n continue_clip_id: { type: \"string\", description: \"Clip id to edit.\" },\n metadata_params: { type: \"object\", description: \"Infill timing and replacement metadata.\" },\n },\n }),\n sunoTaskModel({\n model: \"suno_vox_chirp_v5\",\n title: \"Suno Vox Chirp v5.0\",\n description: \"Suno hum-to-song task with a fixed chirp-v5 engine.\",\n task: \"vox\",\n content: { text: \"optional\" },\n fields: {\n artist_clip_id: { type: \"string\", description: \"Reference hum or vocal clip id.\" },\n },\n }),\n] satisfies GenerationModelDeclaration[];\n\nconst builtinModels = [\n {\n schema: MODEL_SCHEMA,\n model: \"gpt-image-2\",\n title: \"GPT Image 2\",\n description:\n \"Image generation model with optional reference images. Good for photorealistic scenes, detailed images, and image editing with references.\",\n adapter: { type: \"openai.images\" },\n content: {\n input: [\n { type: \"text\", required: true, min: 1, max: 16, merge: \"newline\", description: \"Prompt text.\" },\n {\n type: \"image\",\n required: false,\n max: 16,\n sources: [\"url\", \"base64\"],\n description: \"Optional reference images.\",\n },\n ],\n },\n parameters: imageSizeParameters,\n examples: [\n {\n title: \"Basic image\",\n request: {\n model: \"gpt-image-2\",\n content: [{ type: \"text\", text: \"a cyberpunk cat in neon rain\" }],\n parameters: { size: \"1024x1024\", quality: \"auto\" },\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"z-image-turbo\",\n title: \"Z-Image Turbo\",\n description:\n \"Fast text-to-image generation through Neta Router. Z-Image Turbo accepts prompt text only; it does not support reference images.\",\n adapter: { type: \"openai.images\" },\n content: {\n input: [{ type: \"text\", required: true, min: 1, max: 16, merge: \"newline\", description: \"Prompt text.\" }],\n },\n parameters: zImageTurboParameters,\n examples: [\n {\n title: \"Text to image\",\n request: {\n model: \"z-image-turbo\",\n content: [\n { type: \"text\", text: \"a clean product-style image of a small red toy robot standing on a white desk\" },\n ],\n parameters: { size: \"1024*1024\" },\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"qwen-image-edit\",\n title: \"Qwen Image Edit\",\n description: \"Neta Qwen image editing with one source image URL and an edit instruction.\",\n adapter: { type: \"openai.imageEdits\" },\n content: {\n input: [\n { type: \"text\", required: true, min: 1, max: 16, merge: \"newline\", description: \"Edit instruction.\" },\n {\n type: \"image\",\n required: true,\n min: 1,\n max: 1,\n sources: [\"url\"],\n description: \"Source image URL to edit.\",\n },\n ],\n },\n parameters: qwenImageEditParameters,\n examples: [\n {\n title: \"Edit image\",\n request: {\n model: \"qwen-image-edit\",\n content: [\n { type: \"text\", text: \"change the background to a clean white studio backdrop\" },\n { type: \"image\", source: { type: \"url\", url: \"https://example.com/input.png\" } },\n ],\n parameters: { size: \"1024x1024\" },\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"gemini-3.1-flash-image-preview\",\n title: \"Gemini 3.1 Flash Image Preview\",\n description:\n \"Gemini image generation and editing model. Good for text rendering, infographics, style transfer, and iterative image editing with references.\",\n adapter: { type: \"gemini.generateContent\" },\n content: {\n input: [\n { type: \"text\", required: true, min: 1, max: 16, merge: \"newline\", description: \"Prompt text.\" },\n {\n type: \"image\",\n required: false,\n max: 14,\n sources: [\"url\", \"base64\"],\n description: \"Optional reference images.\",\n },\n ],\n },\n parameters: {\n aspect_ratio: {\n type: \"string\",\n optional: true,\n default: \"1:1\",\n enum: [\"1:1\", \"16:9\", \"4:3\", \"3:2\", \"3:4\", \"2:3\", \"9:16\", \"5:4\", \"4:5\", \"21:9\", \"1:4\", \"4:1\", \"1:8\", \"8:1\"],\n description: \"Output aspect ratio.\",\n },\n image_size: {\n type: \"string\",\n optional: true,\n default: \"2K\",\n enum: [\"512\", \"1K\", \"2K\", \"4K\"],\n description: \"Output image resolution.\",\n },\n },\n examples: [\n {\n title: \"Basic image\",\n request: {\n model: \"gemini-3.1-flash-image-preview\",\n content: [\n { type: \"text\", text: \"a vibrant infographic explaining photosynthesis with clear readable labels\" },\n ],\n parameters: { aspect_ratio: \"16:9\", image_size: \"1K\" },\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"kling-text-to-video\",\n title: \"Kling Text To Video\",\n description: \"Kling latest text-to-video generation through Neta Router.\",\n adapter: { type: \"kling.videoGenerations\" },\n content: {\n input: [{ type: \"text\", required: true, min: 1, max: 16, merge: \"newline\", description: \"Video prompt.\" }],\n },\n parameters: klingVideoParameters({ maxDuration: 10, negativePrompt: true, seed: true }),\n examples: [\n {\n title: \"Text to video\",\n request: {\n model: \"kling-text-to-video\",\n content: [{ type: \"text\", text: \"a small paper boat floating on calm water, cinematic motion\" }],\n parameters: { duration: 5, aspect_ratio: \"16:9\", mode: \"std\" },\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"kling-image-to-video\",\n title: \"Kling Image To Video\",\n description: \"Kling latest image-to-video generation through Neta Router.\",\n adapter: { type: \"kling.videoGenerations\" },\n content: {\n input: [\n { type: \"text\", required: true, min: 1, max: 16, merge: \"newline\", description: \"Video prompt.\" },\n {\n type: \"image\",\n required: false,\n max: 2,\n sources: [\"url\", \"base64\"],\n description:\n \"First frame and optional tail frame image input. Provider-native image input may be passed in meta.\",\n },\n ],\n },\n parameters: klingVideoParameters({ maxDuration: 10, negativePrompt: true, seed: true }),\n examples: [\n {\n title: \"Image to video\",\n request: {\n model: \"kling-image-to-video\",\n content: [\n { type: \"text\", text: \"gently turn toward the camera with soft natural motion\" },\n { type: \"image\", source: { type: \"url\", url: \"https://example.com/input.png\" } },\n ],\n parameters: { duration: 5, aspect_ratio: \"16:9\" },\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"kling-omni-video\",\n title: \"Kling Omni Video\",\n description: \"Kling latest Omni-Video generation through Neta Router.\",\n adapter: { type: \"kling.videoGenerations\" },\n content: {\n input: [\n {\n type: \"text\",\n required: false,\n max: 16,\n merge: \"newline\",\n description: \"Optional video prompt. Use Kling Omni placeholders such as <<<image_1>>> with image_list.\",\n },\n {\n type: \"image\",\n required: false,\n max: 2,\n sources: [\"url\", \"base64\"],\n description: \"Optional simple image input. Provider-native Omni media arrays belong in request meta.\",\n },\n ],\n },\n parameters: klingVideoParameters({ maxDuration: 15, sound: true }),\n meta: {\n fields: {\n multi_shot: {\n type: \"boolean\",\n optional: true,\n description: \"Enable Kling Omni multi-shot mode.\",\n },\n shot_type: {\n type: \"string\",\n optional: true,\n description: \"Kling Omni shot type.\",\n },\n },\n },\n examples: [\n {\n title: \"Omni text to video\",\n request: {\n model: \"kling-omni-video\",\n content: [{ type: \"text\", text: \"a small paper boat floating on calm water, cinematic motion\" }],\n parameters: { duration: 5, aspect_ratio: \"16:9\", mode: \"std\" },\n },\n },\n {\n title: \"Omni image to video\",\n request: {\n model: \"kling-omni-video\",\n content: [{ type: \"text\", text: \"<<<image_1>>> gently turns toward the camera with soft natural motion\" }],\n parameters: { duration: 5, aspect_ratio: \"16:9\" },\n meta: {\n image_list: [{ image_url: \"https://example.com/input.png\", type: \"first_frame\" }],\n },\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"kling-multi-image-to-video\",\n title: \"Kling Multi-Image Reference To Video\",\n description: \"Kling latest multi-image reference video generation through Neta Router.\",\n adapter: { type: \"kling.videoGenerations\" },\n content: {\n input: [\n { type: \"text\", required: true, min: 1, max: 16, merge: \"newline\", description: \"Video prompt.\" },\n {\n type: \"image\",\n required: false,\n max: 4,\n sources: [\"url\", \"base64\"],\n description: \"Reference image inputs. Provider-native image_list input may be passed in meta.\",\n },\n ],\n },\n parameters: klingVideoParameters({ maxDuration: 10, negativePrompt: true, seed: true }),\n examples: [\n {\n title: \"Multi-image reference to video\",\n request: {\n model: \"kling-multi-image-to-video\",\n content: [\n { type: \"text\", text: \"combine the references into one cinematic shot\" },\n { type: \"image\", source: { type: \"url\", url: \"https://example.com/reference-1.png\" } },\n { type: \"image\", source: { type: \"url\", url: \"https://example.com/reference-2.png\" } },\n ],\n parameters: { duration: 5, aspect_ratio: \"16:9\" },\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"noobxl-t2i-onediff\",\n title: \"NoobXL T2I OneDiff\",\n description: \"NoobXL text-to-image model.\",\n allowUnknownParameters: true,\n adapter: { type: \"openai.images\" },\n content: {\n input: [{ type: \"text\", required: true, min: 1, max: 16, merge: \"newline\", description: \"Prompt text.\" }],\n },\n parameters: noobxlImageParameters,\n examples: [\n {\n title: \"Text to image\",\n request: {\n model: \"noobxl-t2i-onediff\",\n content: [{ type: \"text\", text: \"anime key visual, luminous city at night, crisp linework\" }],\n parameters: { size: \"1024x1024\", negative_prompt: \"low quality, blurry\" },\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"noobxl-i2i-ipa-onediff\",\n title: \"NoobXL I2I IPA OneDiff\",\n description: \"NoobXL image-to-image model with optional face reference controls.\",\n allowUnknownParameters: true,\n adapter: { type: \"openai.images\" },\n content: {\n input: [\n { type: \"text\", required: true, min: 1, max: 16, merge: \"newline\", description: \"Prompt text.\" },\n {\n type: \"image\",\n required: true,\n min: 1,\n max: 1,\n sources: [\"url\", \"base64\"],\n description: \"Single source image.\",\n },\n ],\n },\n parameters: noobxlImageToImageParameters,\n examples: [\n {\n title: \"Image to image\",\n request: {\n model: \"noobxl-i2i-ipa-onediff\",\n content: [\n { type: \"text\", text: \"keep the character identity, redraw as a polished anime illustration\" },\n { type: \"image\", source: { type: \"url\", url: \"https://example.com/reference.png\" } },\n ],\n parameters: { size: \"1024x1024\", controlnet_weight: 0.8 },\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"birefnet-general\",\n title: \"BiRefNet General\",\n description: \"BiRefNet single-image segmentation and background removal model.\",\n adapter: { type: \"openai.images\" },\n content: {\n input: [\n {\n type: \"image\",\n required: true,\n min: 1,\n max: 1,\n sources: [\"url\", \"base64\"],\n description: \"Single source image.\",\n },\n ],\n },\n examples: [\n {\n title: \"Remove background\",\n request: {\n model: \"birefnet-general\",\n content: [{ type: \"image\", source: { type: \"url\", url: \"https://example.com/portrait.png\" } }],\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"seedance-2-0\",\n title: \"Seedance 2.0\",\n description: \"Higher quality Ark video generation model for final production outputs.\",\n adapter: { type: \"ark.videoGenerations\" },\n content: {\n input: [\n { type: \"text\", required: true, min: 1, max: 16, merge: \"newline\", description: \"Video prompt.\" },\n {\n type: \"image\",\n required: false,\n max: 9,\n sources: [\"url\"],\n roles: [\"first_frame\", \"last_frame\", \"reference_image\"],\n description: \"Optional public URL image input. Use meta.role as first_frame, last_frame, or reference_image.\",\n },\n {\n type: \"video\",\n required: false,\n max: 1,\n sources: [\"url\"],\n roles: [\"reference_video\"],\n roleRequired: true,\n description: \"Optional public URL reference video input. Use meta.role as reference_video.\",\n },\n ],\n },\n parameters: videoParameters({ resolution: \"1080p\", maxWait: 900 }),\n examples: [\n {\n title: \"Text to video\",\n request: {\n model: \"seedance-2-0\",\n content: [\n {\n type: \"text\",\n text: \"a cat playing piano in a cozy jazz club, cinematic lighting, smooth camera movement\",\n },\n ],\n parameters: { duration: 5, resolution: \"1080p\", aspect_ratio: \"16:9\" },\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"seedance-2-0-fast\",\n title: \"Seedance 2.0 Fast\",\n description:\n \"Fast Ark video generation model for drafts, rapid iteration, text-to-video, image-to-video, and reference-guided video generation.\",\n adapter: { type: \"ark.videoGenerations\" },\n content: {\n input: [\n { type: \"text\", required: true, min: 1, max: 16, merge: \"newline\", description: \"Video prompt.\" },\n {\n type: \"image\",\n required: false,\n max: 9,\n sources: [\"url\"],\n roles: [\"first_frame\", \"last_frame\", \"reference_image\"],\n description: \"Optional public URL image input. Use meta.role as first_frame, last_frame, or reference_image.\",\n },\n {\n type: \"video\",\n required: false,\n max: 1,\n sources: [\"url\"],\n roles: [\"reference_video\"],\n roleRequired: true,\n description: \"Optional public URL reference video input. Use meta.role as reference_video.\",\n },\n ],\n },\n parameters: videoParameters({ resolution: \"720p\", maxWait: 600 }),\n examples: [\n {\n title: \"Text to video\",\n request: {\n model: \"seedance-2-0-fast\",\n content: [\n {\n type: \"text\",\n text: \"a cat playing piano in a cozy jazz club, cinematic lighting, smooth camera movement\",\n },\n ],\n parameters: { duration: 5, resolution: \"720p\", aspect_ratio: \"16:9\" },\n },\n },\n ],\n },\n ...sunoModels,\n] satisfies GenerationModelDeclaration[];\n\nexport const builtinGenerationModels: GenerationModelDeclaration[] = cloneJson(builtinModels);\n\nexport function getBuiltinGenerationModel(model: string): GenerationModelDeclaration | null {\n return cloneJson(builtinModels.find((declaration) => declaration.model === model) ?? null);\n}\n\nexport function listBuiltinGenerationModels(): GenerationModelDeclaration[] {\n return cloneJson(builtinModels);\n}\n"],"mappings":";AAAA,MAAa,eAAe;;;;ACE5B,SAAgB,UAAa,OAAa;AACxC,QAAO,KAAK,MAAM,KAAK,UAAU,MAAM,CAAC;;AAG1C,SAAgB,gBAAgB,OAAuB;AACrD,QACE,MACG,MAAM,CACN,aAAa,CACb,QAAQ,kBAAkB,IAAI,CAC9B,QAAQ,YAAY,GAAG,IAAI;;AAIlC,SAAgB,aAAa,OAAoE;AAC/F,QAAO,UAAU,QAAQ,MAAM,OAAO;;AAGxC,SAAgB,aAAgB,QAA8B;AAC5D,QAAO,OAAO,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;EACP,OAAO;EACP,aACE;EACF,SAAS,EAAE,MAAM,wBAAwB;EACzC,SAAS,EACP,OAAO;GACL;IAAE,MAAM;IAAQ,UAAU;IAAM,KAAK;IAAG,KAAK;IAAI,OAAO;IAAW,aAAa;IAAiB;GACjG;IACE,MAAM;IACN,UAAU;IACV,KAAK;IACL,SAAS,CAAC,MAAM;IAChB,OAAO;KAAC;KAAe;KAAc;KAAkB;IACvD,aAAa;IACd;GACD;IACE,MAAM;IACN,UAAU;IACV,KAAK;IACL,SAAS,CAAC,MAAM;IAChB,OAAO,CAAC,kBAAkB;IAC1B,cAAc;IACd,aAAa;IACd;GACF,EACF;EACD,YAAY,gBAAgB;GAAE,YAAY;GAAQ,SAAS;GAAK,CAAC;EACjE,UAAU,CACR;GACE,OAAO;GACP,SAAS;IACP,OAAO;IACP,SAAS,CACP;KACE,MAAM;KACN,MAAM;KACP,CACF;IACD,YAAY;KAAE,UAAU;KAAG,YAAY;KAAQ,cAAc;KAAQ;IACtE;GACF,CACF;EACF;CACD,GAAG;CACJ;AAED,MAAaC,0BAAwD,UAAU,cAAc;AAE7F,SAAgB,0BAA0B,OAAkD;AAC1F,QAAO,UAAU,cAAc,MAAM,gBAAgB,YAAY,UAAU,MAAM,IAAI,KAAK;;AAG5F,SAAgB,8BAA4D;AAC1E,QAAO,UAAU,cAAc"}
@@ -1,2 +1,2 @@
1
- import { n as getBuiltinGenerationModel, r as listBuiltinGenerationModels, t as builtinGenerationModels } from "./builtins-C-_aGhT8.js";
1
+ import { n as getBuiltinGenerationModel, r as listBuiltinGenerationModels, t as builtinGenerationModels } from "./builtins-CWEB_GK4.js";
2
2
  export { builtinGenerationModels, getBuiltinGenerationModel, listBuiltinGenerationModels };
package/dist/builtins.js CHANGED
@@ -1,3 +1,3 @@
1
- import { n as getBuiltinGenerationModel, r as listBuiltinGenerationModels, t as builtinGenerationModels } from "./builtins-NAtI9FFU.js";
1
+ import { n as getBuiltinGenerationModel, r as listBuiltinGenerationModels, t as builtinGenerationModels } from "./builtins-CcfifHB4.js";
2
2
 
3
3
  export { builtinGenerationModels, getBuiltinGenerationModel, listBuiltinGenerationModels };
package/dist/cli/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { r as listBuiltinGenerationModels } from "../builtins-NAtI9FFU.js";
3
- import { h as stringifyGenerationModelDeclaration, i as createGenerationClient, n as exportBuiltinModelConfigs, t as exportBuiltinModelConfig } from "../export-config-DvBXBq-8.js";
2
+ import { r as listBuiltinGenerationModels } from "../builtins-CcfifHB4.js";
3
+ import { h as stringifyGenerationModelDeclaration, i as createGenerationClient, n as exportBuiltinModelConfigs, t as exportBuiltinModelConfig } from "../export-config--lWA-0gu.js";
4
4
  import { mkdir, writeFile } from "node:fs/promises";
5
5
  import { dirname, join } from "node:path";
6
6
 
@@ -1,4 +1,4 @@
1
- import { a as compactArray, c as slugifyFileName, i as cloneJson, l as MODEL_SCHEMA, n as getBuiltinGenerationModel, o as compactObject, r as listBuiltinGenerationModels, s as getBlockMeta, t as builtinGenerationModels } from "./builtins-NAtI9FFU.js";
1
+ import { a as compactArray, c as slugifyFileName, i as cloneJson, l as MODEL_SCHEMA, n as getBuiltinGenerationModel, o as compactObject, r as listBuiltinGenerationModels, s as getBlockMeta, t as builtinGenerationModels } from "./builtins-CcfifHB4.js";
2
2
  import { mkdir, readFile, readdir, writeFile } from "node:fs/promises";
3
3
  import { extname, join } from "node:path";
4
4
  import { parse, stringify } from "yaml";
@@ -142,6 +142,9 @@ function specsByType(specs) {
142
142
  for (const spec of specs) map.set(spec.type, spec);
143
143
  return map;
144
144
  }
145
+ function getRole(block) {
146
+ return block.meta?.role;
147
+ }
145
148
  function validateGenerationContent(declaration, content) {
146
149
  const inputSpecs = specsByType(declaration.content.input);
147
150
  const counts = /* @__PURE__ */ new Map();
@@ -150,6 +153,11 @@ function validateGenerationContent(declaration, content) {
150
153
  if (!spec) throw new GenerationValidationError(`Content block type is not supported by ${declaration.model}: ${block.type}`);
151
154
  counts.set(block.type, (counts.get(block.type) ?? 0) + 1);
152
155
  if ("source" in block && spec.sources && !spec.sources.includes(block.source.type)) throw new GenerationValidationError(`${block.type} source is not supported by ${declaration.model}: ${block.source.type}`);
156
+ const role = getRole(block);
157
+ if (spec.roleRequired && (typeof role !== "string" || role.length === 0)) throw new GenerationValidationError(`${block.type} role is required by ${declaration.model}`);
158
+ if (role !== void 0 && spec.roles) {
159
+ if (typeof role !== "string" || role.length === 0 || !spec.roles.includes(role)) throw new GenerationValidationError(`${block.type} role is not supported by ${declaration.model}: ${String(role)}`);
160
+ }
153
161
  }
154
162
  for (const spec of declaration.content.input) {
155
163
  const count = counts.get(spec.type) ?? 0;
@@ -304,39 +312,73 @@ function resolveSize(resolution, aspectRatio) {
304
312
  height: height % 2 === 0 ? height : height + 1
305
313
  };
306
314
  }
307
- function getImageRole$1(block) {
315
+ function getMediaRole(block) {
308
316
  const role = getBlockMeta(block)?.role;
309
317
  return typeof role === "string" && role ? role : void 0;
310
318
  }
311
- function classifyImages(images) {
312
- if (images.length === 0) return null;
313
- const hasFirstOrLast = images.some((image) => image.role === "first_frame" || image.role === "last_frame");
314
- const hasReference = images.some((image) => image.role === "reference_image");
319
+ function isFrameImage(item) {
320
+ return item.kind === "image" && (item.role === "first_frame" || item.role === "last_frame");
321
+ }
322
+ function isReferenceMedia(item) {
323
+ return item.kind === "image" && item.role === "reference_image" || item.kind === "video" && item.role === "reference_video";
324
+ }
325
+ function assertSingleRole(media, role, message) {
326
+ if (media.filter((item) => item.role === role).length > 1) throw new GenerationValidationError(message);
327
+ }
328
+ function classifyMedia(media) {
329
+ if (media.length === 0) return null;
330
+ for (const item of media) {
331
+ if (item.kind === "image" && item.role && item.role !== "first_frame" && item.role !== "last_frame" && item.role !== "reference_image") throw new GenerationValidationError("Image input must use meta.role first_frame, last_frame, or reference_image");
332
+ if (item.kind === "video" && item.role !== "reference_video") throw new GenerationValidationError("Video input must use meta.role reference_video");
333
+ }
334
+ const hasFrame = media.some(isFrameImage);
335
+ const hasReference = media.some(isReferenceMedia);
336
+ const hasPlain = media.some((item) => item.kind === "image" && !item.role);
315
337
  if ([
316
- images.some((image) => !image.role),
317
- hasFirstOrLast,
338
+ hasPlain,
339
+ hasFrame,
318
340
  hasReference
319
- ].filter(Boolean).length > 1) throw new GenerationValidationError("Cannot mix video image modes: use only plain image, first_frame/last_frame, or reference_image");
320
- if (hasReference) return "reference";
321
- if (hasFirstOrLast) return "frame";
322
- return "image";
323
- }
324
- function buildMetadataContent(prompt, images, mode) {
325
- const content = [{
326
- type: "text",
327
- text: prompt
328
- }];
329
- for (const image of images) {
330
- if (mode === "frame" && image.role !== "first_frame" && image.role !== "last_frame") throw new GenerationValidationError("Frame mode images must use meta.role first_frame or last_frame");
331
- if (mode === "reference" && image.role !== "reference_image") throw new GenerationValidationError("Reference mode images must use meta.role reference_image");
332
- content.push({
341
+ ].filter(Boolean).length > 1) throw new GenerationValidationError("Cannot mix video media modes: use only plain image, first_frame/last_frame, or reference_image/reference_video");
342
+ if (hasReference) {
343
+ assertSingleRole(media, "reference_video", "Reference mode supports at most one reference_video");
344
+ return "reference";
345
+ }
346
+ if (hasFrame) {
347
+ assertSingleRole(media, "first_frame", "Frame mode supports at most one first_frame image");
348
+ assertSingleRole(media, "last_frame", "Frame mode supports at most one last_frame image");
349
+ return "frame";
350
+ }
351
+ if (hasPlain) {
352
+ if (media.filter((item) => item.kind === "image" && !item.role).length > 1) throw new GenerationValidationError("Plain image mode supports at most one image");
353
+ return "image";
354
+ }
355
+ return null;
356
+ }
357
+ function buildMetadataContent(media, mode) {
358
+ const content = [];
359
+ for (const item of media) {
360
+ if (mode === "frame" && (item.kind !== "image" || item.role !== "first_frame" && item.role !== "last_frame")) throw new GenerationValidationError("Frame mode images must use meta.role first_frame or last_frame");
361
+ if (mode === "reference" && !(item.kind === "image" && item.role === "reference_image" || item.kind === "video" && item.role === "reference_video")) throw new GenerationValidationError("Reference mode media must use meta.role reference_image or reference_video");
362
+ if (item.kind === "image") content.push({
333
363
  type: "image_url",
334
- image_url: { url: image.url },
335
- role: image.role
364
+ image_url: { url: item.url },
365
+ role: item.role
366
+ });
367
+ else content.push({
368
+ type: "video_url",
369
+ video_url: { url: item.url },
370
+ role: item.role
336
371
  });
337
372
  }
338
373
  return content;
339
374
  }
375
+ async function resolveMedia(input, media) {
376
+ return Promise.all(media.map(async (item) => ({
377
+ kind: item.kind,
378
+ role: item.role,
379
+ url: await input.context.resolveSource(item.source)
380
+ })));
381
+ }
340
382
  function extractTaskId$2(response) {
341
383
  const taskId = asString$2(response.task_id) ?? asString$2(response.id);
342
384
  if (!taskId) throw new GenerationProviderError("Video generation provider did not return a task id", { details: { response } });
@@ -396,12 +438,13 @@ async function requestJson$2(input, path, init) {
396
438
  async function arkVideoGenerationsAdapter(input) {
397
439
  const prompt = mergeTextBlocks(input.declaration, input.request.content);
398
440
  if (!prompt) throw new GenerationValidationError("Prompt text is required");
399
- const imageBlocks = input.request.content.filter((block) => block.type === "image");
400
- const images = await Promise.all(imageBlocks.map(async (block) => ({
401
- url: await input.context.resolveSource(block.source),
402
- role: getImageRole$1(block)
403
- })));
404
- const mode = classifyImages(images);
441
+ const inputMedia = input.request.content.filter((block) => block.type === "image" || block.type === "video").map((block) => ({
442
+ kind: block.type,
443
+ source: block.source,
444
+ role: getMediaRole(block)
445
+ }));
446
+ const mode = classifyMedia(inputMedia);
447
+ const media = await resolveMedia(input, inputMedia);
405
448
  const resolution = asString$2(input.parameters.resolution) ?? "720p";
406
449
  const aspectRatio = asString$2(input.parameters.aspect_ratio) ?? "16:9";
407
450
  const duration = getIntegerParameter(input.parameters, "duration", 5);
@@ -427,7 +470,7 @@ async function arkVideoGenerationsAdapter(input) {
427
470
  if (cameraFixed) metadata.camera_fixed = true;
428
471
  if (watermark) metadata.watermark = true;
429
472
  if (mode === "frame" || mode === "reference") {
430
- metadata.content = buildMetadataContent(prompt, images, mode);
473
+ metadata.content = buildMetadataContent(media, mode);
431
474
  metadata.resolution = resolution;
432
475
  metadata.ratio = aspectRatio;
433
476
  } else {
@@ -436,7 +479,8 @@ async function arkVideoGenerationsAdapter(input) {
436
479
  payload.width = size.width;
437
480
  payload.height = size.height;
438
481
  }
439
- if (images[0]) payload.image = images[0].url;
482
+ const firstImage = media.find((item) => item.kind === "image");
483
+ if (firstImage) payload.image = firstImage.url;
440
484
  }
441
485
  payload.metadata = metadata;
442
486
  const taskId = extractTaskId$2(await requestJson$2(input, "/v1/video/generations", {
@@ -494,41 +538,18 @@ async function arkVideoGenerationsAdapter(input) {
494
538
  //#endregion
495
539
  //#region src/adapters/gemini-generate-content.ts
496
540
  const REQUEST_TIMEOUT_MS$4 = 3e5;
497
- const IMAGE_FETCH_TIMEOUT_MS = 6e4;
498
- const MAX_REFERENCE_IMAGE_BYTES = 10 * 1024 * 1024;
499
- const DATA_URI_PATTERN = /^data:([^;]+);base64,(.+)$/s;
500
541
  const MARKDOWN_IMAGE_DATA_URI_PATTERN = /!\[[^\]]*\]\(data:([^;]+);base64,([^)]+)\)/;
501
- function dataUriToInlineData(value) {
502
- const match = DATA_URI_PATTERN.exec(value);
503
- if (!match) return null;
504
- const [, mimeType, data] = match;
505
- if (!mimeType || !data) return null;
506
- return { inlineData: {
507
- mimeType,
508
- data
509
- } };
542
+ function isHttpUrl(value) {
543
+ return value.startsWith("http://") || value.startsWith("https://");
510
544
  }
511
- async function urlToInlineData(fetchFn, url) {
512
- const response = await fetchWithTimeout(fetchFn, url, {
513
- method: "GET",
514
- headers: { "User-Agent": "NetaGeneration/1.0" }
515
- }, IMAGE_FETCH_TIMEOUT_MS);
516
- if (!response.ok) throw new GenerationProviderError("Failed to fetch reference image", { status: response.status });
517
- const contentLength = response.headers.get("content-length");
518
- if (contentLength && Number(contentLength) > MAX_REFERENCE_IMAGE_BYTES) throw new GenerationValidationError("Reference image is too large");
519
- const bytes = Buffer.from(await response.arrayBuffer());
520
- if (bytes.byteLength > MAX_REFERENCE_IMAGE_BYTES) throw new GenerationValidationError("Reference image is too large");
521
- const contentType = response.headers.get("content-type")?.split(";")[0]?.trim();
522
- return { inlineData: {
523
- mimeType: contentType?.startsWith("image/") ? contentType : "image/png",
524
- data: bytes.toString("base64")
545
+ async function imageBlockToGeminiPart(input, block) {
546
+ if (block.source.type === "base64") return { inlineData: {
547
+ mimeType: block.source.mediaType,
548
+ data: block.source.data
525
549
  } };
526
- }
527
- async function sourceToInlineData(input, value) {
528
- const inline = dataUriToInlineData(value);
529
- if (inline) return inline;
530
- if (value.startsWith("http://") || value.startsWith("https://")) return urlToInlineData(input.context.fetch, value);
531
- throw new GenerationValidationError("Unsupported image source for Gemini image generation");
550
+ const fileUri = await input.context.resolveSource(block.source);
551
+ if (!isHttpUrl(fileUri)) throw new GenerationValidationError("Gemini image URL source must resolve to an HTTP(S) URL");
552
+ return { fileData: { fileUri } };
532
553
  }
533
554
  function extractMarkdownDataUriImage(text) {
534
555
  const match = MARKDOWN_IMAGE_DATA_URI_PATTERN.exec(text);
@@ -610,7 +631,7 @@ function appendGeminiPartOutput(output, part) {
610
631
  async function geminiGenerateContentAdapter(input) {
611
632
  const prompt = mergeTextBlocks(input.declaration, input.request.content);
612
633
  if (!prompt) throw new GenerationValidationError("Prompt text is required");
613
- const imageParts = await Promise.all(input.request.content.filter((block) => block.type === "image").map(async (block) => sourceToInlineData(input, await input.context.resolveSource(block.source))));
634
+ const imageParts = await Promise.all(input.request.content.filter((block) => block.type === "image").map((block) => imageBlockToGeminiPart(input, block)));
614
635
  const generationConfig = { responseModalities: ["IMAGE"] };
615
636
  const aspectRatio = input.parameters.aspect_ratio;
616
637
  const imageSize = input.parameters.image_size;
@@ -1659,4 +1680,4 @@ async function exportBuiltinModelConfigs(directory) {
1659
1680
 
1660
1681
  //#endregion
1661
1682
  export { validateGenerationContent as A, klingVideoGenerationsAdapter as C, mergeTextBlocks as D, mergeGenerationMeta as E, GenerationUnsupportedAdapterError as F, GenerationValidationError as I, GenerationError as M, GenerationProviderError as N, resolveGenerationMeta as O, GenerationTimeoutError as P, openAiImageEditsAdapter as S, arkVideoGenerationsAdapter as T, writeGenerationModelDeclarations as _, createGenerationClientFromDirectory as a, sunoTasksAdapter as b, defaultGenerationSourceResolver as c, parseGenerationModelDeclaration as d, readGenerationModelDeclaration as f, writeGenerationModelDeclaration as g, stringifyGenerationModelDeclaration as h, createGenerationClient as i, GenerationConfigError as j, resolveGenerationParameters as k, isGenerationModelDeclaration as l, readGenerationModelDeclarationsFromFiles as m, exportBuiltinModelConfigs as n, createGenerationClientFromFile as o, readGenerationModelDeclarationsFromDirectory as p, stringifyBuiltinModelConfig as r, createGenerationClientFromFiles as s, exportBuiltinModelConfig as t, mergeGenerationModelDeclarations as u, builtinGenerationAdapters as v, geminiGenerateContentAdapter as w, openAiImagesAdapter as x, getGenerationAdapter as y };
1662
- //# sourceMappingURL=export-config-DvBXBq-8.js.map
1683
+ //# sourceMappingURL=export-config--lWA-0gu.js.map