@picsart/ai-sdk 1.133.4

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.
Files changed (5) hide show
  1. package/_cli.js +12672 -0
  2. package/bin/gen-ai.mjs +3 -0
  3. package/index.d.ts +1657 -0
  4. package/index.js +6314 -0
  5. package/package.json +66 -0
package/index.d.ts ADDED
@@ -0,0 +1,1657 @@
1
+ interface WorkflowSubmitRequest<TPayload = Record<string, unknown>> {
2
+ /** Explicit workflow endpoint, e.g. "veo-text-to-video". */
3
+ workflow?: string;
4
+ /** Model reference (model id, backend modelId, display name, or workflow string fallback). */
5
+ model?: string;
6
+ payload: TPayload;
7
+ signal?: AbortSignal;
8
+ }
9
+ interface ResolvedWorkflowSubmitRequest<TPayload = Record<string, unknown>> extends WorkflowSubmitRequest<TPayload> {
10
+ workflow: string;
11
+ }
12
+ interface WorkflowJobHandle {
13
+ workflow: string;
14
+ id: string;
15
+ }
16
+ type WorkflowStatus = 'ACCEPTED' | 'IN_PROGRESS' | 'COMPLETED' | 'FAILED' | 'CANCELED' | 'UNKNOWN';
17
+ interface WorkflowProgress {
18
+ percent?: number;
19
+ estimatedSecondsLeft?: number;
20
+ }
21
+ interface WorkflowStatusResult<TResult = unknown> {
22
+ handle: WorkflowJobHandle;
23
+ status: WorkflowStatus;
24
+ result?: TResult;
25
+ error?: string;
26
+ progress?: WorkflowProgress;
27
+ raw: unknown;
28
+ }
29
+ interface WorkflowTransport<TPayload = Record<string, unknown>> {
30
+ submit(request: ResolvedWorkflowSubmitRequest<TPayload>): Promise<WorkflowJobHandle>;
31
+ status(handle: WorkflowJobHandle, signal?: AbortSignal): Promise<unknown>;
32
+ execute?(request: ResolvedWorkflowSubmitRequest<TPayload>): Promise<unknown>;
33
+ cancel?(handle: WorkflowJobHandle, signal?: AbortSignal): Promise<void>;
34
+ }
35
+ interface WorkflowPollOptions {
36
+ intervalMs?: number;
37
+ maxAttempts?: number;
38
+ signal?: AbortSignal;
39
+ }
40
+ interface WorkflowRunOptions extends WorkflowPollOptions {
41
+ mode?: 'async' | 'sync';
42
+ }
43
+ type WorkflowSubscribeOptions = WorkflowPollOptions;
44
+
45
+ /**
46
+ * Per-model compile-time input contracts generated from specs/vendors catalog.
47
+ * Regenerate with: npm run build:model-input-types
48
+ */
49
+ type ModelInputById = {
50
+ "bytedance-omnihuman": {
51
+ prompt?: string;
52
+ imageUrls: [string, ...string[]];
53
+ audioUrl: string;
54
+ };
55
+ "bytedance-upscaler": {
56
+ videoUrl: string;
57
+ };
58
+ "creatify-aurora": {
59
+ prompt?: string;
60
+ imageUrls: [string, ...string[]];
61
+ audioUrl: string;
62
+ };
63
+ "eleven-audio-isolation": {
64
+ audioUrl: string;
65
+ };
66
+ "eleven-dubbing": {
67
+ audioUrl: string;
68
+ language?: string;
69
+ accent?: string;
70
+ };
71
+ "eleven-multilingual-sts-v2": {
72
+ audioUrl: string;
73
+ voiceId?: "JBFqnCBsd6RMkjVDRZzb" | "EkK5I93UQWFDigLMpZcX" | "RILOU7YmBhvwJGDGjNmP" | "Z3R5wn05IrDiVCyEkUrK" | "NNl6r8mD7vthiJatiJt1" | "Bj9UqZbhQsanLzgalpEG" | "exsUS4vynmxd379XN4yO" | "BpjGufoPiobT79j2vtj4" | "kdmDKE6EkgrWrrykO9Qt" | "1SM7GgM6IMuvQlz2BwM3" | "ouL9IsyrSnUkCmfnD02u" | "5l5f8iK3YPeGga21rQIX" | "scOwDtmlUjD3prqpp97I" | "19STyYD15bswVz51nqLf" | "BZgkqPqms7Kj9ulSkVzn" | "wo6udizrrtpIxWGp2qJk" | "yjJ45q8TVCrtMhEKurxY" | "gU0LNdkMOQCOrPrwtbee" | "DGzg6RaUqxGRTHSBjfgF" | "x70vRnQBMBu4FAYhjJbO";
74
+ language?: string;
75
+ accent?: string;
76
+ removeBackgroundNoise?: boolean;
77
+ };
78
+ "eleven-multilingual-v2": {
79
+ language?: string;
80
+ accent?: string;
81
+ prompt: string;
82
+ voiceId?: "JBFqnCBsd6RMkjVDRZzb" | "EkK5I93UQWFDigLMpZcX" | "RILOU7YmBhvwJGDGjNmP" | "Z3R5wn05IrDiVCyEkUrK" | "NNl6r8mD7vthiJatiJt1" | "Bj9UqZbhQsanLzgalpEG" | "exsUS4vynmxd379XN4yO" | "BpjGufoPiobT79j2vtj4" | "kdmDKE6EkgrWrrykO9Qt" | "1SM7GgM6IMuvQlz2BwM3" | "ouL9IsyrSnUkCmfnD02u" | "5l5f8iK3YPeGga21rQIX" | "scOwDtmlUjD3prqpp97I" | "19STyYD15bswVz51nqLf" | "BZgkqPqms7Kj9ulSkVzn" | "wo6udizrrtpIxWGp2qJk" | "yjJ45q8TVCrtMhEKurxY" | "gU0LNdkMOQCOrPrwtbee" | "DGzg6RaUqxGRTHSBjfgF" | "x70vRnQBMBu4FAYhjJbO";
83
+ };
84
+ "eleven-sts-v2": {
85
+ audioUrl: string;
86
+ voiceId?: "JBFqnCBsd6RMkjVDRZzb" | "EkK5I93UQWFDigLMpZcX" | "RILOU7YmBhvwJGDGjNmP" | "Z3R5wn05IrDiVCyEkUrK" | "NNl6r8mD7vthiJatiJt1" | "Bj9UqZbhQsanLzgalpEG" | "exsUS4vynmxd379XN4yO" | "BpjGufoPiobT79j2vtj4" | "kdmDKE6EkgrWrrykO9Qt" | "1SM7GgM6IMuvQlz2BwM3" | "ouL9IsyrSnUkCmfnD02u" | "5l5f8iK3YPeGga21rQIX" | "scOwDtmlUjD3prqpp97I" | "19STyYD15bswVz51nqLf" | "BZgkqPqms7Kj9ulSkVzn" | "wo6udizrrtpIxWGp2qJk" | "yjJ45q8TVCrtMhEKurxY" | "gU0LNdkMOQCOrPrwtbee" | "DGzg6RaUqxGRTHSBjfgF" | "x70vRnQBMBu4FAYhjJbO";
87
+ removeBackgroundNoise?: boolean;
88
+ };
89
+ "eleven-v3": {
90
+ language?: string;
91
+ accent?: string;
92
+ prompt: string;
93
+ voiceId?: "JBFqnCBsd6RMkjVDRZzb" | "EkK5I93UQWFDigLMpZcX" | "RILOU7YmBhvwJGDGjNmP" | "Z3R5wn05IrDiVCyEkUrK" | "NNl6r8mD7vthiJatiJt1" | "Bj9UqZbhQsanLzgalpEG" | "exsUS4vynmxd379XN4yO" | "BpjGufoPiobT79j2vtj4" | "kdmDKE6EkgrWrrykO9Qt" | "1SM7GgM6IMuvQlz2BwM3" | "ouL9IsyrSnUkCmfnD02u" | "5l5f8iK3YPeGga21rQIX" | "scOwDtmlUjD3prqpp97I" | "19STyYD15bswVz51nqLf" | "BZgkqPqms7Kj9ulSkVzn" | "wo6udizrrtpIxWGp2qJk" | "yjJ45q8TVCrtMhEKurxY" | "gU0LNdkMOQCOrPrwtbee" | "DGzg6RaUqxGRTHSBjfgF" | "x70vRnQBMBu4FAYhjJbO";
94
+ };
95
+ "eleven-voice-design-v2": {
96
+ prompt: string;
97
+ };
98
+ "eleven-voice-design-v3": {
99
+ prompt: string;
100
+ };
101
+ "eleven-voice-previews": {
102
+ prompt: string;
103
+ };
104
+ "eleven-voice-remix": {
105
+ voiceId?: "JBFqnCBsd6RMkjVDRZzb" | "EkK5I93UQWFDigLMpZcX" | "RILOU7YmBhvwJGDGjNmP" | "Z3R5wn05IrDiVCyEkUrK" | "NNl6r8mD7vthiJatiJt1" | "Bj9UqZbhQsanLzgalpEG" | "exsUS4vynmxd379XN4yO" | "BpjGufoPiobT79j2vtj4" | "kdmDKE6EkgrWrrykO9Qt" | "1SM7GgM6IMuvQlz2BwM3" | "ouL9IsyrSnUkCmfnD02u" | "5l5f8iK3YPeGga21rQIX" | "scOwDtmlUjD3prqpp97I" | "19STyYD15bswVz51nqLf" | "BZgkqPqms7Kj9ulSkVzn" | "wo6udizrrtpIxWGp2qJk" | "yjJ45q8TVCrtMhEKurxY" | "gU0LNdkMOQCOrPrwtbee" | "DGzg6RaUqxGRTHSBjfgF" | "x70vRnQBMBu4FAYhjJbO";
106
+ prompt: string;
107
+ };
108
+ "elevenlabs-sfx": {
109
+ prompt: string;
110
+ duration?: 1 | 3 | 5 | 8 | 10 | 15;
111
+ };
112
+ "flux-2-flex": {
113
+ prompt: string;
114
+ aspectRatio?: "1:1" | "5:3" | "3:5" | "4:3" | "3:4";
115
+ count?: 1 | 2 | 4 | 6 | 8 | 10;
116
+ imageUrls?: string[];
117
+ };
118
+ "flux-2-max": {
119
+ prompt: string;
120
+ aspectRatio?: "1:1" | "5:3" | "3:5" | "4:3" | "3:4";
121
+ count?: 1 | 2 | 4 | 6 | 8 | 10;
122
+ imageUrls?: string[];
123
+ };
124
+ "flux-2-pro": {
125
+ prompt: string;
126
+ aspectRatio?: "1:1" | "5:3" | "3:5" | "4:3" | "3:4";
127
+ count?: 1 | 2 | 4 | 6 | 8 | 10;
128
+ imageUrls?: string[];
129
+ };
130
+ "flux-kontext-max": {
131
+ prompt: string;
132
+ aspectRatio?: "1:1" | "16:9" | "9:16" | "4:3" | "3:4" | "21:9" | "9:21";
133
+ count?: 1 | 2 | 4 | 6 | 8 | 10;
134
+ imageUrls?: string[];
135
+ };
136
+ "flux-kontext-pro": {
137
+ prompt: string;
138
+ aspectRatio?: "1:1" | "16:9" | "9:16" | "4:3" | "3:4" | "21:9" | "9:21";
139
+ count?: 1 | 2 | 4 | 6 | 8 | 10;
140
+ imageUrls?: string[];
141
+ };
142
+ "gemini-2.5-flash-image": {
143
+ prompt: string;
144
+ aspectRatio?: "1:1" | "16:9" | "9:16" | "3:4" | "4:3" | "2:3" | "21:9";
145
+ count?: 1 | 2 | 4 | 6 | 8 | 10;
146
+ imageUrls?: string[];
147
+ };
148
+ "gemini-2.5-flash-tts": {
149
+ language?: string;
150
+ accent?: string;
151
+ prompt: string;
152
+ voiceId?: "Aoede" | "Charon" | "Fenrir" | "Kore" | "Leda" | "Orus" | "Perseus" | "Puck" | "Zephyr" | "Achernar" | "Achird" | "Algenib" | "Algieba" | "Alnilam" | "Autonoe" | "Callirhoe" | "Despina" | "Enceladus" | "Erinome" | "Gacrux" | "Iapetus" | "Laomedeia" | "Pulcherrima" | "Rasalgethi" | "Sadachbia" | "Sadaltager" | "Schedar" | "Sulafat" | "Umbriel" | "Vindemiatrix" | "Zubenelgenubi";
153
+ };
154
+ "gemini-2.5-pro-tts": {
155
+ language?: string;
156
+ accent?: string;
157
+ prompt: string;
158
+ voiceId?: "Aoede" | "Charon" | "Fenrir" | "Kore" | "Leda" | "Orus" | "Perseus" | "Puck" | "Zephyr" | "Achernar" | "Achird" | "Algenib" | "Algieba" | "Alnilam" | "Autonoe" | "Callirhoe" | "Despina" | "Enceladus" | "Erinome" | "Gacrux" | "Iapetus" | "Laomedeia" | "Pulcherrima" | "Rasalgethi" | "Sadachbia" | "Sadaltager" | "Schedar" | "Sulafat" | "Umbriel" | "Vindemiatrix" | "Zubenelgenubi";
159
+ };
160
+ "gemini-3-pro-image": {
161
+ prompt: string;
162
+ aspectRatio?: "1:1" | "16:9" | "9:16" | "3:4" | "4:3" | "2:3" | "21:9";
163
+ resolution?: "0.5K" | "1K" | "2K" | "4K";
164
+ count?: 1 | 2 | 4 | 6 | 8 | 10;
165
+ imageUrls?: string[];
166
+ };
167
+ "gemini-3.1-flash-image": {
168
+ prompt: string;
169
+ aspectRatio?: "1:1" | "16:9" | "9:16" | "3:4" | "4:3" | "3:2" | "2:3" | "4:5" | "5:4" | "4:1" | "1:4" | "8:1" | "1:8" | "21:9";
170
+ resolution?: "0.5K" | "1K" | "2K" | "4K";
171
+ count?: 1 | 2 | 4 | 6 | 8 | 10;
172
+ imageUrls?: string[];
173
+ };
174
+ "gpt-image-1": {
175
+ prompt: string;
176
+ aspectRatio?: "1:1" | "3:2" | "2:3" | "16:9" | "9:16" | "4:3" | "3:4";
177
+ quality?: "high" | "medium" | "low";
178
+ count?: 1 | 2 | 4 | 6 | 8 | 10;
179
+ imageUrls?: string[];
180
+ };
181
+ "gpt-image-1.5": {
182
+ prompt: string;
183
+ aspectRatio?: "1:1" | "3:2" | "2:3" | "16:9" | "9:16" | "4:3" | "3:4";
184
+ quality?: "high" | "medium" | "low";
185
+ count?: 1 | 2 | 4 | 6 | 8 | 10;
186
+ imageUrls?: string[];
187
+ };
188
+ "grok": {
189
+ prompt: string;
190
+ aspectRatio?: "16:9" | "9:16" | "1:1" | "4:3" | "3:4" | "3:2" | "2:3";
191
+ resolution?: "480p" | "720p";
192
+ duration?: 3 | 5 | 6 | 8 | 10 | 12 | 15;
193
+ imageUrls?: string[];
194
+ };
195
+ "grok-edit-video": {
196
+ prompt: string;
197
+ duration?: 3 | 5 | 6 | 8 | 10 | 12 | 15;
198
+ videoUrl: string;
199
+ };
200
+ "grok-imagine": {
201
+ prompt: string;
202
+ aspectRatio?: "1:1" | "16:9" | "9:16" | "4:3" | "3:4" | "3:2" | "2:3" | "2:1" | "1:2" | "19.5:9" | "9:19.5" | "20:9" | "9:20";
203
+ count?: 1 | 2 | 4;
204
+ imageUrls?: string[];
205
+ };
206
+ "hailuo-2.3": {
207
+ prompt: string;
208
+ enhancePrompt?: boolean;
209
+ duration?: 6 | 10;
210
+ imageUrls?: string[];
211
+ };
212
+ "hailuo-2.3-fast": {
213
+ prompt: string;
214
+ enhancePrompt?: boolean;
215
+ duration?: 6 | 10;
216
+ imageUrls: [string, ...string[]];
217
+ };
218
+ "hailuo-2.3-fast-pro": {
219
+ prompt: string;
220
+ enhancePrompt?: boolean;
221
+ imageUrls: [string, ...string[]];
222
+ };
223
+ "hailuo-2.3-pro": {
224
+ prompt: string;
225
+ enhancePrompt?: boolean;
226
+ imageUrls?: string[];
227
+ };
228
+ "heygen-talking-photo": {
229
+ imageUrls: [string, ...string[]];
230
+ resolution?: "1080p" | "720p";
231
+ aspectRatio?: "16:9" | "9:16";
232
+ prompt: string;
233
+ };
234
+ "heygen-video-avatar": {
235
+ resolution?: "1080p" | "720p";
236
+ aspectRatio?: "16:9" | "9:16";
237
+ prompt: string;
238
+ };
239
+ "hunyuan-v3": {
240
+ prompt: string;
241
+ aspectRatio?: "1:1" | "16:9" | "9:16" | "4:3" | "3:4";
242
+ count?: 1 | 2 | 4 | 6 | 8 | 10;
243
+ negativePrompt?: string;
244
+ cfgScale?: number;
245
+ };
246
+ "ideogram-character": {
247
+ resolution?: "1024x1024" | "1344x768" | "768x1344" | "1152x864" | "864x1152" | "832x1248" | "1280x800";
248
+ renderingSpeed?: "TURBO" | "DEFAULT" | "QUALITY";
249
+ style?: "AUTO" | "REALISTIC" | "FICTION";
250
+ count?: 1 | 2 | 4 | 6 | 8 | 10;
251
+ imageUrls: [string, ...string[]];
252
+ };
253
+ "ideogram-v3": {
254
+ aspectRatio?: "16:9" | "9:16" | "1:1" | "3:4" | "4:3";
255
+ renderingSpeed?: "FLASH" | "TURBO" | "DEFAULT" | "QUALITY";
256
+ style?: "GENERAL" | "REALISTIC" | "DESIGN";
257
+ count?: 1 | 2 | 4 | 6 | 8 | 10;
258
+ negativePrompt?: string;
259
+ imageUrls?: string[];
260
+ imageWeight?: number;
261
+ };
262
+ "imagen-4.0": {
263
+ prompt: string;
264
+ aspectRatio?: "1:1" | "16:9" | "9:16" | "3:4" | "4:3";
265
+ count?: 1 | 2 | 4 | 6 | 8 | 10;
266
+ enhancePrompt?: boolean;
267
+ negativePrompt?: string;
268
+ };
269
+ "imagen-4.0-fast": {
270
+ prompt: string;
271
+ aspectRatio?: "1:1" | "16:9" | "9:16" | "3:4" | "4:3";
272
+ count?: 1 | 2 | 4 | 6 | 8 | 10;
273
+ enhancePrompt?: boolean;
274
+ negativePrompt?: string;
275
+ };
276
+ "imagen-4.0-ultra": {
277
+ prompt: string;
278
+ aspectRatio?: "1:1" | "16:9" | "9:16" | "3:4" | "4:3";
279
+ count?: 1 | 2 | 4 | 6 | 8 | 10;
280
+ enhancePrompt?: boolean;
281
+ negativePrompt?: string;
282
+ };
283
+ "kling-2.6-pro": {
284
+ prompt: string;
285
+ aspectRatio?: "16:9" | "9:16" | "1:1";
286
+ duration?: 5 | 10;
287
+ imageUrls?: string[];
288
+ negativePrompt?: string;
289
+ generateAudio?: boolean;
290
+ cfgScale?: number;
291
+ };
292
+ "kling-2.6-standard": {
293
+ prompt: string;
294
+ aspectRatio?: "16:9" | "9:16" | "1:1";
295
+ duration?: 5 | 10;
296
+ imageUrls?: string[];
297
+ negativePrompt?: string;
298
+ generateAudio?: boolean;
299
+ cfgScale?: number;
300
+ };
301
+ "kling-3.0-image": {
302
+ prompt: string;
303
+ aspectRatio?: "16:9" | "9:16" | "1:1" | "21:9" | "4:3" | "3:2" | "2:3" | "3:4";
304
+ resolution?: "1k" | "2k" | "4k";
305
+ count?: 1 | 2 | 4 | 6 | 8;
306
+ imageUrls?: string[];
307
+ };
308
+ "kling-3.0-pro": {
309
+ prompt: string;
310
+ aspectRatio?: "16:9" | "9:16" | "1:1";
311
+ duration?: 3 | 5 | 8 | 10 | 12 | 15;
312
+ imageUrls?: string[];
313
+ negativePrompt?: string;
314
+ generateAudio?: boolean;
315
+ };
316
+ "kling-3.0-standard": {
317
+ prompt: string;
318
+ aspectRatio?: "16:9" | "9:16" | "1:1";
319
+ duration?: 3 | 5 | 8 | 10 | 12 | 15;
320
+ imageUrls?: string[];
321
+ negativePrompt?: string;
322
+ generateAudio?: boolean;
323
+ };
324
+ "kling-avatar": {
325
+ prompt?: string;
326
+ renderingSpeed?: "std" | "pro";
327
+ imageUrls: [string, ...string[]];
328
+ audioUrl: string;
329
+ };
330
+ "kling-motion-control": {
331
+ prompt?: string;
332
+ resolution?: "720p" | "1080p";
333
+ imageUrls: [string, ...string[]];
334
+ videoUrl: string;
335
+ };
336
+ "kling-motion-control-v3": {
337
+ prompt?: string;
338
+ resolution?: "720p" | "1080p";
339
+ imageUrls: [string, ...string[]];
340
+ videoUrl: string;
341
+ };
342
+ "kling-multi-image": {
343
+ prompt?: string;
344
+ aspectRatio?: "16:9" | "9:16" | "1:1" | "21:9" | "4:3" | "3:2" | "2:3" | "3:4";
345
+ count?: 1 | 2 | 4 | 6 | 8;
346
+ imageUrls: [string, ...string[]];
347
+ };
348
+ "kling-multi-image-v2-1": {
349
+ prompt?: string;
350
+ aspectRatio?: "16:9" | "9:16" | "1:1" | "21:9" | "4:3" | "3:2" | "2:3" | "3:4";
351
+ count?: 1 | 2 | 4 | 6 | 8;
352
+ imageUrls: [string, ...string[]];
353
+ };
354
+ "kling-o1-image": {
355
+ prompt: string;
356
+ aspectRatio?: "16:9" | "9:16" | "1:1" | "21:9" | "4:3" | "3:2" | "2:3" | "3:4";
357
+ resolution?: "1k" | "2k";
358
+ count?: 1 | 2 | 4 | 6 | 8;
359
+ imageUrls?: string[];
360
+ };
361
+ "kling-o1-pro": {
362
+ prompt: string;
363
+ aspectRatio?: "16:9" | "9:16" | "1:1";
364
+ duration?: 3 | 5 | 8 | 10 | 12 | 15;
365
+ imageUrls?: string[];
366
+ negativePrompt?: string;
367
+ generateAudio?: boolean;
368
+ };
369
+ "kling-o3-pro": {
370
+ prompt: string;
371
+ aspectRatio?: "16:9" | "9:16" | "1:1";
372
+ duration?: 3 | 5 | 8 | 10 | 12 | 15;
373
+ imageUrls?: string[];
374
+ negativePrompt?: string;
375
+ generateAudio?: boolean;
376
+ };
377
+ "kling-o3-standard": {
378
+ prompt: string;
379
+ aspectRatio?: "16:9" | "9:16" | "1:1";
380
+ duration?: 3 | 5 | 8 | 10 | 12 | 15;
381
+ imageUrls?: string[];
382
+ negativePrompt?: string;
383
+ generateAudio?: boolean;
384
+ };
385
+ "kling-omni": {
386
+ prompt: string;
387
+ aspectRatio?: "16:9" | "9:16" | "1:1";
388
+ duration?: 3 | 5 | 8 | 10 | 12 | 15;
389
+ resolution?: "720p" | "1080p";
390
+ negativePrompt?: string;
391
+ };
392
+ "kling-t2a": {
393
+ prompt: string;
394
+ duration?: 5 | 10;
395
+ };
396
+ "kling-v1-5-image": {
397
+ prompt: string;
398
+ aspectRatio?: "16:9" | "9:16" | "1:1" | "21:9" | "4:3" | "3:2" | "2:3" | "3:4";
399
+ count?: 1 | 2 | 4 | 6 | 8;
400
+ negativePrompt?: string;
401
+ imageUrls?: string[];
402
+ imageWeight?: number;
403
+ };
404
+ "kling-v2-1-image": {
405
+ prompt: string;
406
+ aspectRatio?: "16:9" | "9:16" | "1:1" | "21:9" | "4:3" | "3:2" | "2:3" | "3:4";
407
+ count?: 1 | 2 | 4 | 6 | 8;
408
+ negativePrompt?: string;
409
+ imageUrls?: string[];
410
+ imageWeight?: number;
411
+ };
412
+ "kling-v2-image": {
413
+ prompt: string;
414
+ aspectRatio?: "16:9" | "9:16" | "1:1" | "21:9" | "4:3" | "3:2" | "2:3" | "3:4";
415
+ count?: 1 | 2 | 4 | 6 | 8;
416
+ negativePrompt?: string;
417
+ imageUrls?: string[];
418
+ imageWeight?: number;
419
+ };
420
+ "kling-v2-new-image": {
421
+ prompt: string;
422
+ aspectRatio?: "16:9" | "9:16" | "1:1" | "21:9" | "4:3" | "3:2" | "2:3" | "3:4";
423
+ count?: 1 | 2 | 4 | 6 | 8;
424
+ negativePrompt?: string;
425
+ imageUrls: [string, ...string[]];
426
+ imageWeight?: number;
427
+ };
428
+ "kling-v2a": {
429
+ videoUrl: string;
430
+ };
431
+ "ltx-2.3-a2v": {
432
+ prompt?: string;
433
+ audioUrl: string;
434
+ imageUrls?: string[];
435
+ cfgScale?: number;
436
+ };
437
+ "ltx-2.3-extend": {
438
+ prompt?: string;
439
+ duration?: 5 | 10 | 15 | 20;
440
+ videoUrl: string;
441
+ };
442
+ "ltx-2.3-fast-t2v": {
443
+ prompt: string;
444
+ duration?: 6 | 8 | 10 | 12 | 14 | 16 | 18 | 20;
445
+ resolution?: "1080p" | "1440p" | "2160p";
446
+ aspectRatio?: "16:9" | "9:16";
447
+ generateAudio?: boolean;
448
+ imageUrls?: string[];
449
+ };
450
+ "ltx-2.3-pro-t2v": {
451
+ prompt: string;
452
+ duration?: 6 | 8 | 10;
453
+ resolution?: "1080p" | "1440p" | "2160p";
454
+ aspectRatio?: "16:9" | "9:16";
455
+ generateAudio?: boolean;
456
+ imageUrls?: string[];
457
+ };
458
+ "ltx-2.3-retake": {
459
+ prompt: string;
460
+ duration?: 5 | 10 | 15 | 20;
461
+ videoUrl: string;
462
+ };
463
+ "ltx-fast-t2v": {
464
+ prompt: string;
465
+ duration?: 6 | 8 | 10 | 12 | 14 | 16 | 18 | 20;
466
+ resolution?: "1080p" | "1440p" | "2160p";
467
+ generateAudio?: boolean;
468
+ imageUrls?: string[];
469
+ };
470
+ "ltx-pro-t2v": {
471
+ prompt: string;
472
+ duration?: 6 | 8 | 10;
473
+ resolution?: "1080p" | "1440p" | "2160p";
474
+ generateAudio?: boolean;
475
+ imageUrls?: string[];
476
+ };
477
+ "ltx-retake": {
478
+ prompt: string;
479
+ duration?: 5 | 10 | 15 | 20;
480
+ videoUrl: string;
481
+ };
482
+ "luma-flash2-i2v": {
483
+ prompt: string;
484
+ aspectRatio?: "16:9" | "9:16" | "1:1" | "4:3" | "3:4" | "21:9" | "9:21";
485
+ resolution?: "540p" | "720p" | "1080p" | "4k";
486
+ duration?: 5 | 9;
487
+ imageUrls: [string, ...string[]];
488
+ };
489
+ "luma-ray2-t2v": {
490
+ prompt: string;
491
+ aspectRatio?: "16:9" | "9:16" | "1:1" | "4:3" | "3:4" | "21:9" | "9:21";
492
+ resolution?: "540p" | "720p" | "1080p" | "4k";
493
+ duration?: 5 | 9;
494
+ imageUrls?: string[];
495
+ };
496
+ "lyria-3-clip": {
497
+ prompt: string;
498
+ imageUrls?: string[];
499
+ };
500
+ "lyria-3-pro": {
501
+ prompt: string;
502
+ imageUrls?: string[];
503
+ };
504
+ "minimax-02-hd": {
505
+ language?: string;
506
+ accent?: string;
507
+ prompt: string;
508
+ };
509
+ "minimax-music": {
510
+ prompt: string;
511
+ };
512
+ "openai-tts-1": {
513
+ prompt: string;
514
+ voiceId?: "alloy" | "ash" | "ballad" | "coral" | "echo" | "fable" | "nova" | "onyx" | "sage" | "shimmer" | "verse";
515
+ };
516
+ "openai-tts-1-hd": {
517
+ prompt: string;
518
+ voiceId?: "alloy" | "ash" | "ballad" | "coral" | "echo" | "fable" | "nova" | "onyx" | "sage" | "shimmer" | "verse";
519
+ };
520
+ "ovi-t2v": {
521
+ prompt: string;
522
+ size?: "9:16" | "16:9" | "1:1" | "9:16+" | "16:9+" | "2:5" | "5:2";
523
+ imageUrls?: string[];
524
+ };
525
+ "picsart-change-bg": {
526
+ imageUrls: [string, ...string[]];
527
+ prompt: string;
528
+ };
529
+ "picsart-enhance": {
530
+ imageUrls: [string, ...string[]];
531
+ };
532
+ "picsart-remove-bg": {
533
+ imageUrls: [string, ...string[]];
534
+ };
535
+ "pika-frames": {
536
+ prompt: string;
537
+ duration?: 5 | 10;
538
+ resolution?: "720p" | "1080p";
539
+ imageUrls: [string, ...string[]];
540
+ };
541
+ "pika-scenes": {
542
+ prompt: string;
543
+ duration?: 5 | 10;
544
+ aspectRatio?: "16:9" | "9:16" | "1:1" | "4:5" | "5:4" | "3:2" | "2:3";
545
+ resolution?: "720p" | "1080p";
546
+ imageUrls: [string, ...string[]];
547
+ };
548
+ "pika-t2v": {
549
+ prompt: string;
550
+ duration?: 5 | 10;
551
+ aspectRatio?: "16:9" | "9:16" | "1:1" | "4:5" | "5:4" | "3:2" | "2:3";
552
+ resolution?: "720p" | "1080p";
553
+ imageUrls?: string[];
554
+ };
555
+ "qwen": {
556
+ prompt: string;
557
+ count?: 1 | 2 | 4 | 6 | 8 | 10;
558
+ imageUrls?: string[];
559
+ };
560
+ "qwen-2": {
561
+ prompt: string;
562
+ count?: 1 | 2 | 4 | 6 | 8 | 10;
563
+ imageUrls?: string[];
564
+ };
565
+ "qwen-2-pro": {
566
+ prompt: string;
567
+ count?: 1 | 2 | 4 | 6 | 8 | 10;
568
+ imageUrls?: string[];
569
+ };
570
+ "qwen-edit-plus": {
571
+ prompt: string;
572
+ imageUrls: [string, ...string[]];
573
+ };
574
+ "recraft-creative-upscale": {
575
+ imageUrls: [string, ...string[]];
576
+ };
577
+ "recraft-crisp-upscale": {
578
+ imageUrls: [string, ...string[]];
579
+ };
580
+ "recraft-explore": {
581
+ prompt: string;
582
+ aspectRatio?: "1:1" | "4:3" | "3:4" | "3:2" | "2:3" | "16:9" | "9:16" | "2:1" | "1:2";
583
+ };
584
+ "recraft-explore-similar": {
585
+ aspectRatio?: "1:1" | "4:3" | "3:4" | "3:2" | "2:3" | "16:9" | "9:16" | "2:1" | "1:2";
586
+ sourceImageId: string;
587
+ similarity?: number;
588
+ };
589
+ "recraft-replace-bg": {
590
+ prompt?: string;
591
+ imageUrls: [string, ...string[]];
592
+ };
593
+ "recraft-v2": {
594
+ prompt: string;
595
+ style?: "realistic_image" | "digital_illustration" | "vector_illustration" | "icon";
596
+ aspectRatio?: "1:1" | "4:3" | "3:4" | "3:2" | "2:3" | "16:9" | "9:16" | "2:1" | "1:2";
597
+ count?: 1 | 2 | 4 | 6;
598
+ negativePrompt?: string;
599
+ };
600
+ "recraft-v2-vector": {
601
+ prompt: string;
602
+ aspectRatio?: "1:1" | "4:3" | "3:4" | "3:2" | "2:3" | "16:9" | "9:16" | "2:1" | "1:2";
603
+ count?: 1 | 2 | 4 | 6;
604
+ negativePrompt?: string;
605
+ };
606
+ "recraft-v3": {
607
+ prompt: string;
608
+ style?: "realistic_image" | "digital_illustration" | "vector_illustration" | "any";
609
+ aspectRatio?: "1:1" | "4:3" | "3:4" | "3:2" | "2:3" | "16:9" | "9:16" | "2:1" | "1:2";
610
+ count?: 1 | 2 | 4 | 6;
611
+ negativePrompt?: string;
612
+ imageUrls?: string[];
613
+ imageWeight?: number;
614
+ };
615
+ "recraft-v3-vector": {
616
+ prompt: string;
617
+ aspectRatio?: "1:1" | "4:3" | "3:4" | "3:2" | "2:3" | "16:9" | "9:16" | "2:1" | "1:2";
618
+ count?: 1 | 2 | 4 | 6;
619
+ negativePrompt?: string;
620
+ };
621
+ "recraft-v4": {
622
+ prompt: string;
623
+ style?: "raster" | "vector_illustration";
624
+ aspectRatio?: "1:1" | "4:3" | "3:4" | "3:2" | "2:3" | "16:9" | "9:16" | "2:1" | "1:2";
625
+ count?: 1 | 2 | 4 | 6;
626
+ };
627
+ "recraft-v4-pro": {
628
+ prompt: string;
629
+ style?: "raster" | "vector_illustration";
630
+ aspectRatio?: "1:1" | "4:3" | "3:4" | "3:2" | "2:3" | "16:9" | "9:16" | "2:1" | "1:2";
631
+ count?: 1 | 2 | 4 | 6;
632
+ };
633
+ "recraft-v4-pro-vector": {
634
+ prompt: string;
635
+ aspectRatio?: "1:1" | "4:3" | "3:4" | "3:2" | "2:3" | "16:9" | "9:16" | "2:1" | "1:2";
636
+ count?: 1 | 2 | 4 | 6;
637
+ };
638
+ "recraft-v4-vector": {
639
+ prompt: string;
640
+ aspectRatio?: "1:1" | "4:3" | "3:4" | "3:2" | "2:3" | "16:9" | "9:16" | "2:1" | "1:2";
641
+ count?: 1 | 2 | 4 | 6;
642
+ };
643
+ "recraft-vectorize": {
644
+ prompt?: string;
645
+ imageUrls: [string, ...string[]];
646
+ };
647
+ "reve": {
648
+ prompt: string;
649
+ aspectRatio?: "16:9" | "9:16" | "1:1" | "4:3" | "3:4" | "3:2" | "2:3";
650
+ count?: 1 | 2 | 4 | 6 | 8 | 10;
651
+ imageUrls?: string[];
652
+ negativePrompt?: string;
653
+ };
654
+ "runway-aleph": {
655
+ prompt: string;
656
+ videoUrl: string;
657
+ };
658
+ "runway-gen3a-turbo": {
659
+ prompt: string;
660
+ duration?: 5 | 10;
661
+ aspectRatio?: "16:9" | "9:16";
662
+ imageUrls: [string, ...string[]];
663
+ };
664
+ "runway-gen4-ref": {
665
+ prompt: string;
666
+ duration?: 5 | 10;
667
+ aspectRatio?: "16:9" | "9:16";
668
+ imageUrls: [string, ...string[]];
669
+ };
670
+ "runway-gen45-t2v": {
671
+ prompt: string;
672
+ duration?: 5 | 8 | 10;
673
+ aspectRatio?: "16:9" | "9:16";
674
+ imageUrls?: string[];
675
+ };
676
+ "seedance-1.5-pro": {
677
+ prompt: string;
678
+ aspectRatio?: "16:9" | "9:16" | "1:1" | "4:3" | "3:4" | "21:9" | "adaptive";
679
+ resolution?: "480p" | "720p";
680
+ duration?: 4 | 5 | 8 | 10 | 12;
681
+ generateAudio?: boolean;
682
+ };
683
+ "seedance-i2v": {
684
+ prompt: string;
685
+ aspectRatio?: "16:9" | "9:16" | "1:1" | "4:3" | "3:4" | "21:9" | "adaptive";
686
+ resolution?: "480p" | "720p" | "1080p";
687
+ duration?: 5 | 10;
688
+ imageUrls: [string, ...string[]];
689
+ };
690
+ "seedream-4.0": {
691
+ resolution?: "1K" | "2K" | "4K";
692
+ prompt: string;
693
+ aspectRatio?: "1:1" | "4:3" | "3:4" | "16:9" | "9:16" | "3:2" | "2:3" | "21:9";
694
+ count?: 1 | 2 | 4 | 6 | 8 | 10;
695
+ imageUrls?: string[];
696
+ negativePrompt?: string;
697
+ };
698
+ "seedream-4.5": {
699
+ resolution?: "2K" | "4K";
700
+ prompt: string;
701
+ aspectRatio?: "1:1" | "4:3" | "3:4" | "16:9" | "9:16" | "3:2" | "2:3" | "21:9";
702
+ count?: 1 | 2 | 4 | 6 | 8 | 10;
703
+ imageUrls?: string[];
704
+ negativePrompt?: string;
705
+ };
706
+ "seedream-5.0-lite": {
707
+ resolution?: "2K" | "3K";
708
+ prompt: string;
709
+ aspectRatio?: "1:1" | "4:3" | "3:4" | "16:9" | "9:16" | "3:2" | "2:3" | "21:9";
710
+ count?: 1 | 2 | 4 | 6 | 8 | 10;
711
+ imageUrls?: string[];
712
+ negativePrompt?: string;
713
+ };
714
+ "sora-2": {
715
+ prompt: string;
716
+ imageUrls?: string[];
717
+ aspectRatio?: "16:9" | "9:16";
718
+ duration?: 4 | 8 | 12 | 16 | 20;
719
+ };
720
+ "sora-2-extend": {
721
+ prompt: string;
722
+ videoUrl: string;
723
+ aspectRatio?: "16:9" | "9:16";
724
+ duration?: 4 | 8 | 12 | 16 | 20;
725
+ };
726
+ "sora-2-pro": {
727
+ prompt: string;
728
+ imageUrls?: string[];
729
+ aspectRatio?: "16:9" | "9:16";
730
+ resolution?: "720p" | "1080p";
731
+ duration?: 4 | 8 | 12 | 16 | 20;
732
+ };
733
+ "topaz-enhance-cgi": {
734
+ imageUrls: [string, ...string[]];
735
+ };
736
+ "topaz-enhance-high-fidelity-v2": {
737
+ imageUrls: [string, ...string[]];
738
+ };
739
+ "topaz-enhance-low-res-v2": {
740
+ imageUrls: [string, ...string[]];
741
+ };
742
+ "topaz-enhance-recovery": {
743
+ imageUrls: [string, ...string[]];
744
+ };
745
+ "topaz-enhance-recovery-v2": {
746
+ imageUrls: [string, ...string[]];
747
+ };
748
+ "topaz-enhance-redefine": {
749
+ imageUrls: [string, ...string[]];
750
+ };
751
+ "topaz-enhance-standard-v2": {
752
+ imageUrls: [string, ...string[]];
753
+ };
754
+ "topaz-enhance-text-refine": {
755
+ imageUrls: [string, ...string[]];
756
+ };
757
+ "topaz-upscale-image": {
758
+ imageUrls: [string, ...string[]];
759
+ };
760
+ "veed-fabric": {
761
+ prompt?: string;
762
+ resolution?: "480p" | "720p";
763
+ imageUrls: [string, ...string[]];
764
+ audioUrl: string;
765
+ };
766
+ "veed-fabric-fast": {
767
+ prompt?: string;
768
+ resolution?: "480p" | "720p";
769
+ imageUrls: [string, ...string[]];
770
+ audioUrl: string;
771
+ };
772
+ "veo-3.1": {
773
+ prompt: string;
774
+ aspectRatio?: "16:9" | "9:16";
775
+ duration?: 4 | 6 | 8;
776
+ resolution?: "720p" | "1080p" | "4k";
777
+ generateAudio?: boolean;
778
+ negativePrompt?: string;
779
+ };
780
+ "veo-3.1-fast": {
781
+ prompt: string;
782
+ aspectRatio?: "16:9" | "9:16";
783
+ duration?: 4 | 6 | 8;
784
+ resolution?: "720p" | "1080p" | "4k";
785
+ generateAudio?: boolean;
786
+ negativePrompt?: string;
787
+ };
788
+ "videography": {
789
+ imageUrls: [string, ...string[]];
790
+ };
791
+ "wan-2.6-image": {
792
+ prompt: string;
793
+ count?: 1 | 2 | 4 | 6 | 8 | 10;
794
+ negativePrompt?: string;
795
+ };
796
+ "wan-2.6-r2v": {
797
+ prompt: string;
798
+ duration?: 5 | 10;
799
+ resolution?: "720p" | "1080p";
800
+ videoUrl: string;
801
+ };
802
+ "wan-2.6-t2v": {
803
+ prompt: string;
804
+ duration?: 5 | 10 | 15;
805
+ resolution?: "480p" | "720p" | "1080p";
806
+ aspectRatio?: "16:9" | "9:16" | "1:1" | "4:3" | "3:4";
807
+ negativePrompt?: string;
808
+ cfgScale?: number;
809
+ imageUrls?: string[];
810
+ };
811
+ "wan-2.7-i2v": {
812
+ prompt?: string;
813
+ duration?: 5 | 10 | 15;
814
+ resolution?: "720P" | "1080P";
815
+ negativePrompt?: string;
816
+ enhancePrompt?: boolean;
817
+ imageUrls: [string, ...string[]];
818
+ audioUrl?: string;
819
+ };
820
+ "wan-2.7-r2v": {
821
+ prompt: string;
822
+ duration?: 5 | 10;
823
+ resolution?: "720P" | "1080P";
824
+ aspectRatio?: "16:9" | "9:16" | "1:1" | "4:3" | "3:4";
825
+ negativePrompt?: string;
826
+ imageUrls: [string, ...string[]];
827
+ videoUrl: string;
828
+ };
829
+ "wan-2.7-t2v": {
830
+ prompt: string;
831
+ duration?: 5 | 10 | 15;
832
+ resolution?: "720P" | "1080P";
833
+ aspectRatio?: "16:9" | "9:16" | "1:1" | "4:3" | "3:4";
834
+ negativePrompt?: string;
835
+ enhancePrompt?: boolean;
836
+ audioUrl?: string;
837
+ imageUrls?: string[];
838
+ };
839
+ "wan-2.7-video-edit": {
840
+ prompt?: string;
841
+ resolution?: "720P" | "1080P";
842
+ aspectRatio?: "16:9" | "9:16" | "1:1" | "4:3" | "3:4";
843
+ negativePrompt?: string;
844
+ videoUrl: string;
845
+ imageUrls?: string[];
846
+ };
847
+ };
848
+ type TypedModelId = keyof ModelInputById;
849
+ type ModelInput<M extends TypedModelId> = ModelInputById[M];
850
+
851
+ /** A fetch-like function that handles authentication (headers, cookies, etc.). */
852
+ type AuthenticatedFetch = (url: string, init?: RequestInit) => Promise<Response>;
853
+ /** Drive configuration — enables auto-saving generations to Picsart Drive. */
854
+ interface DriveConfig {
855
+ /** Root folder name in Drive. All generations save here. */
856
+ folder: string;
857
+ }
858
+ /**
859
+ * Simple client config — pass an authenticated fetch and the SDK handles the rest.
860
+ * The SDK knows the Picsart API endpoints and response shapes internally.
861
+ */
862
+ interface ClientConfig {
863
+ /** Authenticated fetch function. The SDK calls this for all HTTP requests. */
864
+ fetch: AuthenticatedFetch;
865
+ /** API base URL (e.g. 'https://api.picsart.com'). */
866
+ apiUrl: string;
867
+ /** Enable Drive integration — auto-save generations to a Drive folder. */
868
+ drive?: DriveConfig;
869
+ }
870
+ /**
871
+ * Advanced transport — full control over each operation.
872
+ * Use this when you need custom request/response handling beyond what fetch provides.
873
+ */
874
+ interface SdkTransport extends WorkflowTransport {
875
+ execute?(request: {
876
+ workflow: string;
877
+ payload: unknown;
878
+ signal?: AbortSignal;
879
+ }): Promise<unknown>;
880
+ cancel?(handle: {
881
+ workflow: string;
882
+ id: string;
883
+ }, signal?: AbortSignal): Promise<void>;
884
+ options?(workflow: string, payload: Record<string, unknown>): Promise<number | null>;
885
+ creditBalance?(): Promise<number | null>;
886
+ }
887
+ /** A folder reference in Picsart Drive. */
888
+ interface DriveFolder {
889
+ name: string;
890
+ uid: string;
891
+ }
892
+ /** Drive save result, attached to GenerateResult when drive is enabled. */
893
+ interface DriveSaveResult {
894
+ uid: string;
895
+ folder: DriveFolder;
896
+ }
897
+ interface GenerateResultItem {
898
+ url: string;
899
+ metadata?: Record<string, unknown>;
900
+ }
901
+ interface GenerateResult {
902
+ /** Primary result URL (convenience shortcut for results[0].url). */
903
+ url: string;
904
+ /** All result items — single item for normal models, multiple for explore/multi-result models. */
905
+ results: GenerateResultItem[];
906
+ /** Model ID that produced this result. */
907
+ model: string;
908
+ /** Job handle for status tracking. */
909
+ handle: WorkflowJobHandle;
910
+ /** Raw parsed output for advanced consumers. */
911
+ raw: unknown;
912
+ /** Present when Drive is enabled and the file was saved. */
913
+ drive?: DriveSaveResult;
914
+ }
915
+ /** Target folder for backend Drive save. */
916
+ interface PayloadDriveFolderOptions {
917
+ /** Folder path — backend resolves it (e.g. 'AI Playground' or 'AI Playground/My Board'). */
918
+ path?: string;
919
+ /** Folder UID — overrides path when provided. */
920
+ id?: string;
921
+ }
922
+ /** Drive save options injected into the workflow payload as `options.drive`. */
923
+ interface PayloadDriveOptions {
924
+ /** Filename for the saved asset. */
925
+ name: string;
926
+ /** Custom attributes to attach to the file (tool, model, prompt, etc.). */
927
+ attributes?: Record<string, unknown>;
928
+ /** Target folder in Picsart Drive. */
929
+ folder?: PayloadDriveFolderOptions;
930
+ }
931
+ /** Options for individual generate() / submit() calls. */
932
+ interface GenerateOptions {
933
+ signal?: AbortSignal;
934
+ /** Save to a specific subfolder instead of the root (legacy — used by SDK DriveConfig). */
935
+ folder?: DriveFolder;
936
+ /** Save result to Picsart Drive via backend. Injected into the workflow payload. */
937
+ drive?: PayloadDriveOptions;
938
+ }
939
+ /** AI SDK client with type-safe, model-aware method signatures. */
940
+ interface AiClient {
941
+ /** Generate content using a model. Params are type-checked against the model's schema. */
942
+ generate<M extends TypedModelId>(model: M, params: ModelInputById[M], options?: GenerateOptions): Promise<GenerateResult>;
943
+ /** Estimate credit cost for a generation. */
944
+ estimate<M extends TypedModelId>(model: M, params: ModelInputById[M]): Promise<number | null>;
945
+ /** Submit a generation job and get a handle back. */
946
+ submit<M extends TypedModelId>(model: M, params: ModelInputById[M], options?: GenerateOptions): Promise<WorkflowJobHandle>;
947
+ /** Check the current status of a submitted job. */
948
+ status(handle: WorkflowJobHandle, signal?: AbortSignal): Promise<WorkflowStatusResult<unknown>>;
949
+ /** Poll a submitted job until it completes and return the parsed result. */
950
+ result(handle: WorkflowJobHandle, model: TypedModelId, options?: WorkflowPollOptions): Promise<GenerateResult>;
951
+ /** Subscribe to live status updates for a submitted job. */
952
+ subscribe(handle: WorkflowJobHandle, options?: WorkflowSubscribeOptions): AsyncGenerator<WorkflowStatusResult<unknown>, WorkflowStatusResult<unknown>, void>;
953
+ /** Build the vendor-specific payload for a model without submitting. */
954
+ buildPayload<M extends TypedModelId>(model: M, params: ModelInputById[M]): Record<string, unknown>;
955
+ /** Cancel a running job. */
956
+ cancel(handle: WorkflowJobHandle, signal?: AbortSignal): Promise<void>;
957
+ /** Run a raw workflow (not tied to a model). */
958
+ runWorkflow<TResult = unknown>(workflow: string, payload: Record<string, unknown>, options?: WorkflowRunOptions): Promise<TResult>;
959
+ /** Drive operations. Only available when drive config is provided. */
960
+ drive: {
961
+ ensureFolder(subfolder?: string): Promise<DriveFolder | null>;
962
+ folders(): Promise<DriveFolder[]>;
963
+ allFolders(): Promise<DriveFolder[]>;
964
+ findFolder(name: string): Promise<DriveFolder | null>;
965
+ list(options?: {
966
+ folder?: DriveFolder;
967
+ type?: string;
968
+ }): Promise<{
969
+ uid: string;
970
+ url: string;
971
+ name: string;
972
+ type: 'image' | 'video' | 'audio';
973
+ previewUrl?: string;
974
+ timestamp: number;
975
+ }[]>;
976
+ listDetailed(options?: {
977
+ folder?: DriveFolder;
978
+ type?: string;
979
+ }): Promise<{
980
+ uid: string;
981
+ url: string;
982
+ name: string;
983
+ type: 'image' | 'video' | 'audio';
984
+ previewUrl?: string;
985
+ timestamp: number;
986
+ createdAt?: string;
987
+ model?: string;
988
+ prompt?: string;
989
+ service?: string;
990
+ subType?: string;
991
+ duration?: string;
992
+ aspectRatio?: string;
993
+ resolution?: string;
994
+ quality?: string;
995
+ referenceImageUrls?: string[];
996
+ referenceVideoUrl?: string;
997
+ referenceAudioUrl?: string;
998
+ }[]>;
999
+ save(params: {
1000
+ url: string;
1001
+ name: string;
1002
+ resourceType: string;
1003
+ attributes?: Record<string, string>;
1004
+ previewUrl?: string;
1005
+ }, folder?: DriveFolder): Promise<DriveSaveResult | null>;
1006
+ buildSaveParams(url: string, modelId: string, modelName: string, mode: string, prompt?: string): {
1007
+ url: string;
1008
+ name: string;
1009
+ resourceType: string;
1010
+ attributes?: Record<string, string>;
1011
+ previewUrl?: string;
1012
+ };
1013
+ } | undefined;
1014
+ }
1015
+
1016
+ /**
1017
+ * Drive client — manages folders and file saving in Picsart Drive.
1018
+ *
1019
+ * Uses the same authenticated fetch as the generation client.
1020
+ * Root folder is auto-created on first use and cached.
1021
+ */
1022
+
1023
+ type MediaTypeFilter = 'image' | 'video' | 'audio';
1024
+ interface DriveMediaItem {
1025
+ uid: string;
1026
+ url: string;
1027
+ name: string;
1028
+ type: MediaTypeFilter;
1029
+ previewUrl?: string;
1030
+ timestamp: number;
1031
+ }
1032
+ interface DriveFileDetails extends DriveMediaItem {
1033
+ createdAt?: string;
1034
+ model?: string;
1035
+ prompt?: string;
1036
+ service?: string;
1037
+ subType?: string;
1038
+ duration?: string;
1039
+ aspectRatio?: string;
1040
+ resolution?: string;
1041
+ quality?: string;
1042
+ referenceImageUrls?: string[];
1043
+ referenceVideoUrl?: string;
1044
+ referenceAudioUrl?: string;
1045
+ }
1046
+ interface ListOptions {
1047
+ folder?: DriveFolder;
1048
+ type?: MediaTypeFilter;
1049
+ }
1050
+ interface SaveParams {
1051
+ url: string;
1052
+ name: string;
1053
+ resourceType: 'PHOTO' | 'VIDEO' | 'AUDIO';
1054
+ attributes?: Record<string, string>;
1055
+ previewUrl?: string;
1056
+ }
1057
+ declare function inferResourceType(mode: string): 'PHOTO' | 'VIDEO' | 'AUDIO';
1058
+ declare function buildFilename(prompt: string | undefined, mode: string): string;
1059
+
1060
+ /**
1061
+ * Create an AI SDK client.
1062
+ *
1063
+ * @example Simple — pass an authenticated fetch:
1064
+ * ```ts
1065
+ * const ai = createClient({ fetch: myAuthenticatedFetch });
1066
+ * ```
1067
+ *
1068
+ * @example With Drive — auto-save generations:
1069
+ * ```ts
1070
+ * const ai = createClient({
1071
+ * fetch: myAuthenticatedFetch,
1072
+ * drive: { folder: 'AI Playground' },
1073
+ * });
1074
+ * ```
1075
+ */
1076
+ declare function createClient(config: ClientConfig | SdkTransport): AiClient;
1077
+
1078
+ interface ParamSchema {
1079
+ type: 'string' | 'number' | 'boolean' | 'file';
1080
+ enum?: (string | number)[];
1081
+ default?: string | number | boolean;
1082
+ min?: number;
1083
+ max?: number;
1084
+ step?: number;
1085
+ required?: boolean;
1086
+ label?: string;
1087
+ accept?: string;
1088
+ }
1089
+ type ModelParamSchema = Record<string, ParamSchema>;
1090
+
1091
+ /**
1092
+ * Param Descriptor types — the new, open-ended parameter definition system.
1093
+ *
1094
+ * Each model defines `params: ModelParams` (a Record of ParamEntry).
1095
+ * Consumers iterate descriptors generically instead of switching on named ParamConfig fields.
1096
+ */
1097
+ interface EnumDescriptor<T extends string | number = string> {
1098
+ kind: 'enum';
1099
+ valueType: 'string' | 'number';
1100
+ options: Array<{
1101
+ id: T;
1102
+ label?: string;
1103
+ }>;
1104
+ default: T;
1105
+ }
1106
+ interface RangeDescriptor {
1107
+ kind: 'range';
1108
+ min: number;
1109
+ max: number;
1110
+ step?: number;
1111
+ default: number;
1112
+ }
1113
+ interface BooleanDescriptor {
1114
+ kind: 'boolean';
1115
+ default: boolean;
1116
+ }
1117
+ interface TextDescriptor {
1118
+ kind: 'text';
1119
+ maxLength?: number;
1120
+ placeholder?: string;
1121
+ }
1122
+ interface FileDescriptor {
1123
+ kind: 'file';
1124
+ accept: 'image' | 'video' | 'audio' | 'media';
1125
+ max: number;
1126
+ }
1127
+ interface ObjectDescriptor {
1128
+ kind: 'object';
1129
+ fields: Record<string, ParamDescriptor>;
1130
+ array?: {
1131
+ min?: number;
1132
+ max?: number;
1133
+ };
1134
+ }
1135
+ type ParamDescriptor = EnumDescriptor<string> | EnumDescriptor<number> | RangeDescriptor | BooleanDescriptor | TextDescriptor | FileDescriptor | ObjectDescriptor;
1136
+ interface ParamEntry {
1137
+ label?: string;
1138
+ required?: boolean;
1139
+ descriptor: ParamDescriptor;
1140
+ /** Original rich option objects (e.g. VoiceOption[], AvatarOption[]) preserved for UI catalogs. */
1141
+ catalogOptions?: readonly unknown[];
1142
+ }
1143
+ type ModelParams = Record<string, ParamEntry>;
1144
+ interface EntryMeta {
1145
+ label?: string;
1146
+ required?: boolean;
1147
+ catalogOptions?: readonly unknown[];
1148
+ }
1149
+ type EnumEntry = EntryMeta & EnumDescriptor<string | number>;
1150
+ type RangeEntry = EntryMeta & RangeDescriptor;
1151
+ type BooleanEntry = EntryMeta & BooleanDescriptor;
1152
+ type TextEntry = EntryMeta & TextDescriptor;
1153
+ type FileEntry = EntryMeta & FileDescriptor;
1154
+ type ObjectEntry = EntryMeta & ObjectDescriptor;
1155
+ /** Flat param entry with key — returned by ModelAccessor.params(). */
1156
+ type FlatParamEntry = EntryMeta & ParamDescriptor & {
1157
+ key: string;
1158
+ };
1159
+
1160
+ /** Provider metadata. */
1161
+ interface ProviderInfo {
1162
+ readonly id: Provider;
1163
+ readonly name: string;
1164
+ readonly color: string;
1165
+ readonly label: string;
1166
+ }
1167
+ /** Model metadata — classification, display, provider. */
1168
+ interface ModelMeta {
1169
+ readonly mode: GenerationMode;
1170
+ readonly inputType: InputType;
1171
+ readonly description: string;
1172
+ readonly features: ModelFeature[];
1173
+ readonly badges: BadgeType[];
1174
+ readonly provider: ProviderInfo;
1175
+ }
1176
+ /** Parameter operations — fluent access to model params, schemas, defaults. */
1177
+ interface ModelParamsAccessor {
1178
+ param(key: string): ParamEntry | undefined;
1179
+ hasParam(key: string): boolean;
1180
+ all(): FlatParamEntry[];
1181
+ enum(key: string): EnumEntry | undefined;
1182
+ range(key: string): RangeEntry | undefined;
1183
+ boolean(key: string): BooleanEntry | undefined;
1184
+ text(key: string): TextEntry | undefined;
1185
+ file(key: string): FileEntry | undefined;
1186
+ prompt(): TextEntry | undefined;
1187
+ aspectRatio(): EnumEntry | undefined;
1188
+ duration(): EnumEntry | undefined;
1189
+ resolution(): EnumEntry | undefined;
1190
+ generateAudio(): BooleanEntry | undefined;
1191
+ startFrame(): FileEntry | undefined;
1192
+ endFrame(): FileEntry | undefined;
1193
+ hasFileInput(): boolean;
1194
+ getDefault(key: string): unknown;
1195
+ getDefaults(): Record<string, unknown>;
1196
+ getEnumOptions(key: string): (string | number)[] | null;
1197
+ getRange(key: string): {
1198
+ min: number;
1199
+ max: number;
1200
+ step?: number;
1201
+ default: number;
1202
+ } | null;
1203
+ getFileParam(key: string): {
1204
+ required: boolean;
1205
+ max: number;
1206
+ label?: string;
1207
+ accept?: string;
1208
+ } | null;
1209
+ toSchema(): ModelParamSchema;
1210
+ transferValues(prev: Record<string, unknown>): Record<string, unknown>;
1211
+ }
1212
+
1213
+ /** Top-level model accessor with grouped sub-accessors. */
1214
+ interface ModelDescriptor {
1215
+ readonly id: TypedModelId;
1216
+ readonly name: string;
1217
+ params(): ModelParamsAccessor;
1218
+ meta(): ModelMeta;
1219
+ /** Workflow identifiers for this model. */
1220
+ readonly api: {
1221
+ /** Primary workflow name for generation. */
1222
+ readonly workflow: string;
1223
+ /** Edit/I2V workflow name (when different from primary). */
1224
+ readonly editWorkflow: string | undefined;
1225
+ };
1226
+ }
1227
+ /** Filter criteria for `Model.find()`. */
1228
+ interface ModelFilter$1 {
1229
+ output?: GenerationMode;
1230
+ provider?: string;
1231
+ }
1232
+
1233
+ type AppProvider = 'picsart' | 'google' | 'kling' | 'grok' | 'openai' | 'flux' | 'ideogram' | 'elevenlabs' | 'minimax' | 'wan' | 'seedance' | 'ltx' | 'seedream' | 'hunyuan' | 'pika' | 'runway' | 'luma' | 'ovi' | 'creatify' | 'veed' | 'bytedance' | 'qwen' | 'reve' | 'recraft' | 'videography' | 'topaz' | 'heygen';
1234
+ /** Provider used by model definitions. */
1235
+ type Provider = AppProvider;
1236
+ /** App generation modes. */
1237
+ type GenerationMode = 'video' | 'image' | 'audio';
1238
+ /** App input types. */
1239
+ type InputType = 't2v' | 'i2v' | 'v2v' | 'a2v' | 't2i' | 'i2i' | 't2a' | 'v2a' | 'tts' | 'sts' | 'sfx' | 'music';
1240
+ interface ModelFeature {
1241
+ label: string;
1242
+ variant: 'frame' | 'resolution' | 'audio' | 'duration' | 'input' | 'quality' | 'style' | 'characteristic';
1243
+ }
1244
+ interface VoiceOption {
1245
+ id: string;
1246
+ name: string;
1247
+ description: string;
1248
+ tags: string[];
1249
+ provider: Provider;
1250
+ previewUrl?: string;
1251
+ }
1252
+ interface AvatarOption {
1253
+ id: string;
1254
+ name: string;
1255
+ description: string;
1256
+ tags: string[];
1257
+ provider: Provider;
1258
+ previewImageUrl?: string;
1259
+ previewVideoUrl?: string;
1260
+ gender?: string;
1261
+ defaultVoiceId?: string;
1262
+ }
1263
+ interface ParamOption {
1264
+ id: string;
1265
+ label: string;
1266
+ }
1267
+ interface GenerationContext {
1268
+ prompt: string;
1269
+ aspectRatio?: string;
1270
+ duration?: number;
1271
+ resolution?: string;
1272
+ count?: number;
1273
+ generateAudio?: boolean;
1274
+ enhancePrompt?: boolean;
1275
+ imageUrls?: string[];
1276
+ startFrame?: string;
1277
+ endFrame?: string;
1278
+ videoUrl?: string;
1279
+ audioUrl?: string;
1280
+ /** Audio file for voice/audio models. Accepts File (browser) or Blob (Node 18+). */
1281
+ audioFile?: Blob;
1282
+ voiceId?: string;
1283
+ videoId?: string;
1284
+ modelId?: string;
1285
+ removeBackgroundNoise?: boolean;
1286
+ language?: string;
1287
+ accent?: string;
1288
+ style?: string;
1289
+ substyle?: string;
1290
+ quality?: string;
1291
+ size?: string;
1292
+ negativePrompt?: string;
1293
+ cfgScale?: number;
1294
+ imageWeight?: number;
1295
+ renderingSpeed?: string;
1296
+ cameraControl?: {
1297
+ type: string;
1298
+ config?: Record<string, number>;
1299
+ };
1300
+ multiShot?: boolean;
1301
+ shotType?: string;
1302
+ multiPrompt?: Array<{
1303
+ index: number;
1304
+ prompt: string;
1305
+ duration: string;
1306
+ }>;
1307
+ elementList?: Array<{
1308
+ element_id: number;
1309
+ }>;
1310
+ voiceList?: Array<{
1311
+ voice_id: string;
1312
+ }>;
1313
+ dynamicMasks?: Array<{
1314
+ mask: string;
1315
+ trajectories: Array<{
1316
+ x: number;
1317
+ y: number;
1318
+ }>;
1319
+ }>;
1320
+ staticMask?: string;
1321
+ callbackUrl?: string;
1322
+ externalTaskId?: string;
1323
+ mentionedPersonas?: Array<{
1324
+ id: string;
1325
+ name: string;
1326
+ imageUrl: string;
1327
+ vibeId: string;
1328
+ }>;
1329
+ background?: string;
1330
+ outputFormat?: string;
1331
+ guidance?: number;
1332
+ seed?: number;
1333
+ outputMegapixels?: number;
1334
+ exploreImageId?: string;
1335
+ sourceImageId?: string;
1336
+ /** Display-only URL for the source image (not sent to API, used for UI preview). */
1337
+ sourceImageUrl?: string;
1338
+ similarity?: number;
1339
+ }
1340
+ type PayloadBuilder<TContext extends GenerationContext = GenerationContext> = (ctx: TContext) => Record<string, unknown>;
1341
+ /** Lightweight runtime schema contract used by SDK integrations. */
1342
+ interface RuntimeSchema<T = unknown> {
1343
+ parse(input: unknown): T;
1344
+ }
1345
+ /** Pricing unit type — determines how per-unit rate is multiplied on the client.
1346
+ * - per_second: rate × duration (video/audio)
1347
+ * - per_minute: rate × (duration / 60)
1348
+ * - per_image: rate (flat per image; count multiplied separately in UI)
1349
+ * - per_megapixel: rate × megapixels
1350
+ * - per_character: rate × prompt length
1351
+ * - per_1k_character: rate × (prompt length / 1000)
1352
+ * - per_video: rate (flat per video)
1353
+ * - per_audio: rate (flat per audio)
1354
+ */
1355
+ type PricingUnit = 'per_second' | 'per_minute' | 'per_image' | 'per_megapixel' | 'per_character' | 'per_1k_character' | 'per_video' | 'per_audio';
1356
+ /** Maps a model to its backend toolId(s) for monetization.
1357
+ * Recursive — dimensions can be nested (e.g. audio inside resolution).
1358
+ * - string: single flat toolId
1359
+ * - { by: 'audio', on, off } — keyed by generateAudio boolean
1360
+ * - { by: 'resolution', map } — keyed by resolution string, e.g. '720p' | '1080p'
1361
+ * - { by: 'quality', map } — keyed by quality string, e.g. 'high' | 'medium' | 'low'
1362
+ * - { by: 'renderingSpeed', map } — keyed by renderingSpeed, e.g. 'std' | 'pro'
1363
+ * - { by: 'duration', map } — keyed by duration number as string, e.g. '5' | '10'
1364
+ * - { by: 'megapixel', map } — keyed by MP threshold as string (e.g. '24', '48'); resolver picks smallest tier >= outputMegapixels
1365
+ */
1366
+ type ToolIdMapping = string | {
1367
+ by: 'audio';
1368
+ on: ToolIdMapping;
1369
+ off: ToolIdMapping;
1370
+ } | {
1371
+ by: 'resolution';
1372
+ map: Record<string, ToolIdMapping>;
1373
+ } | {
1374
+ by: 'quality';
1375
+ map: Record<string, ToolIdMapping>;
1376
+ } | {
1377
+ by: 'renderingSpeed';
1378
+ map: Record<string, ToolIdMapping>;
1379
+ } | {
1380
+ by: 'duration';
1381
+ map: Record<string, ToolIdMapping>;
1382
+ } | {
1383
+ by: 'megapixel';
1384
+ map: Record<string, ToolIdMapping>;
1385
+ };
1386
+ type BadgeType = 'new' | 'popular' | 'coming-soon' | 'fast' | 'premium' | 'hot' | 'ultra';
1387
+ interface ModelDefinition {
1388
+ id: string;
1389
+ name: string;
1390
+ provider: Provider;
1391
+ workflow: string;
1392
+ editWorkflow?: string;
1393
+ syncExecute?: boolean;
1394
+ /** Provider display name (e.g. 'Flux', 'OpenAI', 'Kling'). */
1395
+ providerName: string;
1396
+ /** Provider brand color hex (e.g. '#FF6B6B'). */
1397
+ providerColor: string;
1398
+ /** Provider short label (e.g. 'F', 'O', 'K'). */
1399
+ providerLabel: string;
1400
+ description: string;
1401
+ features: ModelFeature[];
1402
+ badge?: BadgeType[];
1403
+ disabled?: boolean;
1404
+ mode: GenerationMode;
1405
+ inputType: InputType;
1406
+ modelId?: string;
1407
+ paramConfig: ModelParams;
1408
+ /** Payload builder. Optional — omit for pass-through (param values sent as-is). */
1409
+ buildPayload?: PayloadBuilder;
1410
+ /** I2V/edit payload builder when different from buildPayload. */
1411
+ buildEditPayload?: PayloadBuilder;
1412
+ outputSchema?: RuntimeSchema<unknown>;
1413
+ toolId?: ToolIdMapping;
1414
+ editToolId?: ToolIdMapping;
1415
+ pricingUnit?: PricingUnit;
1416
+ estimatedTime?: number | Record<string, number>;
1417
+ editEstimatedTime?: number | Record<string, number>;
1418
+ testTimeout?: number;
1419
+ /** Credit prices per toolId, populated from vendor config. */
1420
+ creditPrice?: Record<string, number>;
1421
+ }
1422
+
1423
+ /**
1424
+ * Typed Models constants and namespace.
1425
+ * Regenerate with: npm run build:model-constants
1426
+ */
1427
+
1428
+ interface ValidationResult {
1429
+ valid: boolean;
1430
+ errors?: string[];
1431
+ }
1432
+ interface ModelFilter {
1433
+ mode?: GenerationMode;
1434
+ provider?: string;
1435
+ }
1436
+ declare const Models: {
1437
+ readonly BytedanceOmnihuman: "bytedance-omnihuman";
1438
+ readonly BytedanceUpscaler: "bytedance-upscaler";
1439
+ readonly CreatifyAurora: "creatify-aurora";
1440
+ readonly ElevenAudioIsolation: "eleven-audio-isolation";
1441
+ readonly ElevenDubbing: "eleven-dubbing";
1442
+ readonly ElevenMultilingualStsV2: "eleven-multilingual-sts-v2";
1443
+ readonly ElevenMultilingualV2: "eleven-multilingual-v2";
1444
+ readonly ElevenStsV2: "eleven-sts-v2";
1445
+ readonly ElevenV3: "eleven-v3";
1446
+ readonly ElevenVoiceDesignV2: "eleven-voice-design-v2";
1447
+ readonly ElevenVoiceDesignV3: "eleven-voice-design-v3";
1448
+ readonly ElevenVoicePreviews: "eleven-voice-previews";
1449
+ readonly ElevenVoiceRemix: "eleven-voice-remix";
1450
+ readonly ElevenlabsSfx: "elevenlabs-sfx";
1451
+ readonly Flux2Flex: "flux-2-flex";
1452
+ readonly Flux2Max: "flux-2-max";
1453
+ readonly Flux2Pro: "flux-2-pro";
1454
+ readonly FluxKontextMax: "flux-kontext-max";
1455
+ readonly FluxKontextPro: "flux-kontext-pro";
1456
+ readonly Gemini25FlashImage: "gemini-2.5-flash-image";
1457
+ readonly Gemini25FlashTts: "gemini-2.5-flash-tts";
1458
+ readonly Gemini25ProTts: "gemini-2.5-pro-tts";
1459
+ readonly Gemini3ProImage: "gemini-3-pro-image";
1460
+ readonly Gemini31FlashImage: "gemini-3.1-flash-image";
1461
+ readonly GptImage1: "gpt-image-1";
1462
+ readonly GptImage15: "gpt-image-1.5";
1463
+ readonly Grok: "grok";
1464
+ readonly GrokEditVideo: "grok-edit-video";
1465
+ readonly GrokImagine: "grok-imagine";
1466
+ readonly Hailuo23: "hailuo-2.3";
1467
+ readonly Hailuo23Fast: "hailuo-2.3-fast";
1468
+ readonly Hailuo23FastPro: "hailuo-2.3-fast-pro";
1469
+ readonly Hailuo23Pro: "hailuo-2.3-pro";
1470
+ readonly HeygenTalkingPhoto: "heygen-talking-photo";
1471
+ readonly HeygenVideoAvatar: "heygen-video-avatar";
1472
+ readonly HunyuanV3: "hunyuan-v3";
1473
+ readonly IdeogramCharacter: "ideogram-character";
1474
+ readonly IdeogramV3: "ideogram-v3";
1475
+ readonly Imagen40: "imagen-4.0";
1476
+ readonly Imagen40Fast: "imagen-4.0-fast";
1477
+ readonly Imagen40Ultra: "imagen-4.0-ultra";
1478
+ readonly Kling26Pro: "kling-2.6-pro";
1479
+ readonly Kling26Standard: "kling-2.6-standard";
1480
+ readonly Kling30Image: "kling-3.0-image";
1481
+ readonly Kling30Pro: "kling-3.0-pro";
1482
+ readonly Kling30Standard: "kling-3.0-standard";
1483
+ readonly KlingAvatar: "kling-avatar";
1484
+ readonly KlingMotionControl: "kling-motion-control";
1485
+ readonly KlingMotionControlV3: "kling-motion-control-v3";
1486
+ readonly KlingMultiImage: "kling-multi-image";
1487
+ readonly KlingMultiImageV21: "kling-multi-image-v2-1";
1488
+ readonly KlingO1Image: "kling-o1-image";
1489
+ readonly KlingO1Pro: "kling-o1-pro";
1490
+ readonly KlingO3Pro: "kling-o3-pro";
1491
+ readonly KlingO3Standard: "kling-o3-standard";
1492
+ readonly KlingOmni: "kling-omni";
1493
+ readonly KlingT2a: "kling-t2a";
1494
+ readonly KlingV15Image: "kling-v1-5-image";
1495
+ readonly KlingV21Image: "kling-v2-1-image";
1496
+ readonly KlingV2Image: "kling-v2-image";
1497
+ readonly KlingV2NewImage: "kling-v2-new-image";
1498
+ readonly KlingV2a: "kling-v2a";
1499
+ readonly Ltx23A2v: "ltx-2.3-a2v";
1500
+ readonly Ltx23Extend: "ltx-2.3-extend";
1501
+ readonly Ltx23FastT2v: "ltx-2.3-fast-t2v";
1502
+ readonly Ltx23ProT2v: "ltx-2.3-pro-t2v";
1503
+ readonly Ltx23Retake: "ltx-2.3-retake";
1504
+ readonly LtxFastT2v: "ltx-fast-t2v";
1505
+ readonly LtxProT2v: "ltx-pro-t2v";
1506
+ readonly LtxRetake: "ltx-retake";
1507
+ readonly LumaFlash2I2v: "luma-flash2-i2v";
1508
+ readonly LumaRay2T2v: "luma-ray2-t2v";
1509
+ readonly Lyria3Clip: "lyria-3-clip";
1510
+ readonly Lyria3Pro: "lyria-3-pro";
1511
+ readonly Minimax02Hd: "minimax-02-hd";
1512
+ readonly MinimaxMusic: "minimax-music";
1513
+ readonly OpenaiTts1: "openai-tts-1";
1514
+ readonly OpenaiTts1Hd: "openai-tts-1-hd";
1515
+ readonly OviT2v: "ovi-t2v";
1516
+ readonly PicsartChangeBg: "picsart-change-bg";
1517
+ readonly PicsartEnhance: "picsart-enhance";
1518
+ readonly PicsartRemoveBg: "picsart-remove-bg";
1519
+ readonly PikaFrames: "pika-frames";
1520
+ readonly PikaScenes: "pika-scenes";
1521
+ readonly PikaT2v: "pika-t2v";
1522
+ readonly Qwen: "qwen";
1523
+ readonly Qwen2: "qwen-2";
1524
+ readonly Qwen2Pro: "qwen-2-pro";
1525
+ readonly QwenEditPlus: "qwen-edit-plus";
1526
+ readonly RecraftCreativeUpscale: "recraft-creative-upscale";
1527
+ readonly RecraftCrispUpscale: "recraft-crisp-upscale";
1528
+ readonly RecraftExplore: "recraft-explore";
1529
+ readonly RecraftExploreSimilar: "recraft-explore-similar";
1530
+ readonly RecraftReplaceBg: "recraft-replace-bg";
1531
+ readonly RecraftV2: "recraft-v2";
1532
+ readonly RecraftV2Vector: "recraft-v2-vector";
1533
+ readonly RecraftV3: "recraft-v3";
1534
+ readonly RecraftV3Vector: "recraft-v3-vector";
1535
+ readonly RecraftV4: "recraft-v4";
1536
+ readonly RecraftV4Pro: "recraft-v4-pro";
1537
+ readonly RecraftV4ProVector: "recraft-v4-pro-vector";
1538
+ readonly RecraftV4Vector: "recraft-v4-vector";
1539
+ readonly RecraftVectorize: "recraft-vectorize";
1540
+ readonly Reve: "reve";
1541
+ readonly RunwayAleph: "runway-aleph";
1542
+ readonly RunwayGen3aTurbo: "runway-gen3a-turbo";
1543
+ readonly RunwayGen4Ref: "runway-gen4-ref";
1544
+ readonly RunwayGen45T2v: "runway-gen45-t2v";
1545
+ readonly Seedance15Pro: "seedance-1.5-pro";
1546
+ readonly Seedance20: "seedance-2.0";
1547
+ readonly Seedance20Fast: "seedance-2.0-fast";
1548
+ readonly SeedanceI2v: "seedance-i2v";
1549
+ readonly Seedream40: "seedream-4.0";
1550
+ readonly Seedream45: "seedream-4.5";
1551
+ readonly Seedream50Lite: "seedream-5.0-lite";
1552
+ readonly Sora2: "sora-2";
1553
+ readonly Sora2Extend: "sora-2-extend";
1554
+ readonly Sora2Pro: "sora-2-pro";
1555
+ readonly TopazEnhanceCgi: "topaz-enhance-cgi";
1556
+ readonly TopazEnhanceHighFidelityV2: "topaz-enhance-high-fidelity-v2";
1557
+ readonly TopazEnhanceLowResV2: "topaz-enhance-low-res-v2";
1558
+ readonly TopazEnhanceRecovery: "topaz-enhance-recovery";
1559
+ readonly TopazEnhanceRecoveryV2: "topaz-enhance-recovery-v2";
1560
+ readonly TopazEnhanceRedefine: "topaz-enhance-redefine";
1561
+ readonly TopazEnhanceStandardV2: "topaz-enhance-standard-v2";
1562
+ readonly TopazEnhanceTextRefine: "topaz-enhance-text-refine";
1563
+ readonly TopazUpscaleImage: "topaz-upscale-image";
1564
+ readonly VeedFabric: "veed-fabric";
1565
+ readonly VeedFabricFast: "veed-fabric-fast";
1566
+ readonly Veo31: "veo-3.1";
1567
+ readonly Veo31Fast: "veo-3.1-fast";
1568
+ readonly Videography: "videography";
1569
+ readonly Wan26Image: "wan-2.6-image";
1570
+ readonly Wan26R2v: "wan-2.6-r2v";
1571
+ readonly Wan26T2v: "wan-2.6-t2v";
1572
+ readonly Wan27I2v: "wan-2.7-i2v";
1573
+ readonly Wan27R2v: "wan-2.7-r2v";
1574
+ readonly Wan27T2v: "wan-2.7-t2v";
1575
+ readonly Wan27VideoEdit: "wan-2.7-video-edit";
1576
+ /** List all models, optionally filtered by mode and/or provider. */
1577
+ readonly list: (filter?: ModelFilter) => ModelDefinition[];
1578
+ /** Validate generation input against a model's constraints. */
1579
+ readonly validate: (model: string, input: unknown) => ValidationResult;
1580
+ /** @deprecated Use `Model(id).params().toSchema()` instead. */
1581
+ readonly toSchema: (id: string) => ModelParamSchema;
1582
+ /** @deprecated Use `Model(id).params().getFileParam(key)` instead. */
1583
+ readonly getFileParam: (id: string, key: string) => {
1584
+ required: boolean;
1585
+ max: number;
1586
+ label?: string;
1587
+ accept?: string;
1588
+ } | null;
1589
+ /** @deprecated Use `Model(id).params().hasParam(key)` instead. */
1590
+ readonly hasParam: (id: string, key: string) => boolean;
1591
+ };
1592
+
1593
+ declare function getVoiceById(id: string, extra?: VoiceOption[]): VoiceOption | undefined;
1594
+
1595
+ /**
1596
+ * Model accessor — single entry point for all model info.
1597
+ *
1598
+ * Usage:
1599
+ * import { model } from '@picsart/ai-sdk';
1600
+ * const m = model('flux-2-pro');
1601
+ * m.id // 'flux-2-pro'
1602
+ * m.name // 'Flux 2 Pro'
1603
+ * m.params().hasParam('aspectRatio') // true
1604
+ * m.params().getDefaults() // { aspectRatio: '4:3', ... }
1605
+ * m.meta().mode // 'image'
1606
+ * m.meta().provider.name // 'Flux'
1607
+ */
1608
+
1609
+ interface ModelFunction {
1610
+ /** Look up a single model by ID. */
1611
+ (id: string): ModelDescriptor;
1612
+ /** Return all enabled models. */
1613
+ all(): ModelDescriptor[];
1614
+ /** Find enabled models matching filter criteria. */
1615
+ find(filter: ModelFilter$1): ModelDescriptor[];
1616
+ /** Case-insensitive search across model id, name, and provider. */
1617
+ search(query: string): ModelDescriptor[];
1618
+ }
1619
+ /**
1620
+ * Model accessor — call as `Model(id)` or use static methods
1621
+ * `Model.all()`, `Model.find()`, `Model.search()`.
1622
+ */
1623
+ declare const Model: ModelFunction;
1624
+
1625
+ /** Result of decoding a deep link. */
1626
+ interface DeepLinkResult {
1627
+ /** Model ID from the payload. */
1628
+ modelId: string;
1629
+ /** Partial GenerationContext reconstructed from the payload. */
1630
+ context: Partial<GenerationContext>;
1631
+ /** Whether the model ID exists in the current catalog. */
1632
+ modelKnown: boolean;
1633
+ /** Non-fatal warnings (e.g. rejected URLs, unknown model). */
1634
+ warnings: string[];
1635
+ }
1636
+
1637
+ /**
1638
+ * Encode a model ID + context into a compressed, base64url-encoded payload string.
1639
+ * Consumers attach this to their own URL (e.g. `?aistate=${payload}`).
1640
+ */
1641
+ declare function encodeDeepLinkPayload(modelId: string, context: Partial<GenerationContext>): string;
1642
+ /**
1643
+ * Decode a compressed payload string back into a DeepLinkResult.
1644
+ * Returns null if decoding or validation fails.
1645
+ */
1646
+ declare function decodeDeepLinkPayload(encoded: string): DeepLinkResult | null;
1647
+
1648
+ /** All models from all vendors. */
1649
+ declare const ALL_MODELS: ModelDefinition[];
1650
+ declare const getModelsByMode: (mode: ModelDefinition["mode"], includeDisabled?: boolean) => ModelDefinition[];
1651
+
1652
+ /** Look up a model by its ID or vendor modelId. */
1653
+ declare const getModel: (id: string) => ModelDefinition | undefined;
1654
+ /** Find a model by ID, workflow name, or display name (case-insensitive). */
1655
+ declare const findModel: (ref: string) => ModelDefinition | undefined;
1656
+
1657
+ export { ALL_MODELS, type AiClient, type AuthenticatedFetch, type AvatarOption, type BooleanDescriptor, type BooleanEntry, type ClientConfig, type DeepLinkResult, type DriveConfig, type DriveFileDetails, type DriveFolder, type DriveMediaItem, type DriveSaveResult, type EntryMeta, type EnumDescriptor, type EnumEntry, type FileDescriptor, type FileEntry, type FlatParamEntry, type GenerateOptions, type GenerateResult, type GenerateResultItem, type GenerationContext, type GenerationMode, type ListOptions, type MediaTypeFilter, Model, type ModelDefinition, type ModelDescriptor, type ModelFilter$1 as ModelFilter, type ModelInput, type ModelInputById, type ModelMeta, type ModelParams, type ModelParamsAccessor, Models, type ObjectDescriptor, type ObjectEntry, type ParamDescriptor, type ParamEntry, type ParamOption, type PayloadDriveFolderOptions, type PayloadDriveOptions, type ProviderInfo, type RangeDescriptor, type RangeEntry, type SaveParams, type SdkTransport, type TextDescriptor, type TextEntry, type TypedModelId, type VoiceOption, type WorkflowJobHandle, buildFilename, createClient, decodeDeepLinkPayload, encodeDeepLinkPayload, findModel, getModel, getModelsByMode, getVoiceById, inferResourceType };