@picsart/ai-sdk 6.14.0 → 6.15.1

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
@@ -153,6 +153,35 @@ const folders = await ai.drive.folders()
153
153
  const items = await ai.drive.list()
154
154
  ```
155
155
 
156
+ Generated Drive assets carry `model` and JSON `aiSDKPayload` automatically. Both
157
+ `generate()` and `submit()` record the original SDK inputs; custom Drive attributes
158
+ cannot replace that provenance. These are requested inputs, not a claim that every
159
+ provider default or rewritten prompt has been recovered. The stored prompt is capped
160
+ at 18,000 characters without changing the prompt sent to generation.
161
+
162
+ `apis.run()` remains a direct vendor API pass-through. It does not apply the client’s
163
+ Drive configuration or derive SDK metadata, even when a vendor payload explicitly
164
+ requests Drive saving. Vendor-shaped inputs must never be stored as `aiSDKPayload`;
165
+ that attribute is reserved for original SDK-shaped inputs.
166
+
167
+ For a separate or delayed save, pass the original generation context:
168
+
169
+ ```typescript
170
+ await ai.drive.save({
171
+ url: generatedUrl,
172
+ name: 'clip.mp4',
173
+ resourceType: 'VIDEO',
174
+ generation: { modelId, params: originalGenerationParams },
175
+ })
176
+ // The existing helper also accepts a full params object instead of just a prompt:
177
+ const saveParams = ai.drive.buildSaveParams(generatedUrl, modelId, modelName, 'video', originalGenerationParams)
178
+ ```
179
+
180
+ Legacy `model`/`prompt`/`textScript` saves are normalized at write time. URL-only
181
+ uploads remain ordinary uploads: without generation context the SDK cannot infer
182
+ model, prompt or settings. Existing Drive files are not backfilled. The backend preserves SDK-supplied metadata; it cannot reconstruct SDK input
183
+ names or catalog model IDs from an arbitrary vendor request.
184
+
156
185
  ## Text Generation (LLMs)
157
186
 
158
187
  Claude, GPT, and Gemini text models are called with `generateText()`. Single-shot:
package/index.d.ts CHANGED
@@ -500,6 +500,16 @@ type ModelInputById = {
500
500
  imageUrls?: string[];
501
501
  thinking?: "off" | "low" | "medium" | "high";
502
502
  };
503
+ "gpt-6-luna": {
504
+ prompt: string;
505
+ imageUrls?: string[];
506
+ thinking?: "off" | "low" | "medium" | "high";
507
+ };
508
+ "gpt-6-sol": {
509
+ prompt: string;
510
+ imageUrls?: string[];
511
+ thinking?: "off" | "low" | "medium" | "high";
512
+ };
503
513
  "gpt-image-1": {
504
514
  prompt: string;
505
515
  aspectRatio?: "1:1" | "3:2" | "2:3" | "16:9" | "9:16" | "4:3" | "3:4";
@@ -1934,7 +1944,7 @@ type ModelInputById = {
1934
1944
  type TypedModelId = keyof ModelInputById;
1935
1945
  type ModelInput<M extends TypedModelId> = ModelInputById[M];
1936
1946
  /** IDs of text-generation (LLM) models — narrows generateText(). */
1937
- type TextModelId = "claude-fable-5" | "claude-fable-5-1" | "claude-haiku-4-5" | "claude-opus-4-8" | "claude-opus-5" | "claude-sonnet-4-5" | "claude-sonnet-4-6" | "claude-sonnet-5" | "eleven-speech-to-text" | "gemini-2.5-flash" | "gemini-3-pro" | "gemini-3.5-flash-lite" | "gemini-3.6-flash" | "gemini-3.7-flash" | "gemini-3.8-flash" | "gpt-4.1-mini" | "gpt-4.1-nano" | "gpt-4o" | "gpt-4o-mini" | "gpt-5" | "gpt-5-mini" | "gpt-5.1" | "gpt-5.2" | "gpt-5.5" | "gpt-5.6-luna" | "gpt-5.6-sol" | "gpt-5.6-terra" | "gpt-6-astra";
1947
+ type TextModelId = "claude-fable-5" | "claude-fable-5-1" | "claude-haiku-4-5" | "claude-opus-4-8" | "claude-opus-5" | "claude-sonnet-4-5" | "claude-sonnet-4-6" | "claude-sonnet-5" | "eleven-speech-to-text" | "gemini-2.5-flash" | "gemini-3-pro" | "gemini-3.5-flash-lite" | "gemini-3.6-flash" | "gemini-3.7-flash" | "gemini-3.8-flash" | "gpt-4.1-mini" | "gpt-4.1-nano" | "gpt-4o" | "gpt-4o-mini" | "gpt-5" | "gpt-5-mini" | "gpt-5.1" | "gpt-5.2" | "gpt-5.5" | "gpt-5.6-luna" | "gpt-5.6-sol" | "gpt-5.6-terra" | "gpt-6-astra" | "gpt-6-luna" | "gpt-6-sol";
1938
1948
  type TextModelInputById = Pick<ModelInputById, TextModelId>;
1939
1949
 
1940
1950
  interface ParamSchema {
@@ -2658,11 +2668,19 @@ interface ListOptions {
2658
2668
  folder?: DriveFolder;
2659
2669
  type?: MediaTypeFilter;
2660
2670
  }
2671
+ /** Original generation inputs, portable across clients and delayed Drive saves. */
2672
+ interface GenerationProvenance {
2673
+ modelId: string;
2674
+ params: Record<string, unknown>;
2675
+ app?: AppIdentity;
2676
+ }
2661
2677
  interface SaveParams {
2662
2678
  url: string;
2663
2679
  name: string;
2664
2680
  resourceType: 'PHOTO' | 'VIDEO' | 'AUDIO';
2665
2681
  attributes?: Record<string, string>;
2682
+ /** Required to retain full provenance when saving a generated URL separately. */
2683
+ generation?: GenerationProvenance;
2666
2684
  previewUrl?: string;
2667
2685
  }
2668
2686
  /** Target folder for backend Drive save. */
@@ -2704,7 +2722,7 @@ interface DriveClient {
2704
2722
  /** Save an asset to Drive. */
2705
2723
  save(params: SaveParams, folder?: DriveFolder): Promise<DriveSaveResult | null>;
2706
2724
  /** Build the save params for a generation result. */
2707
- buildSaveParams(url: string, modelId: string, modelName: string, mode: string, prompt?: string): SaveParams;
2725
+ buildSaveParams(url: string, modelId: string, modelName: string, mode: string, promptOrParams?: string | Record<string, unknown>): SaveParams;
2708
2726
  /** Set a like/dislike reaction on a file. */
2709
2727
  addReaction(fileUid: string, reaction: UserReaction): Promise<boolean>;
2710
2728
  /** Clear the reaction on a file. */
@@ -2734,12 +2752,7 @@ declare function resolveExtension(mode: string, hints?: FilenameHints): string;
2734
2752
  */
2735
2753
  declare function expectedOutputFormat(model: Pick<ModelDefinition, 'paramConfig' | 'outputExtension'>, params: Record<string, unknown>): string | undefined;
2736
2754
  declare function buildFilename(prompt: string | undefined, mode: string, hints?: FilenameHints): string;
2737
- declare function buildGenerationAttributes(input: {
2738
- modelId: string;
2739
- params: Record<string, unknown>;
2740
- /** TODO(backend-autosave): temporary — remove once the backend stamps appId/appType. */
2741
- app?: AppIdentity;
2742
- }): DriveAttributes;
2755
+ declare function buildGenerationAttributes(input: GenerationProvenance): DriveAttributes;
2743
2756
  declare function parseGeneration(file: DriveFile | Record<string, unknown>): GenerationFile;
2744
2757
 
2745
2758
  /** Result of `ai.apis.run()` — the API result plus optional credit usage. */
@@ -3209,6 +3222,8 @@ declare const Models: {
3209
3222
  readonly Gpt56Sol: "gpt-5.6-sol";
3210
3223
  readonly Gpt56Terra: "gpt-5.6-terra";
3211
3224
  readonly Gpt6Astra: "gpt-6-astra";
3225
+ readonly Gpt6Luna: "gpt-6-luna";
3226
+ readonly Gpt6Sol: "gpt-6-sol";
3212
3227
  readonly GptImage1: "gpt-image-1";
3213
3228
  readonly GptImage15: "gpt-image-1.5";
3214
3229
  readonly GptImage2: "gpt-image-2";
@@ -3533,4 +3548,4 @@ declare const getModel: (id: string) => ModelDefinition | undefined;
3533
3548
  */
3534
3549
  declare const findModel: (ref: string) => ModelDefinition | undefined;
3535
3550
 
3536
- export { ALL_MODELS, type AiClient, ApiError, type ApiErrorCode, type ApiErrorInit, 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 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 DriveDraftInfo, 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 GenerateResultItemMetadata, type GenerateTextResult, type GenerationContext, type GenerationEvent, GenerationEventType, type GenerationFile, type GenerationMode, type GenerationOptions, type GenerationProgress, type ListOptions, type MediaModelId, type MediaTypeFilter, Model, type ModelDefinition, type ModelDescriptor, type 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 PayloadInputsTransformationOptions, type PricingOptions, type ProviderInfo, type RangeDescriptor, type RangeEntry, type ReleaseTag, type SaveParams, type SdkPayload, type SdkTransport, type SeedanceDraftTask, type TextDescriptor, type TextEntry, type TextModelId, type TextModelInputById, type ToolUsage, type TransportPollOptions, type TransportResult, type TypedModelId, type UserReaction, type ValidationResult, type VoiceOption, type WorkflowJobHandle, type WorkflowSubmitRequest, buildFilename, buildGenerationAttributes, catalog, createClient, decodeDeepLinkPayload, encodeDeepLinkPayload, expectedOutputFormat, findModel, getModel, getModelsByMode, getVoiceById, inferResourceType, isVisibleForReleases, parseGeneration, releaseOf, resolveExtension, toAvatarOption, toVoiceOption };
3551
+ export { ALL_MODELS, type AiClient, ApiError, type ApiErrorCode, type ApiErrorInit, 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 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 DriveDraftInfo, 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 GenerateResultItemMetadata, type GenerateTextResult, type GenerationContext, type GenerationEvent, GenerationEventType, type GenerationFile, type GenerationMode, type GenerationOptions, type GenerationProgress, type GenerationProvenance, type ListOptions, type MediaModelId, type MediaTypeFilter, Model, type ModelDefinition, type ModelDescriptor, type 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 PayloadInputsTransformationOptions, type PricingOptions, type ProviderInfo, type RangeDescriptor, type RangeEntry, type ReleaseTag, type SaveParams, type SdkPayload, type SdkTransport, type SeedanceDraftTask, type TextDescriptor, type TextEntry, type TextModelId, type TextModelInputById, type ToolUsage, type TransportPollOptions, type TransportResult, type TypedModelId, type UserReaction, type ValidationResult, type VoiceOption, type WorkflowJobHandle, type WorkflowSubmitRequest, buildFilename, buildGenerationAttributes, catalog, createClient, decodeDeepLinkPayload, encodeDeepLinkPayload, expectedOutputFormat, findModel, getModel, getModelsByMode, getVoiceById, inferResourceType, isVisibleForReleases, parseGeneration, releaseOf, resolveExtension, toAvatarOption, toVoiceOption };
package/index.js CHANGED
@@ -9594,6 +9594,40 @@ var { MODELS: OPENAI_LLM } = defineModels("openai", [
9594
9594
  ...thinkingParam(["low", "medium", "high"])
9595
9595
  }
9596
9596
  },
9597
+ {
9598
+ id: "gpt-6-sol",
9599
+ name: "GPT-6 Sol",
9600
+ workflow: "chat-completions",
9601
+ addedAt: "2026-09-25",
9602
+ estimatedTime: 10,
9603
+ mode: "text",
9604
+ inputType: "i2t",
9605
+ badge: ["premium"],
9606
+ description: "OpenAI\u2019s most capable GPT-6 model for deep reasoning and complex tasks.",
9607
+ features: [feat("Vision", "input"), feat("Thinking", "characteristic")],
9608
+ paramConfig: {
9609
+ ...params.prompt(),
9610
+ ...params.imageInput(8, "Images"),
9611
+ ...thinkingParam(["low", "medium", "high"])
9612
+ }
9613
+ },
9614
+ {
9615
+ id: "gpt-6-luna",
9616
+ name: "GPT-6 Luna",
9617
+ workflow: "chat-completions",
9618
+ addedAt: "2026-09-25",
9619
+ estimatedTime: 5,
9620
+ mode: "text",
9621
+ inputType: "i2t",
9622
+ badge: ["fast"],
9623
+ description: "Fast, lightweight GPT-6 model for low-latency, high-volume text tasks.",
9624
+ features: [feat("Vision", "input"), feat("Thinking", "characteristic")],
9625
+ paramConfig: {
9626
+ ...params.prompt(),
9627
+ ...params.imageInput(8, "Images"),
9628
+ ...thinkingParam(["low", "medium", "high"])
9629
+ }
9630
+ },
9597
9631
  {
9598
9632
  id: "gpt-5.6-sol",
9599
9633
  name: "GPT-5.6 Sol",
@@ -9947,6 +9981,8 @@ registerPayloads(MODELS35, {
9947
9981
  "claude-sonnet-4-5": buildClaudePayload("claude-sonnet-4-5"),
9948
9982
  "claude-haiku-4-5": buildClaudePayload("claude-haiku-4-5"),
9949
9983
  "gpt-6-astra": buildOpenAiPayload("gpt-6-astra"),
9984
+ "gpt-6-sol": buildOpenAiPayload("gpt-6-sol"),
9985
+ "gpt-6-luna": buildOpenAiPayload("gpt-6-luna"),
9950
9986
  "gpt-5.6-sol": buildOpenAiPayload("gpt-5.6-sol"),
9951
9987
  "gpt-5.6-terra": buildOpenAiPayload("gpt-5.6-terra"),
9952
9988
  "gpt-5.6-luna": buildOpenAiPayload("gpt-5.6-luna"),
@@ -11961,6 +11997,23 @@ function buildGenerationAttributes(input) {
11961
11997
  }
11962
11998
  return attrs;
11963
11999
  }
12000
+ function attributesForSave(params2) {
12001
+ const attributes = { ...params2.attributes };
12002
+ if (params2.generation) {
12003
+ return { ...attributes, ...buildGenerationAttributes(params2.generation) };
12004
+ }
12005
+ if (asString(attributes.model)) {
12006
+ const legacy = adaptLegacyGeneration(attributes);
12007
+ const canonical = parseJsonAttr(attributes.aiSDKPayload);
12008
+ const payload = canonical && typeof canonical.prompt === "string" ? canonical : legacy.aiSDKPayload ?? {};
12009
+ return {
12010
+ ...legacy.appId ? { appId: legacy.appId, appType: legacy.appType } : {},
12011
+ ...attributes,
12012
+ ...buildGenerationAttributes({ modelId: attributes.model, params: payload })
12013
+ };
12014
+ }
12015
+ return attributes;
12016
+ }
11964
12017
  function toMediaItem(file) {
11965
12018
  const url = normalizeUrl(file.sourceUrl);
11966
12019
  if (!url || String(file.name || "").startsWith("__")) return null;
@@ -12296,7 +12349,7 @@ function createDriveClient(f, apiUrl, rootFolderName) {
12296
12349
  width: 1024,
12297
12350
  height: 1024
12298
12351
  },
12299
- attributes: Object.entries(params2.attributes ?? {}).map(([property, value]) => ({
12352
+ attributes: Object.entries(attributesForSave(params2)).map(([property, value]) => ({
12300
12353
  property,
12301
12354
  value
12302
12355
  }))
@@ -12324,15 +12377,17 @@ function createDriveClient(f, apiUrl, rootFolderName) {
12324
12377
  }
12325
12378
  },
12326
12379
  /** Build standard save params from a generation result. */
12327
- buildSaveParams(url, modelId, modelName, mode, prompt) {
12380
+ buildSaveParams(url, modelId, modelName, mode, promptOrParams) {
12381
+ const params2 = typeof promptOrParams === "string" ? { prompt: promptOrParams } : promptOrParams ?? {};
12382
+ const prompt = String(params2.prompt ?? "");
12328
12383
  return {
12329
12384
  url,
12330
12385
  name: buildFilename(prompt, mode, { url }),
12331
12386
  resourceType: inferResourceType(mode),
12332
12387
  attributes: {
12333
12388
  tool: "ai-sdk",
12334
- model: modelId,
12335
- prompt: prompt || "",
12389
+ ...buildGenerationAttributes({ modelId, params: params2 }),
12390
+ prompt,
12336
12391
  service: modelName
12337
12392
  }
12338
12393
  };
@@ -12640,8 +12695,8 @@ function createClient(config) {
12640
12695
  return {
12641
12696
  // Named before the job runs, so the requested/declared format is the best hint.
12642
12697
  name: explicit?.name ?? buildFilename(params2.prompt, model.mode, { format: expectedOutputFormat(model, params2) }),
12643
- // SDK-assembled attributes are the baseline; explicit attributes win per-key.
12644
- attributes: { ...attributes, ...explicit?.attributes ?? {} },
12698
+ // Generation provenance is authoritative; custom attributes cannot replace it.
12699
+ attributes: { ...explicit?.attributes ?? {}, ...attributes },
12645
12700
  folder: explicit?.folder ?? (folderPath ? { path: folderPath } : void 0)
12646
12701
  };
12647
12702
  }
@@ -12920,6 +12975,8 @@ var Gpt56Luna = "gpt-5.6-luna";
12920
12975
  var Gpt56Sol = "gpt-5.6-sol";
12921
12976
  var Gpt56Terra = "gpt-5.6-terra";
12922
12977
  var Gpt6Astra = "gpt-6-astra";
12978
+ var Gpt6Luna = "gpt-6-luna";
12979
+ var Gpt6Sol = "gpt-6-sol";
12923
12980
  var GptImage1 = "gpt-image-1";
12924
12981
  var GptImage15 = "gpt-image-1.5";
12925
12982
  var GptImage2 = "gpt-image-2";
@@ -13171,6 +13228,8 @@ var Models = {
13171
13228
  Gpt56Sol,
13172
13229
  Gpt56Terra,
13173
13230
  Gpt6Astra,
13231
+ Gpt6Luna,
13232
+ Gpt6Sol,
13174
13233
  GptImage1,
13175
13234
  GptImage15,
13176
13235
  GptImage2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@picsart/ai-sdk",
3
- "version": "6.14.0",
3
+ "version": "6.15.1",
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",