@picsart/ai-sdk 6.18.0 → 6.19.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/README.md CHANGED
@@ -177,6 +177,16 @@ await ai.drive.save({
177
177
  const saveParams = ai.drive.buildSaveParams(generatedUrl, modelId, modelName, 'video', originalGenerationParams)
178
178
  ```
179
179
 
180
+ When the request you submit is not the record you want kept (a render that sends
181
+ only a reference to an earlier job, say), pass the inputs to record as
182
+ `drive.generation`. Custom `attributes` still cannot replace them:
183
+
184
+ ```typescript
185
+ await ai.submit(modelId, finalRequest, {
186
+ drive: { name: 'final.mp4', generation: { modelId, params: originalGenerationParams } },
187
+ })
188
+ ```
189
+
180
190
  Legacy `model`/`prompt`/`textScript` saves are normalized at write time. URL-only
181
191
  uploads remain ordinary uploads: without generation context the SDK cannot infer
182
192
  model, prompt or settings. Existing Drive files are not backfilled. The backend preserves SDK-supplied metadata; it cannot reconstruct SDK input
@@ -149,7 +149,7 @@ interface ChatCompletionsCommand$1 {
149
149
  tools?: FunctionTool[];
150
150
  service_tier?: ServiceTier;
151
151
  }
152
- type ChatCompletionModels = "gpt-6-astra" | "gpt-6-sol" | "gpt-6-luna" | "gpt-5" | "gpt-5.1" | "gpt-5.2" | "gpt-5.2-pro" | "gpt-5.3-codex" | "gpt-5.4" | "gpt-5.4-pro" | "gpt-5.4-mini" | "gpt-5.4-nano" | "gpt-5.5" | "gpt-5.5-pro" | "gpt-5.6-sol" | "gpt-5.6-terra" | "gpt-5.6-luna" | "gpt-5-pro" | "gpt-5-mini" | "gpt-5-nano" | "gpt-5-search-api" | "gpt-4o" | "gpt-4o-mini" | "gpt-4.1" | "gpt-4.1-mini" | "gpt-4.1-nano" | "claude-sonnet-4-5" | "claude-sonnet-4-6" | "claude-sonnet-5" | "claude-opus-4-8" | "claude-opus-5" | "claude-haiku-4-5" | "claude-fable-5" | "claude-fable-5-1" | "gemini-3.1-pro-preview" | "gemini-3-flash-preview" | "gemini-3.8-flash" | "gemini-3.7-flash" | "gemini-3.6-flash" | "gemini-3.5-flash" | "gemini-3.5-flash-lite" | "gemini-3.1-flash-lite" | "gemini-2.5-flash" | "gemini-2.5-pro";
152
+ type ChatCompletionModels = "gpt-6-astra" | "gpt-6-sol" | "gpt-6-luna" | "gpt-5" | "gpt-5.1" | "gpt-5.2" | "gpt-5.2-pro" | "gpt-5.3-codex" | "gpt-5.4" | "gpt-5.4-pro" | "gpt-5.4-mini" | "gpt-5.4-nano" | "gpt-5.5" | "gpt-5.5-pro" | "gpt-5.6-sol" | "gpt-5.6-terra" | "gpt-5.6-luna" | "gpt-5-pro" | "gpt-5-mini" | "gpt-5-nano" | "gpt-5-search-api" | "gpt-4o" | "gpt-4o-mini" | "gpt-4.1" | "gpt-4.1-mini" | "gpt-4.1-nano" | "claude-sonnet-4-5" | "claude-sonnet-4-6" | "claude-sonnet-5" | "claude-opus-4-8" | "claude-opus-5" | "claude-opus-5-5" | "claude-haiku-4-5" | "claude-fable-5" | "claude-fable-5-1" | "gemini-3.1-pro-preview" | "gemini-3-flash-preview" | "gemini-3.8-flash" | "gemini-3.7-flash" | "gemini-3.6-flash" | "gemini-3.5-flash" | "gemini-3.5-flash-lite" | "gemini-3.1-flash-lite" | "gemini-2.5-flash" | "gemini-2.5-pro";
153
153
  interface MessageParam {
154
154
  name?: string;
155
155
  role: "developer" | "system" | "user" | "assistant" | "tool";
@@ -206,7 +206,7 @@ interface ChatCompletionResponse {
206
206
  interface ChatCompletionResult {
207
207
  id: string;
208
208
  created: number;
209
- model: "gpt-6-astra" | "gpt-6-sol" | "gpt-6-luna" | "gpt-5" | "gpt-5.1" | "gpt-5.2" | "gpt-5.2-pro" | "gpt-5.3-codex" | "gpt-5.4" | "gpt-5.4-pro" | "gpt-5.4-mini" | "gpt-5.4-nano" | "gpt-5.5" | "gpt-5.5-pro" | "gpt-5.6-sol" | "gpt-5.6-terra" | "gpt-5.6-luna" | "gpt-5-pro" | "gpt-5-mini" | "gpt-5-nano" | "gpt-5-search-api" | "gpt-4o" | "gpt-4o-mini" | "gpt-4.1" | "gpt-4.1-mini" | "gpt-4.1-nano" | "claude-sonnet-4-5" | "claude-sonnet-4-6" | "claude-sonnet-5" | "claude-opus-4-8" | "claude-opus-5" | "claude-haiku-4-5" | "claude-fable-5" | "claude-fable-5-1" | "gemini-3.1-pro-preview" | "gemini-3-flash-preview" | "gemini-3.8-flash" | "gemini-3.7-flash" | "gemini-3.6-flash" | "gemini-3.5-flash" | "gemini-3.5-flash-lite" | "gemini-3.1-flash-lite" | "gemini-2.5-flash" | "gemini-2.5-pro";
209
+ model: "gpt-6-astra" | "gpt-6-sol" | "gpt-6-luna" | "gpt-5" | "gpt-5.1" | "gpt-5.2" | "gpt-5.2-pro" | "gpt-5.3-codex" | "gpt-5.4" | "gpt-5.4-pro" | "gpt-5.4-mini" | "gpt-5.4-nano" | "gpt-5.5" | "gpt-5.5-pro" | "gpt-5.6-sol" | "gpt-5.6-terra" | "gpt-5.6-luna" | "gpt-5-pro" | "gpt-5-mini" | "gpt-5-nano" | "gpt-5-search-api" | "gpt-4o" | "gpt-4o-mini" | "gpt-4.1" | "gpt-4.1-mini" | "gpt-4.1-nano" | "claude-sonnet-4-5" | "claude-sonnet-4-6" | "claude-sonnet-5" | "claude-opus-4-8" | "claude-opus-5" | "claude-opus-5-5" | "claude-haiku-4-5" | "claude-fable-5" | "claude-fable-5-1" | "gemini-3.1-pro-preview" | "gemini-3-flash-preview" | "gemini-3.8-flash" | "gemini-3.7-flash" | "gemini-3.6-flash" | "gemini-3.5-flash" | "gemini-3.5-flash-lite" | "gemini-3.1-flash-lite" | "gemini-2.5-flash" | "gemini-2.5-pro";
210
210
  choices: Choice[];
211
211
  usage: Usage$1;
212
212
  }
@@ -776,7 +776,7 @@ interface ClaudeV1MessagesCommand {
776
776
  context_management?: ClaudeContextManagement;
777
777
  options?: GenAIOptions$2E;
778
778
  }
779
- type ClaudeV1Models = "claude-opus-4-8" | "claude-opus-5" | "claude-sonnet-4-5" | "claude-sonnet-4-6" | "claude-sonnet-5" | "claude-haiku-4-5" | "claude-fable-5" | "claude-fable-5-1";
779
+ type ClaudeV1Models = "claude-opus-4-8" | "claude-opus-5" | "claude-opus-5-5" | "claude-sonnet-4-5" | "claude-sonnet-4-6" | "claude-sonnet-5" | "claude-haiku-4-5" | "claude-fable-5" | "claude-fable-5-1";
780
780
  interface ClaudeMessageParam {
781
781
  role: string;
782
782
  content: ClaudeContentBlock[];
@@ -9603,7 +9603,7 @@ interface CatalogPreviewModel {
9603
9603
 
9604
9604
  interface ImageSegmentationCommand {
9605
9605
  image_url: string;
9606
- model: "picsart-multimatting-v13" | "picsart-sky-v1" | "preview-picsart-multimatting-v13" | "preview-picsart-sky-v1";
9606
+ model?: "picsart-multimatting-v13" | "picsart-sky-v1";
9607
9607
  segmentation_class?: "all" | "background" | "hair" | "skin" | "lips" | "eyes" | "clothes" | "glasses" | "teeth" | "foreground";
9608
9608
  options?: GenAIOptions$C;
9609
9609
  }
package/index.d.ts CHANGED
@@ -1754,6 +1754,7 @@ type ModelInputById = {
1754
1754
  video_input: boolean;
1755
1755
  signature: string;
1756
1756
  };
1757
+ omniReferenceTaskType?: "auto" | "reference" | "edit" | "extend";
1757
1758
  imageUrls?: string[];
1758
1759
  videoUrls?: string[];
1759
1760
  audioUrls?: string[];
@@ -1798,6 +1799,7 @@ type ModelInputById = {
1798
1799
  video_input: boolean;
1799
1800
  signature: string;
1800
1801
  };
1802
+ omniReferenceTaskType?: "auto" | "reference" | "edit" | "extend";
1801
1803
  imageUrls?: string[];
1802
1804
  videoUrls?: string[];
1803
1805
  audioUrls?: string[];
@@ -2779,6 +2781,13 @@ interface PayloadDriveOptions {
2779
2781
  attributes?: DriveAttributes;
2780
2782
  /** Target folder in Picsart Drive. */
2781
2783
  folder?: PayloadDriveFolderOptions;
2784
+ /**
2785
+ * Inputs to record as the file's provenance when they differ from the
2786
+ * submitted request, e.g. a render that sends only a reference to an earlier
2787
+ * job. Defaults to the model and params being generated. Never sent to the
2788
+ * workflow; it only shapes `attributes`.
2789
+ */
2790
+ generation?: GenerationProvenance;
2782
2791
  }
2783
2792
  /**
2784
2793
  * Drive operations surface — returned by {@link createDriveClient} and exposed
package/index.js CHANGED
@@ -4453,6 +4453,7 @@ var buildSeedance25PayloadFor = (modelAlias) => withSeedance25DraftMode(modelAli
4453
4453
  const refVideos = ctx.videoUrls ?? [];
4454
4454
  const refAudios = ctx.audioUrls ?? [];
4455
4455
  const usesFrame = Boolean(ctx.startFrame || ctx.endFrame);
4456
+ const { omniReferenceTaskType } = ctx;
4456
4457
  return {
4457
4458
  model: modelAlias,
4458
4459
  content: [
@@ -4482,7 +4483,8 @@ var buildSeedance25PayloadFor = (modelAlias) => withSeedance25DraftMode(modelAli
4482
4483
  resolution: ctx.resolution ?? "1080p",
4483
4484
  generate_audio: ctx.generateAudio ?? true,
4484
4485
  output_format: seedance25OutputFormat(ctx),
4485
- ...ctx.returnLastFrame ? { return_last_frame: true } : {}
4486
+ ...ctx.returnLastFrame ? { return_last_frame: true } : {},
4487
+ ...omniReferenceTaskType !== void 0 ? { omni_reference_task_type: omniReferenceTaskType } : {}
4486
4488
  };
4487
4489
  });
4488
4490
  var buildSeedance25VideoEditPayloadFor = (modelAlias) => withSeedance25DraftMode(modelAlias, (ctx) => ({
@@ -4501,6 +4503,7 @@ var buildSeedance25VideoEditPayloadFor = (modelAlias) => withSeedance25DraftMode
4501
4503
  resolution: ctx.resolution ?? "1080p",
4502
4504
  generate_audio: ctx.generateAudio ?? true,
4503
4505
  output_format: seedance25OutputFormat(ctx),
4506
+ omni_reference_task_type: "edit",
4504
4507
  ...ctx.returnLastFrame ? { return_last_frame: true } : {}
4505
4508
  }));
4506
4509
  var buildSeedance25VideoExtendPayloadFor = (modelAlias) => withSeedance25DraftMode(modelAlias, (ctx) => ({
@@ -4517,7 +4520,8 @@ var buildSeedance25VideoExtendPayloadFor = (modelAlias) => withSeedance25DraftMo
4517
4520
  duration: ctx.duration ?? 15,
4518
4521
  resolution: ctx.resolution ?? "1080p",
4519
4522
  generate_audio: ctx.generateAudio ?? true,
4520
- output_format: seedance25OutputFormat(ctx)
4523
+ output_format: seedance25OutputFormat(ctx),
4524
+ omni_reference_task_type: "extend"
4521
4525
  }));
4522
4526
  var SEEDANCE_AR = ["16:9", "9:16", "1:1", "4:3", "3:4", "21:9", "adaptive"];
4523
4527
  var SEEDANCE_25_FORMATS = ["mp4", "mov"];
@@ -4545,6 +4549,23 @@ var seedance25DraftTaskParam = {
4545
4549
  }
4546
4550
  }
4547
4551
  };
4552
+ var seedance25TaskTypeParam = {
4553
+ omniReferenceTaskType: {
4554
+ label: "Task Type",
4555
+ required: false,
4556
+ descriptor: {
4557
+ kind: "enum",
4558
+ valueType: "string",
4559
+ options: [
4560
+ { id: "auto", label: "Auto" },
4561
+ { id: "reference", label: "Reference" },
4562
+ { id: "edit", label: "Edit" },
4563
+ { id: "extend", label: "Extend" }
4564
+ ],
4565
+ default: "auto"
4566
+ }
4567
+ }
4568
+ };
4548
4569
  var { MODELS: MODELS13 } = defineModels("seedance", [
4549
4570
  {
4550
4571
  id: "seedance-2.5",
@@ -4573,6 +4594,7 @@ var { MODELS: MODELS13 } = defineModels("seedance", [
4573
4594
  ...p.enum("colorDepth", SEEDANCE_25_COLOR_DEPTHS, "10bit", { label: "Color Depth" }),
4574
4595
  ...seedance25DraftParam,
4575
4596
  ...seedance25DraftTaskParam,
4597
+ ...seedance25TaskTypeParam,
4576
4598
  // 2.5 lifts the reference caps to 30 images / 10 videos / 10 audios.
4577
4599
  ...params.imageInput(30, "Reference Images", false, "reference", SEEDANCE_IMAGE_BOUNDS),
4578
4600
  ...params.videoInputs(10, "Reference Videos", false, SEEDANCE_25_VIDEO_BOUNDS),
@@ -4612,6 +4634,7 @@ var { MODELS: MODELS13 } = defineModels("seedance", [
4612
4634
  ...p.enum("colorDepth", SEEDANCE_25_COLOR_DEPTHS, "10bit", { label: "Color Depth" }),
4613
4635
  ...seedance25DraftParam,
4614
4636
  ...seedance25DraftTaskParam,
4637
+ ...seedance25TaskTypeParam,
4615
4638
  // 2.5 lifts the reference caps to 30 images / 10 videos / 10 audios.
4616
4639
  ...params.imageInput(30, "Reference Images", false, "reference", SEEDANCE_IMAGE_BOUNDS),
4617
4640
  ...params.videoInputs(10, "Reference Videos", false, SEEDANCE_25_VIDEO_BOUNDS),
@@ -13084,11 +13107,8 @@ function createClient(config) {
13084
13107
  function buildDrivePayloadOptions(model, params2, options) {
13085
13108
  const explicit = options?.drive;
13086
13109
  if (!driveConfig && !explicit) return void 0;
13087
- const attributes = buildGenerationAttributes({
13088
- modelId: model.id,
13089
- params: params2,
13090
- app: options?.app
13091
- });
13110
+ const generation = explicit?.generation;
13111
+ const attributes = buildGenerationAttributes(generation ? { ...generation, app: generation.app ?? options?.app } : { modelId: model.id, params: params2, app: options?.app });
13092
13112
  const folderPath = options?.folder?.name ?? driveConfig?.folder;
13093
13113
  return {
13094
13114
  // Named before the job runs, so the requested/declared format is the best hint.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@picsart/ai-sdk",
3
- "version": "6.18.0",
3
+ "version": "6.19.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",