@picsart/ai-sdk 5.16.1 → 5.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -17,12 +17,41 @@ interface WorkflowProgress {
17
17
  percent?: number;
18
18
  estimatedSecondsLeft?: number;
19
19
  }
20
+ /**
21
+ * Per-tool credit usage entry inside {@link CreditUsage.details}
22
+ * (mirrors `ToolUsage` from `pa-pluggable-api-adapter`).
23
+ */
24
+ interface ToolUsage {
25
+ operationId?: string;
26
+ toolId: string;
27
+ price: number;
28
+ amount: number;
29
+ credits: number;
30
+ failed?: boolean;
31
+ }
32
+ /**
33
+ * Credit usage reported on a completed task, as returned by the pluggable
34
+ * APIs platform on every task response (mirrors the adapter's public
35
+ * `CreditUsage` from `pa-pluggable-api-adapter`).
36
+ */
37
+ interface CreditUsage {
38
+ /** The tool identifier. Set to "total_credits" when subtask usage is present. */
39
+ toolId?: string;
40
+ /** Per-tool credit usage breakdown. */
41
+ details?: ToolUsage[];
42
+ /** The amount of credits charged. */
43
+ credits: number;
44
+ /** The remaining balance. */
45
+ balance?: number;
46
+ }
20
47
  interface WorkflowStatusResult<TResult = unknown> {
21
48
  handle: WorkflowJobHandle;
22
49
  status: WorkflowStatus;
23
50
  result?: TResult;
24
51
  error?: string;
25
52
  progress?: WorkflowProgress;
53
+ /** Credit usage reported by the platform, when present on the response. */
54
+ usage?: CreditUsage;
26
55
  raw: unknown;
27
56
  }
28
57
  /**
@@ -1043,25 +1072,25 @@ type ModelInputById = {
1043
1072
  };
1044
1073
  "recraftv4_styles": {
1045
1074
  prompt: string;
1046
- styleReferenceUrls: [string, ...string[]];
1075
+ imageUrls: [string, ...string[]];
1047
1076
  aspectRatio?: "1:1" | "4:3" | "3:4" | "3:2" | "2:3" | "16:9" | "9:16" | "2:1" | "1:2";
1048
1077
  count?: 1 | 2 | 4 | 6;
1049
1078
  };
1050
1079
  "recraftv4_styles_pro": {
1051
1080
  prompt: string;
1052
- styleReferenceUrls: [string, ...string[]];
1081
+ imageUrls: [string, ...string[]];
1053
1082
  aspectRatio?: "1:1" | "4:3" | "3:4" | "3:2" | "2:3" | "16:9" | "9:16" | "2:1" | "1:2";
1054
1083
  count?: 1 | 2 | 4 | 6;
1055
1084
  };
1056
1085
  "recraftv4_styles_pro_vector": {
1057
1086
  prompt: string;
1058
- styleReferenceUrls: [string, ...string[]];
1087
+ imageUrls: [string, ...string[]];
1059
1088
  aspectRatio?: "1:1" | "4:3" | "3:4" | "3:2" | "2:3" | "16:9" | "9:16" | "2:1" | "1:2";
1060
1089
  count?: 1 | 2 | 4 | 6;
1061
1090
  };
1062
1091
  "recraftv4_styles_vector": {
1063
1092
  prompt: string;
1064
- styleReferenceUrls: [string, ...string[]];
1093
+ imageUrls: [string, ...string[]];
1065
1094
  aspectRatio?: "1:1" | "4:3" | "3:4" | "3:2" | "2:3" | "16:9" | "9:16" | "2:1" | "1:2";
1066
1095
  count?: 1 | 2 | 4 | 6;
1067
1096
  };
@@ -1487,6 +1516,21 @@ type ModelInputById = {
1487
1516
  watermark?: boolean;
1488
1517
  seed?: number;
1489
1518
  };
1519
+ "wan-3.0-video-prime": {
1520
+ prompt: string;
1521
+ duration?: 5 | 10 | 15 | 30;
1522
+ resolution?: "480P" | "720P" | "1080P";
1523
+ aspectRatio?: "16:9" | "9:16" | "1:1" | "4:3" | "3:4" | "adaptive";
1524
+ generateAudio?: boolean;
1525
+ startFrame?: string;
1526
+ endFrame?: string;
1527
+ imageUrls?: string[];
1528
+ videoUrls?: string[];
1529
+ audioUrls?: string[];
1530
+ enableThinking?: boolean;
1531
+ watermark?: boolean;
1532
+ seed?: number;
1533
+ };
1490
1534
  };
1491
1535
  type TypedModelId = keyof ModelInputById;
1492
1536
  type ModelInput<M extends TypedModelId> = ModelInputById[M];
@@ -1993,9 +2037,6 @@ interface GenerationContext {
1993
2037
  language?: string;
1994
2038
  accent?: string;
1995
2039
  style?: string;
1996
- /** Recraft V4 Styles — style-reference image URLs (max 5, t2i only).
1997
- * Required: the V4 Styles API rejects requests without a style. */
1998
- styleReferenceUrls?: string[];
1999
2040
  /**
2000
2041
  * Effect template id — a catalog-served content preset id (e.g. a Kling effect
2001
2042
  * scene from `kling/v1/catalog/templates`). Free string; the live catalog is
@@ -2127,6 +2168,15 @@ interface ModelDefinition {
2127
2168
  estimatedTime?: number | Record<string, number>;
2128
2169
  editEstimatedTime?: number | Record<string, number>;
2129
2170
  testTimeout?: number;
2171
+ /**
2172
+ * Per-model polling overrides for async jobs. Widens the global
2173
+ * 2s × 300-attempt (~10 min) default for models whose generations can
2174
+ * outlast it. Explicit per-call poll options still win.
2175
+ */
2176
+ pollOptions?: {
2177
+ intervalMs?: number;
2178
+ maxAttempts?: number;
2179
+ };
2130
2180
  }
2131
2181
 
2132
2182
  /**
@@ -2307,6 +2357,8 @@ interface GenerateResult {
2307
2357
  handle: WorkflowJobHandle;
2308
2358
  /** Raw parsed output for advanced consumers. */
2309
2359
  raw: unknown;
2360
+ /** Credit usage reported by the platform — same structure as the pluggable APIs' GenAITaskResponse. */
2361
+ usage?: CreditUsage;
2310
2362
  /** Present when Drive is enabled and the file was saved. */
2311
2363
  drive?: DriveSaveResult;
2312
2364
  }
@@ -2318,8 +2370,10 @@ interface GenerateTextResult {
2318
2370
  model: string;
2319
2371
  /** Job handle for status tracking. */
2320
2372
  handle: WorkflowJobHandle;
2321
- /** Raw parsed output — carries usage, finish reason, thinking trace, etc. */
2373
+ /** Raw parsed output — carries vendor token usage, finish reason, thinking trace, etc. */
2322
2374
  raw: unknown;
2375
+ /** Credit usage reported by the platform — same structure as the pluggable APIs' GenAITaskResponse. */
2376
+ usage?: CreditUsage;
2323
2377
  }
2324
2378
  /** Options for individual generate() / submit() calls. */
2325
2379
  interface GenerateOptions {
@@ -2607,6 +2661,7 @@ declare const Models: {
2607
2661
  readonly Wan27T2v: "wan-2.7-t2v";
2608
2662
  readonly Wan27VideoEdit: "wan-2.7-video-edit";
2609
2663
  readonly Wan30Video: "wan-3.0-video";
2664
+ readonly Wan30VideoPrime: "wan-3.0-video-prime";
2610
2665
  /** @deprecated Use the `catalog` accessor (`catalog.all()` / `catalog.find({ output, provider })`) instead. */
2611
2666
  readonly list: (filter?: ModelFilter) => ModelDefinition[];
2612
2667
  /** @deprecated Use `Model(id).validate(input)` instead. */
@@ -2762,4 +2817,4 @@ declare const findModel: (ref: string) => ModelDefinition | undefined;
2762
2817
  */
2763
2818
  declare const KLING_DUAL_IMAGE_EFFECTS: ReadonlySet<string>;
2764
2819
 
2765
- export { ALL_MODELS, type AiClient, type ApiResponse, type ApiRunOptions, type ApiSchemas, type ApisClient, type AppIdentity, type AppType, type AuthenticatedFetch, type AvatarOption, type BooleanDescriptor, type BooleanEntry, type CatalogDescriptor, type CatalogEntry, type CatalogItem, type CatalogKind, type CatalogPage, type CatalogPageOptions, type CatalogPreview, type CatalogQuery, type CatalogResult, type CatalogSource, type CatalogsClient, type CatalogsOptions, type ClientConfig, type CreditRange, type CreditRangeContext, type CreditTier, DEFAULT_VISIBLE_RELEASES, type DeepLinkResult, type DriveAttributes, type DriveClient, type DriveConfig, type DriveFile, type DriveFileDetails, type DriveFolder, type DriveMediaItem, type DriveSaveResult, type EntryMeta, type EnumDescriptor, type EnumEntry, type EnumOption, type FileDescriptor, type FileEntry, type FlatParamEntry, type GenerateOptions, type GenerateResult, type GenerateResultItem, type GenerateTextResult, type GenerationContext, type GenerationFile, type GenerationMode, KLING_DUAL_IMAGE_EFFECTS, type ListOptions, type MediaModelId, 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 PricingOptions, type ProviderInfo, type RangeDescriptor, type RangeEntry, type ReleaseTag, type SaveParams, type SdkPayload, type SdkTransport, type TextDescriptor, type TextEntry, type TextModelId, type TextModelInputById, type TypedModelId, type UserReaction, type ValidationResult$1 as ValidationResult, type VoiceOption, type WorkflowJobHandle, buildFilename, buildGenerationAttributes, catalog, createClient, decodeDeepLinkPayload, encodeDeepLinkPayload, findModel, getModel, getModelsByMode, getVoiceById, inferResourceType, isVisibleForReleases, parseGeneration, releaseOf, toAvatarOption, toVoiceOption };
2820
+ export { ALL_MODELS, type AiClient, type ApiResponse, type ApiRunOptions, type ApiSchemas, type ApisClient, type AppIdentity, type AppType, type AuthenticatedFetch, type AvatarOption, type BooleanDescriptor, type BooleanEntry, type CatalogDescriptor, type CatalogEntry, type CatalogItem, type CatalogKind, type CatalogPage, type CatalogPageOptions, type CatalogPreview, type CatalogQuery, type CatalogResult, type CatalogSource, type CatalogsClient, type CatalogsOptions, type ClientConfig, type CreditRange, type CreditRangeContext, type CreditTier, type CreditUsage, DEFAULT_VISIBLE_RELEASES, type DeepLinkResult, type DriveAttributes, type DriveClient, type DriveConfig, type DriveFile, type DriveFileDetails, type DriveFolder, type DriveMediaItem, type DriveSaveResult, type EntryMeta, type EnumDescriptor, type EnumEntry, type EnumOption, type FileDescriptor, type FileEntry, type FlatParamEntry, type GenerateOptions, type GenerateResult, type GenerateResultItem, type GenerateTextResult, type GenerationContext, type GenerationFile, type GenerationMode, KLING_DUAL_IMAGE_EFFECTS, type ListOptions, type MediaModelId, 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 PricingOptions, type ProviderInfo, type RangeDescriptor, type RangeEntry, type ReleaseTag, type SaveParams, type SdkPayload, type SdkTransport, type TextDescriptor, type TextEntry, type TextModelId, type TextModelInputById, type ToolUsage, type TypedModelId, type UserReaction, type ValidationResult$1 as ValidationResult, type VoiceOption, type WorkflowJobHandle, buildFilename, buildGenerationAttributes, catalog, createClient, decodeDeepLinkPayload, encodeDeepLinkPayload, findModel, getModel, getModelsByMode, getVoiceById, inferResourceType, isVisibleForReleases, parseGeneration, releaseOf, toAvatarOption, toVoiceOption };
package/index.js CHANGED
@@ -474,6 +474,8 @@ function parseWorkflowStatus(handle, raw) {
474
474
  const statusRaw = pickFirst(raw, [["response", "status"], ["status"]]);
475
475
  const status = normalizeStatus(statusRaw);
476
476
  const result = pickFirst(raw, [["response", "result"], ["result"]]);
477
+ const usageRaw = pickFirst(raw, [["response", "usage"], ["usage"]]);
478
+ const usage = usageRaw && typeof usageRaw === "object" && (typeof usageRaw.credits === "number" || Array.isArray(usageRaw.details)) ? usageRaw : void 0;
477
479
  const errorRaw = pickFirst(raw, [["response", "error"], ["error"], ["message"], ["reason"]]);
478
480
  const progressRaw = pickFirst(raw, [["response", "progress"], ["progress"]]);
479
481
  const progress = progressRaw && typeof progressRaw === "object" ? {
@@ -486,6 +488,7 @@ function parseWorkflowStatus(handle, raw) {
486
488
  result,
487
489
  error: typeof errorRaw === "string" ? errorRaw : void 0,
488
490
  progress,
491
+ usage,
489
492
  raw
490
493
  };
491
494
  }
@@ -1198,6 +1201,7 @@ function defineModels(provider, configs) {
1198
1201
  if (c.estimatedTime !== void 0) model.estimatedTime = c.estimatedTime;
1199
1202
  if (c.editEstimatedTime !== void 0) model.editEstimatedTime = c.editEstimatedTime;
1200
1203
  if (c.testTimeout !== void 0) model.testTimeout = c.testTimeout;
1204
+ if (c.pollOptions !== void 0) model.pollOptions = c.pollOptions;
1201
1205
  if (c.badge !== void 0) model.badge = c.badge;
1202
1206
  if (c.addedAt !== void 0) model.addedAt = c.addedAt;
1203
1207
  if (c.disabled !== void 0) model.disabled = c.disabled;
@@ -2924,6 +2928,22 @@ var wanV3Constraints = [
2924
2928
  audioUrls: { disabled: true, reason: WAN_V3_FRAME_REF_REASON }
2925
2929
  } }
2926
2930
  ];
2931
+ var wanV3Features = [feat("Image Input", "input"), feat("Video Input", "input"), feat("Audio", "audio"), feat("Start/End Frame", "frame"), feat("1080P", "resolution"), feat("Adaptive Ratio", "resolution")];
2932
+ var wanV3ParamConfig = {
2933
+ ...params.prompt(),
2934
+ ...params.duration([5, 10, 15, 30], 5),
2935
+ ...params.resolution(["480P", "720P", "1080P"], "1080P"),
2936
+ ...params.aspectRatio(["16:9", "9:16", "1:1", "4:3", "3:4", "adaptive"]),
2937
+ ...params.generateAudio(true),
2938
+ ...params.startFrame(),
2939
+ ...params.endFrame(),
2940
+ ...params.imageInput(10, "Reference Images"),
2941
+ ...params.videoInputs(5, "Reference Videos", false),
2942
+ ...params.audioInputs(5, "Reference Audios"),
2943
+ ...p.boolean("enableThinking", false, "Deep Thinking"),
2944
+ ...p.boolean("watermark", false, "Watermark"),
2945
+ ...p.range("seed", 0, 2147483647, 0, { label: "Seed" })
2946
+ };
2927
2947
  var { MODELS: MODELS10 } = defineModels("wan", [
2928
2948
  // ── Video ─────────────────────────────────────────
2929
2949
  {
@@ -3091,6 +3111,10 @@ var { MODELS: MODELS10 } = defineModels("wan", [
3091
3111
  }
3092
3112
  },
3093
3113
  // ── Wan 3.0 all-in-one Video ─────────────────────────
3114
+ // wan-3.0-video and wan-3.0-video-prime share the wan/v3/video workflow and
3115
+ // the full param surface — the backend `model` enum value (hardcoded per
3116
+ // entry in wan.payloads.ts) is the only wire difference. Prime is the same
3117
+ // model, up to 7x faster.
3094
3118
  {
3095
3119
  id: "wan-3.0-video",
3096
3120
  name: "Wan 3.0",
@@ -3103,28 +3127,32 @@ var { MODELS: MODELS10 } = defineModels("wan", [
3103
3127
  mode: "video",
3104
3128
  inputType: "t2v",
3105
3129
  description: "Wan 3.0 all-in-one \u2014 text, image/video/audio references, and start/end frames with adaptive ratio, intelligent duration, and audio.",
3106
- features: [feat("Image Input", "input"), feat("Video Input", "input"), feat("Audio", "audio"), feat("Start/End Frame", "frame"), feat("1080P", "resolution"), feat("Adaptive Ratio", "resolution")],
3130
+ features: [...wanV3Features],
3107
3131
  constraints: wanV3Constraints,
3108
- paramConfig: {
3109
- ...params.prompt(),
3110
- ...params.duration([5, 10, 15, 30], 5),
3111
- ...params.resolution(["480P", "720P", "1080P"], "1080P"),
3112
- ...params.aspectRatio(["16:9", "9:16", "1:1", "4:3", "3:4", "adaptive"]),
3113
- ...params.generateAudio(true),
3114
- ...params.startFrame(),
3115
- ...params.endFrame(),
3116
- ...params.imageInput(10, "Reference Images"),
3117
- ...params.videoInputs(5, "Reference Videos", false),
3118
- ...params.audioInputs(5, "Reference Audios"),
3119
- ...p.boolean("enableThinking", false, "Deep Thinking"),
3120
- ...p.boolean("watermark", false, "Watermark"),
3121
- ...p.range("seed", 0, 2147483647, 0, { label: "Seed" })
3122
- }
3132
+ // Generations at 1080P / long durations can outlast the global 10-min
3133
+ // polling default — widen to 5s × 360 attempts (30 min).
3134
+ pollOptions: { intervalMs: 5e3, maxAttempts: 360 },
3135
+ paramConfig: { ...wanV3ParamConfig }
3136
+ },
3137
+ {
3138
+ id: "wan-3.0-video-prime",
3139
+ name: "Wan 3.0 Prime",
3140
+ modelId: "wan3.0-video-prime",
3141
+ addedAt: "2026-08-26",
3142
+ workflow: "wan/v3/video",
3143
+ estimatedTime: 30,
3144
+ mode: "video",
3145
+ inputType: "t2v",
3146
+ description: "Wan 3.0 Prime \u2014 the same all-in-one model as Wan 3.0, up to 7x faster.",
3147
+ features: [...wanV3Features],
3148
+ constraints: wanV3Constraints,
3149
+ pollOptions: { intervalMs: 5e3, maxAttempts: 360 },
3150
+ paramConfig: { ...wanV3ParamConfig }
3123
3151
  }
3124
3152
  ]);
3125
3153
 
3126
3154
  // src/vendors/catalog/wan.payloads.ts
3127
- var buildWanV3VideoPayload = (input) => {
3155
+ var makeWanV3VideoPayload = (model) => (input) => {
3128
3156
  const media = [];
3129
3157
  if (input.startFrame) media.push({ type: "first_frame", url: input.startFrame });
3130
3158
  if (input.endFrame) media.push({ type: "last_frame", url: input.endFrame });
@@ -3138,7 +3166,7 @@ var buildWanV3VideoPayload = (input) => {
3138
3166
  for (const url of input.audioUrls) media.push({ type: "reference_audio", url });
3139
3167
  }
3140
3168
  return {
3141
- model: "wan3.0-video",
3169
+ model,
3142
3170
  resolution: input.resolution ?? "1080P",
3143
3171
  ratio: input.aspectRatio ?? "16:9",
3144
3172
  duration: input.duration ?? 5,
@@ -3151,7 +3179,8 @@ var buildWanV3VideoPayload = (input) => {
3151
3179
  };
3152
3180
  };
3153
3181
  registerPayloads(MODELS10, {
3154
- "wan-3.0-video": buildWanV3VideoPayload
3182
+ "wan-3.0-video": makeWanV3VideoPayload("wan3.0-video"),
3183
+ "wan-3.0-video-prime": makeWanV3VideoPayload("wan3.0-video-prime")
3155
3184
  });
3156
3185
 
3157
3186
  // src/vendors/catalog/luma.ts
@@ -6712,15 +6741,15 @@ var buildRecraftUtilityPayload = (includePrompt) => (ctx) => ({
6712
6741
  ...includePrompt && ctx.prompt ? { prompt: ctx.prompt } : {}
6713
6742
  });
6714
6743
  var buildRecraftV4StylesPayload = (apiModel) => (ctx) => {
6715
- if (!ctx.styleReferenceUrls?.length) {
6716
- throw new Error("V4 Styles models require styleReferenceUrls");
6744
+ if (!ctx.imageUrls?.length) {
6745
+ throw new Error("V4 Styles models require style-reference images");
6717
6746
  }
6718
6747
  return {
6719
6748
  prompt: ctx.prompt,
6720
6749
  model: apiModel,
6721
6750
  n: ctx.count ?? 1,
6722
6751
  ...ctx.aspectRatio ? { size: ctx.aspectRatio } : {},
6723
- style_reference_urls: ctx.styleReferenceUrls
6752
+ style_reference_urls: ctx.imageUrls
6724
6753
  };
6725
6754
  };
6726
6755
  var buildRecraftV4VariantPayload = (apiModel) => (ctx) => ({
@@ -6739,7 +6768,7 @@ var buildRecraftExploreSimilarPayload = (ctx) => ({
6739
6768
  similarity: ctx.similarity ?? 3,
6740
6769
  ...ctx.aspectRatio ? { size: ctx.aspectRatio } : {}
6741
6770
  });
6742
- var v4StylesParams = p.file("styleReferenceUrls", "image", {
6771
+ var v4StylesParams = p.file("imageUrls", "image", {
6743
6772
  label: "Style References",
6744
6773
  required: true,
6745
6774
  array: { min: 1, max: 5 },
@@ -8552,12 +8581,13 @@ var extractAllResults = (result) => {
8552
8581
  }
8553
8582
  return void 0;
8554
8583
  };
8555
- function toCompletedStatus(handle, result, raw) {
8584
+ function toCompletedStatus(handle, result, raw, usage) {
8556
8585
  return {
8557
8586
  handle,
8558
8587
  status: "COMPLETED",
8559
8588
  result,
8560
- raw
8589
+ raw,
8590
+ usage
8561
8591
  };
8562
8592
  }
8563
8593
 
@@ -8710,13 +8740,13 @@ function parseResult(completed, model, contract) {
8710
8740
  url: item.url,
8711
8741
  metadata: item.exploreImageId ? { exploreImageId: item.exploreImageId } : void 0
8712
8742
  }));
8713
- return { url: results[0].url, results, model: model.id, handle: completed.handle, raw: parsed };
8743
+ return { url: results[0].url, results, model: model.id, handle: completed.handle, raw: parsed, usage: completed.usage };
8714
8744
  }
8715
8745
  const url = extractUrl(parsed);
8716
8746
  if (!url) {
8717
8747
  throw new Error(`${model.name}: unexpected response \u2014 no result URL`);
8718
8748
  }
8719
- return { url, results: [{ url }], model: model.id, handle: completed.handle, raw: parsed };
8749
+ return { url, results: [{ url }], model: model.id, handle: completed.handle, raw: parsed, usage: completed.usage };
8720
8750
  }
8721
8751
  function parseTextResult(completed, model) {
8722
8752
  if (completed.status === "FAILED") {
@@ -8731,7 +8761,7 @@ function parseTextResult(completed, model) {
8731
8761
  if (text == null) {
8732
8762
  throw new Error(`${model.name}: unexpected response \u2014 no text`);
8733
8763
  }
8734
- return { text, model: model.id, handle: completed.handle, raw: completed.raw ?? completed.result };
8764
+ return { text, model: model.id, handle: completed.handle, raw: completed.raw ?? completed.result, usage: completed.usage };
8735
8765
  }
8736
8766
 
8737
8767
  // src/core/limits.ts
@@ -9807,10 +9837,11 @@ function createClient(config) {
9807
9837
  return toCompletedStatus(
9808
9838
  syncResponse.handle,
9809
9839
  extractSyncResult(syncResponse.raw),
9810
- syncResponse.raw
9840
+ syncResponse.raw,
9841
+ syncResponse.usage
9811
9842
  );
9812
9843
  }
9813
- return client.run({ workflow, payload, signal });
9844
+ return client.run({ workflow, payload, signal }, model.pollOptions);
9814
9845
  }
9815
9846
  function buildDrivePayloadOptions(model, params2, options) {
9816
9847
  const explicit = options?.drive;
@@ -9911,7 +9942,7 @@ function createClient(config) {
9911
9942
  async result(handle, model, options) {
9912
9943
  const resolved = resolveModel(model);
9913
9944
  const contract = getModelContract(resolved.id);
9914
- const completed = await client.result(handle, options);
9945
+ const completed = await client.result(handle, { ...resolved.pollOptions, ...options });
9915
9946
  return parseResult(completed, resolved, contract);
9916
9947
  },
9917
9948
  /**
@@ -10603,6 +10634,7 @@ var Wan27R2v = "wan-2.7-r2v";
10603
10634
  var Wan27T2v = "wan-2.7-t2v";
10604
10635
  var Wan27VideoEdit = "wan-2.7-video-edit";
10605
10636
  var Wan30Video = "wan-3.0-video";
10637
+ var Wan30VideoPrime = "wan-3.0-video-prime";
10606
10638
  var Models = {
10607
10639
  AsyncFlashV1,
10608
10640
  BytedanceOmnihumanV15,
@@ -10809,6 +10841,7 @@ var Models = {
10809
10841
  Wan27T2v,
10810
10842
  Wan27VideoEdit,
10811
10843
  Wan30Video,
10844
+ Wan30VideoPrime,
10812
10845
  /** @deprecated Use the `catalog` accessor (`catalog.all()` / `catalog.find({ output, provider })`) instead. */
10813
10846
  list(filter) {
10814
10847
  if (!filter) return [...ALL_MODELS];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@picsart/ai-sdk",
3
- "version": "5.16.1",
3
+ "version": "5.18.0",
4
4
  "type": "module",
5
5
  "description": "Type-safe SDK for 100+ AI models — image, video, audio, and text generation with Picsart",
6
6
  "license": "MIT",