@picsart/ai-sdk 5.6.1 → 5.8.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.
Files changed (4) hide show
  1. package/README.md +2 -3
  2. package/index.d.ts +37 -10
  3. package/index.js +104 -306
  4. package/package.json +2 -1
package/README.md CHANGED
@@ -167,10 +167,9 @@ Model('heygen-video-avatar').params().catalog('videoId')?.catalogOptions
167
167
 
168
168
  `CatalogItem` is the standard shape across all vendors:
169
169
  `{ id, name, description?, tags, preview? { imageUrl | videoUrl | audioUrl }, meta? }` —
170
- `id` is sent back verbatim as `voiceId` / `videoId` on generate. Validation
170
+ `id` is sent back verbatim on generate as the bound param's value. Validation
171
171
  never requires hydration: catalog-bound params accept any id and the platform
172
- validates for real. Migrating from self-fetched catalogs? See
173
- `docs/DYNAMIC-CATALOGS-MIGRATION.md` at the pa-gen-ai-sdk repo root.
172
+ validates for real.
174
173
 
175
174
  ## Advanced Lifecycle
176
175
 
package/index.d.ts CHANGED
@@ -629,7 +629,7 @@ type ModelInputById = {
629
629
  staticMask?: string;
630
630
  };
631
631
  "kling-video-effects": {
632
- style?: "korean_baseball" | "pet_skateboard" | "daily_ootd" | "tiny_beast_printer" | "landmark_reveal" | "winter_charm" | "flash_ride" | "maestro_of_magic" | "magic_carpet_ride" | "good_luck_spirit" | "shooting_star" | "sparkler_wand" | "sovereign_scepter" | "dirt_rush" | "return_of_the_king" | "dance_with_dragon" | "minimalist_light" | "martial_meow" | "sassy_shake" | "knock_at_a_door_revenge" | "palm_sized_figure_pro" | "prank_box" | "perler_beads" | "spring_bloom" | "toss_run" | "switch_to_silk" | "get_rich_quick" | "make_it_rain" | "twist_shake" | "the_hip_sway" | "send_my_love" | "funky_martian" | "wealth_drive" | "the_high_kick" | "the_exercise" | "lucky_veggie" | "studio_look" | "flash_drive" | "shush_my_dreams" | "french_elegance" | "finger_swipe" | "advent_of_flora" | "smooth_transition" | "kiss_pro" | "raid_check" | "snow_night_kiss" | "eternal_kiss" | "fortune_in_motion" | "chinese_trend" | "sedan_chair_dance" | "skyfall" | "good_luck_dance" | "laicai_dance" | "yangge_dance" | "color_mixing" | "palm_sized_figure" | "lantern_festival_cuju" | "unique_firework" | "unique_spring_couplets" | "horse_mask" | "fortune_knocks_cartoon" | "tangyuan_to_animal" | "hot_feet_dance" | "swag_dance" | "pigeon_dance" | "bloodline_dance" | "chanel_dance" | "cute_dance" | "love_theme_song" | "pumpitup_dance" | "city_to_village" | "fortune_god_transform" | "new_year_feast" | "ring_in_new" | "horse_year_firework" | "pet_vlogger" | "crystal_horse" | "lateral_shift_transition" | "drunk_dance" | "drunk_dance_pet" | "daoma_dance" | "bouncy_dance" | "smooth_sailing_dance" | "new_year_greeting" | "lion_dance" | "prosperity" | "great_success" | "golden_horse_fortune" | "red_packet_box" | "lucky_horse_year" | "lucky_red_packet" | "lucky_money_come" | "lion_dance_pet" | "dumpling_making_pet" | "fish_making_pet" | "pet_red_packet" | "lantern_glow" | "expression_challenge" | "overdrive" | "heart_gesture_dance" | "poping" | "martial_arts" | "running" | "nezha" | "motorcycle_dance" | "subject_3_dance" | "ghost_step_dance" | "phantom_jewel" | "zoom_out" | "cheers_2026" | "fight_pro" | "hug_pro" | "heart_gesture_pro" | "dollar_rain_pro" | "pet_bee_pro" | "countdown_teleport" | "santa_random_surprise" | "magic_match_tree" | "bullet_time_360" | "happy_birthday" | "birthday_star" | "thumbs_up_pro" | "tiger_hug_pro" | "pet_lion_pro" | "surprise_bouquet" | "bouquet_drop" | "3d_cartoon_1_pro" | "firework_2026" | "glamour_photo_shoot" | "box_of_joy" | "first_toast_of_the_year" | "my_santa_pic" | "santa_gift" | "steampunk_christmas" | "snowglobe" | "christmas_photo_shoot" | "ornament_crash" | "santa_express" | "instant_christmas" | "particle_santa_surround" | "coronation_of_frost" | "building_sweater" | "spark_in_the_snow" | "scarlet_and_snow" | "cozy_toon_wrap" | "bullet_time_lite" | "magic_cloak" | "balloon_parade" | "jumping_ginger_joy" | "bullet_time" | "c4d_cartoon_pro" | "pure_white_wings" | "black_wings" | "golden_wing" | "pink_pink_wings" | "venomous_spider" | "throne_of_king" | "luminous_elf" | "woodland_elf" | "japanese_anime_1" | "american_comics" | "guardian_spirit" | "swish_swish" | "snowboarding" | "witch_transform" | "vampire_transform" | "pumpkin_head_transform" | "demon_transform" | "mummy_transform" | "zombie_transform" | "cute_pumpkin_transform" | "cute_ghost_transform" | "knock_knock_halloween" | "halloween_escape" | "baseball" | "inner_voice" | "a_list_look" | "memory_alive" | "trampoline" | "trampoline_night" | "pucker_up" | "guess_what" | "feed_mooncake" | "rampage_ape" | "flyer" | "dishwasher" | "pet_chinese_opera" | "magic_fireball" | "gallery_ring" | "pet_moto_rider" | "muscle_pet" | "squeeze_scream" | "pet_delivery" | "running_man" | "disappear" | "mythic_style" | "steampunk" | "3d_cartoon_2" | "eagle_snatch" | "hug_from_past" | "firework" | "media_interview" | "pet_chef" | "santa_gifts" | "santa_hug" | "heart_gesture_1" | "pet_wizard" | "smoke_smoke" | "instant_kid" | "dollar_rain" | "cry_cry" | "building_collapse" | "gun_shot" | "mushroom" | "double_gun" | "pet_warrior" | "lightning_power" | "jesus_hug" | "shark_alert" | "long_hair" | "lie_flat" | "polar_bear_hug" | "brown_bear_hug" | "jazz_jazz" | "office_escape_plow" | "fly_fly" | "watermelon_bomb" | "pet_dance" | "boss_coming" | "wool_curly" | "pet_bee" | "marry_me" | "swing_swing" | "day_to_night" | "piggy_morph" | "wig_out" | "car_explosion" | "ski_ski" | "siblings" | "construction_worker" | "let's_ride" | "snatched" | "magic_broom" | "felt_felt" | "jumpdrop" | "surfsurf" | "fairy_wing" | "angel_wing" | "dark_wing" | "skateskate" | "plushcut" | "jelly_press" | "jelly_slice" | "jelly_squish" | "jelly_jiggle" | "pixelpixel" | "yearbook" | "instant_film" | "anime_figure" | "rocketrocket" | "bloombloom" | "dizzydizzy" | "fuzzyfuzzy" | "squish" | "expansion" | "emoji" | "tennis_trend" | "whirling_beverage" | "f1_live" | "football_live" | "spielberg_transition";
632
+ templateId?: string;
633
633
  imageUrls: [string, ...string[]];
634
634
  };
635
635
  "kling-video-o1": {
@@ -796,6 +796,14 @@ type ModelInputById = {
796
796
  "picsart-enhance": {
797
797
  imageUrls: [string, ...string[]];
798
798
  };
799
+ "picsart-flow": {
800
+ templateId: string;
801
+ imageUrls: [string, ...string[]];
802
+ };
803
+ "picsart-flow-video": {
804
+ templateId: string;
805
+ imageUrls: [string, ...string[]];
806
+ };
799
807
  "picsart-flux-2-klein": {
800
808
  prompt: string;
801
809
  aspectRatio?: "1:1" | "5:3" | "3:5" | "4:3" | "3:4";
@@ -2009,6 +2017,12 @@ interface GenerationContext {
2009
2017
  /** Recraft V4 Styles — style-reference image URLs (max 5, t2i only).
2010
2018
  * Required: the V4 Styles API rejects requests without a style. */
2011
2019
  styleReferenceUrls?: string[];
2020
+ /**
2021
+ * Effect template id — a catalog-served content preset id (e.g. a Kling effect
2022
+ * scene from `kling/v1/catalog/templates`). Free string; the live catalog is
2023
+ * the source of truth.
2024
+ */
2025
+ templateId?: string;
2012
2026
  quality?: string;
2013
2027
  size?: string;
2014
2028
  negativePrompt?: string;
@@ -2137,9 +2151,10 @@ interface ModelDefinition {
2137
2151
  }
2138
2152
 
2139
2153
  /**
2140
- * Voice/avatar catalogs — the standard format served by the platform
2141
- * `<vendor>/v1/catalog/<voices|avatars>` tasks, plus the in-memory hydration
2142
- * registry that lets runtime-fetched catalogs back the descriptor system.
2154
+ * Runtime catalogs — the standard format served by the platform
2155
+ * `<vendor>/v1/catalog/<voices|avatars|…>` tasks (voices, avatars, effect
2156
+ * templates), plus the in-memory hydration registry that lets runtime-fetched
2157
+ * catalogs back the descriptor system.
2143
2158
  *
2144
2159
  * The wire types mirror the shared backend contract (`@picsart/pa-genai-common`);
2145
2160
  * the SDK owns its own copy so it carries no backend dependency.
@@ -2151,7 +2166,7 @@ interface CatalogPreview {
2151
2166
  audioUrl?: string;
2152
2167
  }
2153
2168
  interface CatalogItem {
2154
- /** Vendor-native id, sent back verbatim on generate (voiceId / videoId). */
2169
+ /** Vendor-native id, sent back verbatim on generate as the bound param's value. */
2155
2170
  id: string;
2156
2171
  name: string;
2157
2172
  description?: string;
@@ -2178,6 +2193,7 @@ interface CatalogResult {
2178
2193
  /** `null` when the list is complete. */
2179
2194
  nextCursor: string | null;
2180
2195
  }
2196
+ /** @deprecated No longer drives behavior — catalogs are addressed by param key. */
2181
2197
  type CatalogKind = 'voices' | 'avatars';
2182
2198
  /** Binds a param's options to a platform catalog task. */
2183
2199
  interface CatalogSource {
@@ -2190,8 +2206,9 @@ declare function toVoiceOption(item: CatalogItem, provider: Provider): VoiceOpti
2190
2206
  declare function toAvatarOption(item: CatalogItem, provider: Provider): AvatarOption;
2191
2207
 
2192
2208
  /**
2193
- * ai.catalogs — runtime access to the platform voice/avatar catalog tasks
2194
- * (`<vendor>/v1/catalog/<voices|avatars>`).
2209
+ * ai.catalogs — runtime access to the platform catalog tasks
2210
+ * (`<vendor>/v1/catalog/<voices|avatars|…>`) serving any catalog-bound param
2211
+ * (`kind: 'catalog'` descriptor): voices, avatars, effect templates.
2195
2212
  *
2196
2213
  * Loading is page-by-page: each call fetches ONE page (UI loads more on
2197
2214
  * scroll/pagination via `nextCursor`). Pages are cached per the `ttlSeconds`
@@ -2226,12 +2243,15 @@ interface CatalogPageOptions {
2226
2243
  }
2227
2244
  interface CatalogsClient {
2228
2245
  /**
2229
- * One page of the model's voice catalog. Fetched pages accumulate into the
2230
- * model's `voiceId` options, so pickers see everything loaded so far.
2246
+ * One page of the model's voice catalog (`voiceId` param). Fetched pages
2247
+ * accumulate into `Model(id).params().catalog('voiceId').catalogOptions`,
2248
+ * so pickers see everything loaded so far.
2231
2249
  */
2232
2250
  voices(model: ModelId, options?: CatalogPageOptions): Promise<CatalogPage>;
2233
2251
  /** One page of the model's avatar catalog — same semantics, for `videoId`. */
2234
2252
  avatars(model: ModelId, options?: CatalogPageOptions): Promise<CatalogPage>;
2253
+ /** One page of the model's effect-template catalog — same semantics, for `templateId`. */
2254
+ templates(model: ModelId, options?: CatalogPageOptions): Promise<CatalogPage>;
2235
2255
  }
2236
2256
  interface CatalogsOptions {
2237
2257
  /**
@@ -2512,6 +2532,8 @@ declare const Models: {
2512
2532
  readonly Ovi: "ovi";
2513
2533
  readonly PicsartChangeBg: "picsart-change-bg";
2514
2534
  readonly PicsartEnhance: "picsart-enhance";
2535
+ readonly PicsartFlow: "picsart-flow";
2536
+ readonly PicsartFlowVideo: "picsart-flow-video";
2515
2537
  readonly PicsartFlux2Klein: "picsart-flux-2-klein";
2516
2538
  readonly PicsartHidreamT2i: "picsart-hidream-t2i";
2517
2539
  readonly PicsartQwenImageEdit: "picsart-qwen-image-edit";
@@ -2755,7 +2777,12 @@ declare const getModel: (id: string) => ModelDefinition | undefined;
2755
2777
  /** Find a model by ID, workflow name, or display name (case-insensitive). */
2756
2778
  declare const findModel: (ref: string) => ModelDefinition | undefined;
2757
2779
 
2758
- /** Effect scenes that require two input images (e.g. hugs, kisses, swaps). */
2780
+ /**
2781
+ * Effect scenes that require two input images (e.g. hugs, kisses, swaps).
2782
+ * @deprecated Read `meta.imageSlots` on the `kling/v1/catalog/templates`
2783
+ * catalog items instead — this frozen copy is no longer maintained and will be
2784
+ * removed in the next major.
2785
+ */
2759
2786
  declare const KLING_DUAL_IMAGE_EFFECTS: ReadonlySet<string>;
2760
2787
 
2761
2788
  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 };
package/index.js CHANGED
@@ -1067,6 +1067,20 @@ var p = {
1067
1067
  }
1068
1068
  };
1069
1069
  },
1070
+ /**
1071
+ * Any param whose options are served by a platform catalog task (effect
1072
+ * templates, and anything the voiceId/videoId presets don't cover). The
1073
+ * value is a free-string id — the live catalog is the source of truth.
1074
+ */
1075
+ catalog(key, cfg) {
1076
+ return {
1077
+ [key]: {
1078
+ label: cfg.label,
1079
+ required: cfg.required,
1080
+ descriptor: { kind: "catalog", source: cfg.source, default: cfg.default }
1081
+ }
1082
+ };
1083
+ },
1070
1084
  voiceId(options, def, opts) {
1071
1085
  return {
1072
1086
  voiceId: {
@@ -1215,6 +1229,7 @@ var params = {
1215
1229
  renderingSpeed: p.renderingSpeed,
1216
1230
  voiceId: p.voiceId,
1217
1231
  videoId: p.videoId,
1232
+ catalog: p.catalog,
1218
1233
  language: p.language,
1219
1234
  // File presets — key matches the runtime GenerationContext field name.
1220
1235
  // `category` defaults to the most common role for the slot (overridable per call):
@@ -1451,283 +1466,6 @@ var klingOmniAdvancedParams = {
1451
1466
  };
1452
1467
 
1453
1468
  // src/vendors/catalog/kling/index.ts
1454
- var KLING_EFFECT_SCENES = [
1455
- "korean_baseball",
1456
- "pet_skateboard",
1457
- "daily_ootd",
1458
- "tiny_beast_printer",
1459
- "landmark_reveal",
1460
- "winter_charm",
1461
- "flash_ride",
1462
- "maestro_of_magic",
1463
- "magic_carpet_ride",
1464
- "good_luck_spirit",
1465
- "shooting_star",
1466
- "sparkler_wand",
1467
- "sovereign_scepter",
1468
- "dirt_rush",
1469
- "return_of_the_king",
1470
- "dance_with_dragon",
1471
- "minimalist_light",
1472
- "martial_meow",
1473
- "sassy_shake",
1474
- "knock_at_a_door_revenge",
1475
- "palm_sized_figure_pro",
1476
- "prank_box",
1477
- "perler_beads",
1478
- "spring_bloom",
1479
- "toss_run",
1480
- "switch_to_silk",
1481
- "get_rich_quick",
1482
- "make_it_rain",
1483
- "twist_shake",
1484
- "the_hip_sway",
1485
- "send_my_love",
1486
- "funky_martian",
1487
- "wealth_drive",
1488
- "the_high_kick",
1489
- "the_exercise",
1490
- "lucky_veggie",
1491
- "studio_look",
1492
- "flash_drive",
1493
- "shush_my_dreams",
1494
- "french_elegance",
1495
- "finger_swipe",
1496
- "advent_of_flora",
1497
- "smooth_transition",
1498
- "kiss_pro",
1499
- "raid_check",
1500
- "snow_night_kiss",
1501
- "eternal_kiss",
1502
- "fortune_in_motion",
1503
- "chinese_trend",
1504
- "sedan_chair_dance",
1505
- "skyfall",
1506
- "good_luck_dance",
1507
- "laicai_dance",
1508
- "yangge_dance",
1509
- "color_mixing",
1510
- "palm_sized_figure",
1511
- "lantern_festival_cuju",
1512
- "unique_firework",
1513
- "unique_spring_couplets",
1514
- "horse_mask",
1515
- "fortune_knocks_cartoon",
1516
- "tangyuan_to_animal",
1517
- "hot_feet_dance",
1518
- "swag_dance",
1519
- "pigeon_dance",
1520
- "bloodline_dance",
1521
- "chanel_dance",
1522
- "cute_dance",
1523
- "love_theme_song",
1524
- "pumpitup_dance",
1525
- "city_to_village",
1526
- "fortune_god_transform",
1527
- "new_year_feast",
1528
- "ring_in_new",
1529
- "horse_year_firework",
1530
- "pet_vlogger",
1531
- "crystal_horse",
1532
- "lateral_shift_transition",
1533
- "drunk_dance",
1534
- "drunk_dance_pet",
1535
- "daoma_dance",
1536
- "bouncy_dance",
1537
- "smooth_sailing_dance",
1538
- "new_year_greeting",
1539
- "lion_dance",
1540
- "prosperity",
1541
- "great_success",
1542
- "golden_horse_fortune",
1543
- "red_packet_box",
1544
- "lucky_horse_year",
1545
- "lucky_red_packet",
1546
- "lucky_money_come",
1547
- "lion_dance_pet",
1548
- "dumpling_making_pet",
1549
- "fish_making_pet",
1550
- "pet_red_packet",
1551
- "lantern_glow",
1552
- "expression_challenge",
1553
- "overdrive",
1554
- "heart_gesture_dance",
1555
- "poping",
1556
- "martial_arts",
1557
- "running",
1558
- "nezha",
1559
- "motorcycle_dance",
1560
- "subject_3_dance",
1561
- "ghost_step_dance",
1562
- "phantom_jewel",
1563
- "zoom_out",
1564
- "cheers_2026",
1565
- "fight_pro",
1566
- "hug_pro",
1567
- "heart_gesture_pro",
1568
- "dollar_rain_pro",
1569
- "pet_bee_pro",
1570
- "countdown_teleport",
1571
- "santa_random_surprise",
1572
- "magic_match_tree",
1573
- "bullet_time_360",
1574
- "happy_birthday",
1575
- "birthday_star",
1576
- "thumbs_up_pro",
1577
- "tiger_hug_pro",
1578
- "pet_lion_pro",
1579
- "surprise_bouquet",
1580
- "bouquet_drop",
1581
- "3d_cartoon_1_pro",
1582
- "firework_2026",
1583
- "glamour_photo_shoot",
1584
- "box_of_joy",
1585
- "first_toast_of_the_year",
1586
- "my_santa_pic",
1587
- "santa_gift",
1588
- "steampunk_christmas",
1589
- "snowglobe",
1590
- "christmas_photo_shoot",
1591
- "ornament_crash",
1592
- "santa_express",
1593
- "instant_christmas",
1594
- "particle_santa_surround",
1595
- "coronation_of_frost",
1596
- "building_sweater",
1597
- "spark_in_the_snow",
1598
- "scarlet_and_snow",
1599
- "cozy_toon_wrap",
1600
- "bullet_time_lite",
1601
- "magic_cloak",
1602
- "balloon_parade",
1603
- "jumping_ginger_joy",
1604
- "bullet_time",
1605
- "c4d_cartoon_pro",
1606
- "pure_white_wings",
1607
- "black_wings",
1608
- "golden_wing",
1609
- "pink_pink_wings",
1610
- "venomous_spider",
1611
- "throne_of_king",
1612
- "luminous_elf",
1613
- "woodland_elf",
1614
- "japanese_anime_1",
1615
- "american_comics",
1616
- "guardian_spirit",
1617
- "swish_swish",
1618
- "snowboarding",
1619
- "witch_transform",
1620
- "vampire_transform",
1621
- "pumpkin_head_transform",
1622
- "demon_transform",
1623
- "mummy_transform",
1624
- "zombie_transform",
1625
- "cute_pumpkin_transform",
1626
- "cute_ghost_transform",
1627
- "knock_knock_halloween",
1628
- "halloween_escape",
1629
- "baseball",
1630
- "inner_voice",
1631
- "a_list_look",
1632
- "memory_alive",
1633
- "trampoline",
1634
- "trampoline_night",
1635
- "pucker_up",
1636
- "guess_what",
1637
- "feed_mooncake",
1638
- "rampage_ape",
1639
- "flyer",
1640
- "dishwasher",
1641
- "pet_chinese_opera",
1642
- "magic_fireball",
1643
- "gallery_ring",
1644
- "pet_moto_rider",
1645
- "muscle_pet",
1646
- "squeeze_scream",
1647
- "pet_delivery",
1648
- "running_man",
1649
- "disappear",
1650
- "mythic_style",
1651
- "steampunk",
1652
- "3d_cartoon_2",
1653
- "eagle_snatch",
1654
- "hug_from_past",
1655
- "firework",
1656
- "media_interview",
1657
- "pet_chef",
1658
- "santa_gifts",
1659
- "santa_hug",
1660
- "heart_gesture_1",
1661
- "pet_wizard",
1662
- "smoke_smoke",
1663
- "instant_kid",
1664
- "dollar_rain",
1665
- "cry_cry",
1666
- "building_collapse",
1667
- "gun_shot",
1668
- "mushroom",
1669
- "double_gun",
1670
- "pet_warrior",
1671
- "lightning_power",
1672
- "jesus_hug",
1673
- "shark_alert",
1674
- "long_hair",
1675
- "lie_flat",
1676
- "polar_bear_hug",
1677
- "brown_bear_hug",
1678
- "jazz_jazz",
1679
- "office_escape_plow",
1680
- "fly_fly",
1681
- "watermelon_bomb",
1682
- "pet_dance",
1683
- "boss_coming",
1684
- "wool_curly",
1685
- "pet_bee",
1686
- "marry_me",
1687
- "swing_swing",
1688
- "day_to_night",
1689
- "piggy_morph",
1690
- "wig_out",
1691
- "car_explosion",
1692
- "ski_ski",
1693
- "siblings",
1694
- "construction_worker",
1695
- "let's_ride",
1696
- "snatched",
1697
- "magic_broom",
1698
- "felt_felt",
1699
- "jumpdrop",
1700
- "surfsurf",
1701
- "fairy_wing",
1702
- "angel_wing",
1703
- "dark_wing",
1704
- "skateskate",
1705
- "plushcut",
1706
- "jelly_press",
1707
- "jelly_slice",
1708
- "jelly_squish",
1709
- "jelly_jiggle",
1710
- "pixelpixel",
1711
- "yearbook",
1712
- "instant_film",
1713
- "anime_figure",
1714
- "rocketrocket",
1715
- "bloombloom",
1716
- "dizzydizzy",
1717
- "fuzzyfuzzy",
1718
- "squish",
1719
- "expansion",
1720
- "emoji",
1721
- "tennis_trend",
1722
- "whirling_beverage",
1723
- "f1_live",
1724
- "football_live",
1725
- "spielberg_transition"
1726
- ];
1727
- var effectSceneStyles = KLING_EFFECT_SCENES.map((id) => ({
1728
- id,
1729
- label: id.split("_").map((w) => w[0].toUpperCase() + w.slice(1)).join(" ")
1730
- }));
1731
1469
  var KLING_DUAL_IMAGE_EFFECTS = /* @__PURE__ */ new Set([
1732
1470
  "pet_skateboard",
1733
1471
  "daily_ootd",
@@ -2218,10 +1956,14 @@ var { MODELS } = defineModels("kling", [
2218
1956
  mode: "video",
2219
1957
  inputType: "i2v",
2220
1958
  badge: ["new"],
2221
- description: "Apply 260+ visual effects to photos \u2014 single or dual-image scenes.",
1959
+ description: "Apply 270+ visual effects to photos \u2014 single or dual-image scenes.",
2222
1960
  features: [feat("Image Input", "input"), feat("Video Effects", "characteristic")],
2223
1961
  paramConfig: {
2224
- ...params.style(effectSceneStyles, effectSceneStyles[0].id),
1962
+ ...params.catalog("templateId", {
1963
+ label: "Effect",
1964
+ source: { workflow: "kling/v1/catalog/templates" },
1965
+ default: "korean_baseball"
1966
+ }),
2225
1967
  ...params.imageInput(2, "Effect Images", true)
2226
1968
  }
2227
1969
  },
@@ -2414,7 +2156,9 @@ var buildKlingElementsPayload = (input) => {
2414
2156
  var buildKlingVideoEffectsPayload = (input) => {
2415
2157
  const isDualEffect = input.imageUrls && input.imageUrls.length >= 2;
2416
2158
  return {
2417
- effect_scene: input.style,
2159
+ // `style` carried the effect id before the catalog-bound `templateId` param
2160
+ // (4.1); persisted history still sends it. Alias removed in the next major.
2161
+ effect_scene: input.templateId ?? input.style,
2418
2162
  ...isDualEffect ? { images: input.imageUrls.slice(0, 2) } : input.imageUrls?.[0] ? { image: input.imageUrls[0] } : {}
2419
2163
  };
2420
2164
  };
@@ -4777,13 +4521,18 @@ function toAvatarOption(item, provider) {
4777
4521
  };
4778
4522
  }
4779
4523
  var registry = /* @__PURE__ */ new Map();
4780
- var keyOf = (s) => `${s.workflow}\0${s.modelId ?? ""}`;
4781
- function installHydratedCatalog(source, kind, items, provider, version) {
4524
+ var keyOf = (s) => `${s.workflow} ${s.modelId ?? ""}`;
4525
+ var OPTION_ADAPTERS = {
4526
+ voiceId: toVoiceOption,
4527
+ videoId: toAvatarOption
4528
+ };
4529
+ function installHydratedCatalog(source, paramKey, items, provider, version) {
4530
+ const adapt = OPTION_ADAPTERS[paramKey];
4782
4531
  registry.set(keyOf(source), {
4783
- kind,
4532
+ paramKey,
4784
4533
  items,
4785
4534
  options: items.map((i) => ({ id: i.id, label: i.name })),
4786
- catalogOptions: kind === "voices" ? items.map((i) => toVoiceOption(i, provider)) : items.map((i) => toAvatarOption(i, provider)),
4535
+ catalogOptions: adapt ? items.map((i) => adapt(i, provider)) : items,
4787
4536
  version
4788
4537
  });
4789
4538
  }
@@ -4793,7 +4542,7 @@ function getHydratedCatalog(source) {
4793
4542
  function getHydratedVoices() {
4794
4543
  const out = [];
4795
4544
  for (const c of registry.values()) {
4796
- if (c.kind === "voices") out.push(...c.catalogOptions);
4545
+ if (c.paramKey === "voiceId") out.push(...c.catalogOptions);
4797
4546
  }
4798
4547
  return out;
4799
4548
  }
@@ -7705,6 +7454,11 @@ var SANA_AR_TO_SIZE = {
7705
7454
  "2:1": "1408x704",
7706
7455
  "1:2": "704x1408"
7707
7456
  };
7457
+ var buildFlowEffectsPayload = (ctx) => ({
7458
+ // Wire field stays `template` — the deployed adapter's command contract.
7459
+ template: ctx.templateId ?? "",
7460
+ imageUrls: ctx.imageUrls ?? []
7461
+ });
7708
7462
  var buildPcpSanaSprintPayload = (ctx) => {
7709
7463
  const size = resolveImageSize(ctx, SANA_AR_TO_SIZE);
7710
7464
  const [w, h] = size ? size.split("x").map((n) => parseInt(n)) : [1024, 1024];
@@ -7861,6 +7615,51 @@ var { MODELS: MODELS31 } = defineModels("picsart", [
7861
7615
  ...params.aspectRatio(Object.keys(SANA_AR_TO_SIZE), "1:1")
7862
7616
  }
7863
7617
  },
7618
+ {
7619
+ id: "picsart-flow",
7620
+ name: "Picsart Effects",
7621
+ addedAt: "2026-08-14",
7622
+ workflow: "picsart-flow/v1/effects",
7623
+ buildPayload: buildFlowEffectsPayload,
7624
+ estimatedTime: 35,
7625
+ mode: "image",
7626
+ inputType: "i2i",
7627
+ badge: ["new"],
7628
+ description: "Apply curated Picsart effect presets to a photo \u2014 multi-step Magic Flow pipelines, one tap.",
7629
+ features: [feat("Effect Presets", "characteristic"), feat("Image Required", "input")],
7630
+ paramConfig: {
7631
+ ...params.catalog("templateId", {
7632
+ label: "Effect Preset",
7633
+ required: true,
7634
+ source: { workflow: "picsart-flow/v1/catalog/templates", modelId: "picsart-flow" },
7635
+ default: ""
7636
+ }),
7637
+ // Slot count per template rides the catalog item's meta.imageSlots.
7638
+ ...params.imageInput(3, "Your Photo", true, "asset")
7639
+ }
7640
+ },
7641
+ {
7642
+ id: "picsart-flow-video",
7643
+ name: "Picsart Effects Video",
7644
+ addedAt: "2026-08-14",
7645
+ workflow: "picsart-flow/v1/effects",
7646
+ buildPayload: buildFlowEffectsPayload,
7647
+ estimatedTime: 150,
7648
+ mode: "video",
7649
+ inputType: "i2v",
7650
+ badge: ["new"],
7651
+ description: "Animate a photo with curated Picsart video presets \u2014 multi-step Magic Flow pipelines, one tap.",
7652
+ features: [feat("Effect Presets", "characteristic"), feat("Image Required", "input")],
7653
+ paramConfig: {
7654
+ ...params.catalog("templateId", {
7655
+ label: "Effect Preset",
7656
+ required: true,
7657
+ source: { workflow: "picsart-flow/v1/catalog/templates", modelId: "picsart-flow-video" },
7658
+ default: ""
7659
+ }),
7660
+ ...params.imageInput(3, "Your Photo", true, "asset")
7661
+ }
7662
+ },
7864
7663
  {
7865
7664
  id: "picsart-hidream-t2i",
7866
7665
  name: "Picsart HiDream T2I",
@@ -9875,10 +9674,6 @@ function createApis(config) {
9875
9674
  // src/client/catalogs.ts
9876
9675
  var DEFAULT_LIMIT = 100;
9877
9676
  var MIN_TTL_SECONDS = 60;
9878
- var PARAM_KEY = {
9879
- voices: "voiceId",
9880
- avatars: "videoId"
9881
- };
9882
9677
  var copyPage = (page) => ({
9883
9678
  items: [...page.items],
9884
9679
  nextCursor: page.nextCursor
@@ -9947,7 +9742,7 @@ function createCatalogs(transport, options) {
9947
9742
  }
9948
9743
  return [...byId.values()];
9949
9744
  }
9950
- async function loadPage(def, kind, source, options2) {
9745
+ async function loadPage(def, paramKey, source, options2) {
9951
9746
  const store = storeFor(source, options2?.forceRefresh);
9952
9747
  const cursorKey = options2?.cursor ?? "";
9953
9748
  const cached = store.pages.get(cursorKey);
@@ -9970,7 +9765,7 @@ function createCatalogs(transport, options) {
9970
9765
  if (store.expiresAt === 0) {
9971
9766
  store.expiresAt = Date.now() + Math.max(MIN_TTL_SECONDS, res.ttlSeconds || 0) * 1e3;
9972
9767
  }
9973
- installHydratedCatalog(source, kind, accumulated(store), def.provider, store.version);
9768
+ installHydratedCatalog(source, paramKey, accumulated(store), def.provider, store.version);
9974
9769
  }
9975
9770
  return page;
9976
9771
  }).finally(() => {
@@ -9979,33 +9774,32 @@ function createCatalogs(transport, options) {
9979
9774
  inflight.set(inflightKey, run);
9980
9775
  return abortable(run.then(copyPage), options2?.signal);
9981
9776
  }
9982
- function requireSource(def, kind) {
9983
- const d = def.paramConfig[PARAM_KEY[kind]]?.descriptor;
9777
+ function requireSource(def, key) {
9778
+ const d = def.paramConfig[key]?.descriptor;
9984
9779
  const source = d?.kind === "catalog" ? d.source : void 0;
9985
9780
  if (!source) {
9986
- throw new Error(`Model "${def.id}" has no runtime ${kind} catalog \u2014 its ${PARAM_KEY[kind]} options are static.`);
9781
+ throw new Error(`Model "${def.id}" has no runtime catalog on param "${key}" \u2014 its options are static.`);
9987
9782
  }
9988
9783
  return source;
9989
9784
  }
9785
+ async function loadParam(model, key, options2) {
9786
+ const def = resolveModel(model);
9787
+ return loadPage(def, key, requireSource(def, key), options2);
9788
+ }
9990
9789
  const client = {
9991
- async voices(model, options2) {
9992
- const def = resolveModel(model);
9993
- return loadPage(def, "voices", requireSource(def, "voices"), options2);
9994
- },
9995
- async avatars(model, options2) {
9996
- const def = resolveModel(model);
9997
- return loadPage(def, "avatars", requireSource(def, "avatars"), options2);
9998
- }
9790
+ voices: (model, options2) => loadParam(model, "voiceId", options2),
9791
+ avatars: (model, options2) => loadParam(model, "videoId", options2),
9792
+ templates: (model, options2) => loadParam(model, "templateId", options2)
9999
9793
  };
10000
9794
  if (options?.preload) {
10001
9795
  const seen = /* @__PURE__ */ new Set();
10002
9796
  for (const def of ALL_MODELS) {
10003
- for (const kind of ["voices", "avatars"]) {
10004
- const d = def.paramConfig[PARAM_KEY[kind]]?.descriptor;
10005
- const source = d?.kind === "catalog" ? d.source : void 0;
9797
+ for (const [key, entry] of Object.entries(def.paramConfig)) {
9798
+ const d = entry.descriptor;
9799
+ const source = d.kind === "catalog" ? d.source : void 0;
10006
9800
  if (!source || seen.has(keyOf2(source))) continue;
10007
9801
  seen.add(keyOf2(source));
10008
- void loadPage(def, kind, source).catch(() => {
9802
+ void loadPage(def, key, source).catch(() => {
10009
9803
  });
10010
9804
  }
10011
9805
  }
@@ -10727,6 +10521,8 @@ var MinimaxMusicV3 = "minimax-music-v3";
10727
10521
  var Ovi = "ovi";
10728
10522
  var PicsartChangeBg = "picsart-change-bg";
10729
10523
  var PicsartEnhance = "picsart-enhance";
10524
+ var PicsartFlow = "picsart-flow";
10525
+ var PicsartFlowVideo = "picsart-flow-video";
10730
10526
  var PicsartFlux2Klein = "picsart-flux-2-klein";
10731
10527
  var PicsartHidreamT2i = "picsart-hidream-t2i";
10732
10528
  var PicsartQwenImageEdit = "picsart-qwen-image-edit";
@@ -10933,6 +10729,8 @@ var Models = {
10933
10729
  Ovi,
10934
10730
  PicsartChangeBg,
10935
10731
  PicsartEnhance,
10732
+ PicsartFlow,
10733
+ PicsartFlowVideo,
10936
10734
  PicsartFlux2Klein,
10937
10735
  PicsartHidreamT2i,
10938
10736
  PicsartQwenImageEdit,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@picsart/ai-sdk",
3
- "version": "5.6.1",
3
+ "version": "5.8.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",
@@ -25,6 +25,7 @@
25
25
  "exports": {
26
26
  ".": {
27
27
  "types": "./index.d.ts",
28
+ "module-sync": "./index.js",
28
29
  "import": "./index.js"
29
30
  }
30
31
  },