@picsart/ai-sdk 4.0.0 → 4.1.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/index.d.ts +25 -5
- package/index.js +28 -20
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1787,6 +1787,8 @@ interface ModelMeta {
|
|
|
1787
1787
|
readonly features: ModelFeature[];
|
|
1788
1788
|
readonly badges: BadgeType[];
|
|
1789
1789
|
readonly provider: ProviderInfo;
|
|
1790
|
+
/** ISO YYYY-MM-DD date the model was added to the catalog, or null if unknown. */
|
|
1791
|
+
readonly addedAt: string | null;
|
|
1790
1792
|
/** Release / availability tier. Absent on the definition ⇒ `'production'`. */
|
|
1791
1793
|
readonly release: ReleaseTag;
|
|
1792
1794
|
}
|
|
@@ -1824,12 +1826,29 @@ interface CreditRange {
|
|
|
1824
1826
|
max: number;
|
|
1825
1827
|
/** Pricing unit (e.g. 'generation', 'second', 'megapixel'). Set when all matched entries share a unit. */
|
|
1826
1828
|
unit?: string;
|
|
1829
|
+
/** Per-tier breakdown behind the range — one entry per pricing row (quality /
|
|
1830
|
+
* audio / token-type variant). Reflects the entries the range summarizes
|
|
1831
|
+
* (all tiers, or the ctx-filtered subset). */
|
|
1832
|
+
tiers: CreditTier[];
|
|
1827
1833
|
}
|
|
1828
1834
|
/** Optional context to narrow the credit range by resolution / audio. */
|
|
1829
1835
|
interface CreditRangeContext {
|
|
1830
1836
|
resolution?: string;
|
|
1831
1837
|
generateAudio?: boolean;
|
|
1832
1838
|
}
|
|
1839
|
+
/** A single pricing tier for a model — one row of its rate table. */
|
|
1840
|
+
interface CreditTier {
|
|
1841
|
+
/** Credits charged per `unit`. */
|
|
1842
|
+
credits: number;
|
|
1843
|
+
/** Billing unit (e.g. 'generation', 'second', 'megapixel', 'output_text_tokens'). */
|
|
1844
|
+
unit: string;
|
|
1845
|
+
/** Quality/resolution variant this rate applies to, when priced by quality. */
|
|
1846
|
+
quality?: string;
|
|
1847
|
+
/** Whether this rate is for audio-enabled generation. */
|
|
1848
|
+
audio?: boolean;
|
|
1849
|
+
/** Use case this rate applies to (e.g. 'text-to-video'). */
|
|
1850
|
+
useCase?: string;
|
|
1851
|
+
}
|
|
1833
1852
|
/** Top-level model accessor with grouped sub-accessors. */
|
|
1834
1853
|
/** Result of validating generation input against a model's params. */
|
|
1835
1854
|
interface ValidationResult$1 {
|
|
@@ -1846,10 +1865,11 @@ interface ModelDescriptor {
|
|
|
1846
1865
|
/** Validate generation input against this model's params. Returns
|
|
1847
1866
|
* `{ valid: true }` or `{ valid: false, errors }` — never throws. */
|
|
1848
1867
|
validate(input: unknown): ValidationResult$1;
|
|
1849
|
-
/** Get the credit range for this model
|
|
1850
|
-
* resolution/audio. Returns the per-unit
|
|
1851
|
-
* parameters should scale by the value
|
|
1852
|
-
* duration when range.unit === 'second').
|
|
1868
|
+
/** Get the credit range for this model, plus the per-tier breakdown in
|
|
1869
|
+
* `.tiers`. Pass context to narrow by resolution/audio. Returns the per-unit
|
|
1870
|
+
* range — callers with time-based parameters should scale by the value
|
|
1871
|
+
* themselves (e.g. multiply by duration when range.unit === 'second').
|
|
1872
|
+
* Returns null if pricing is not loaded or the model has no entry. */
|
|
1853
1873
|
getCreditsInfo(ctx?: CreditRangeContext): CreditRange | null;
|
|
1854
1874
|
/** Workflow identifiers for this model. */
|
|
1855
1875
|
readonly api: {
|
|
@@ -2682,4 +2702,4 @@ declare const findModel: (ref: string) => ModelDefinition | undefined;
|
|
|
2682
2702
|
/** Effect scenes that require two input images (e.g. hugs, kisses, swaps). */
|
|
2683
2703
|
declare const KLING_DUAL_IMAGE_EFFECTS: ReadonlySet<string>;
|
|
2684
2704
|
|
|
2685
|
-
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, 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 };
|
|
2705
|
+
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
|
@@ -3436,7 +3436,6 @@ var { MODELS: MODELS10 } = defineModels("wan", [
|
|
|
3436
3436
|
// start/end frames. buildPayload registered in wan.payloads.ts.
|
|
3437
3437
|
workflow: "wan/v3/video",
|
|
3438
3438
|
estimatedTime: 120,
|
|
3439
|
-
release: "preview",
|
|
3440
3439
|
mode: "video",
|
|
3441
3440
|
inputType: "t2v",
|
|
3442
3441
|
description: "Wan 3.0 all-in-one \u2014 text, image/video/audio references, and start/end frames with adaptive ratio, intelligent duration, and audio.",
|
|
@@ -3947,7 +3946,7 @@ var buildSeedance20PayloadFor = (modelAlias) => (ctx) => {
|
|
|
3947
3946
|
ratio: ctx.aspectRatio ?? "16:9",
|
|
3948
3947
|
duration: ctx.duration ?? 10,
|
|
3949
3948
|
resolution: ctx.resolution ?? "720p",
|
|
3950
|
-
generate_audio: ctx.generateAudio ??
|
|
3949
|
+
generate_audio: ctx.generateAudio ?? true,
|
|
3951
3950
|
...ctx.returnLastFrame ? { return_last_frame: true } : {}
|
|
3952
3951
|
};
|
|
3953
3952
|
};
|
|
@@ -3965,7 +3964,7 @@ var buildSeedance20VideoEditPayloadFor = (modelAlias) => (ctx) => ({
|
|
|
3965
3964
|
ratio: ctx.aspectRatio ?? "16:9",
|
|
3966
3965
|
duration: ctx.duration ?? 5,
|
|
3967
3966
|
resolution: ctx.resolution ?? "720p",
|
|
3968
|
-
generate_audio: ctx.generateAudio ??
|
|
3967
|
+
generate_audio: ctx.generateAudio ?? true,
|
|
3969
3968
|
...ctx.returnLastFrame ? { return_last_frame: true } : {}
|
|
3970
3969
|
});
|
|
3971
3970
|
var buildSeedance20VideoExtendPayloadFor = (modelAlias) => (ctx) => ({
|
|
@@ -3981,7 +3980,7 @@ var buildSeedance20VideoExtendPayloadFor = (modelAlias) => (ctx) => ({
|
|
|
3981
3980
|
ratio: ctx.aspectRatio ?? "adaptive",
|
|
3982
3981
|
duration: ctx.duration ?? 15,
|
|
3983
3982
|
resolution: ctx.resolution ?? "720p",
|
|
3984
|
-
generate_audio: ctx.generateAudio ??
|
|
3983
|
+
generate_audio: ctx.generateAudio ?? true
|
|
3985
3984
|
});
|
|
3986
3985
|
var SEEDANCE_25_FRAME_ADAPTIVE_REASON = "First/Last Frame mode requires an adaptive aspect ratio \u2014 the vendor rejects any fixed ratio.";
|
|
3987
3986
|
var seedance25Constraints = [
|
|
@@ -4036,7 +4035,7 @@ var buildSeedance25Payload = (ctx) => {
|
|
|
4036
4035
|
ratio: usesFrame ? "adaptive" : ctx.aspectRatio ?? "16:9",
|
|
4037
4036
|
duration: ctx.duration ?? 5,
|
|
4038
4037
|
resolution: ctx.resolution ?? "720p",
|
|
4039
|
-
generate_audio: ctx.generateAudio ??
|
|
4038
|
+
generate_audio: ctx.generateAudio ?? true,
|
|
4040
4039
|
output_format: ctx.outputFormat ?? "mp4",
|
|
4041
4040
|
...ctx.returnLastFrame ? { return_last_frame: true } : {}
|
|
4042
4041
|
};
|
|
@@ -4055,7 +4054,7 @@ var buildSeedance25VideoEditPayload = (ctx) => ({
|
|
|
4055
4054
|
ratio: "adaptive",
|
|
4056
4055
|
duration: -1,
|
|
4057
4056
|
resolution: ctx.resolution ?? "720p",
|
|
4058
|
-
generate_audio: ctx.generateAudio ??
|
|
4057
|
+
generate_audio: ctx.generateAudio ?? true,
|
|
4059
4058
|
output_format: ctx.outputFormat ?? "mp4",
|
|
4060
4059
|
...ctx.returnLastFrame ? { return_last_frame: true } : {}
|
|
4061
4060
|
});
|
|
@@ -4072,7 +4071,7 @@ var buildSeedance25VideoExtendPayload = (ctx) => ({
|
|
|
4072
4071
|
ratio: "adaptive",
|
|
4073
4072
|
duration: ctx.duration ?? 15,
|
|
4074
4073
|
resolution: ctx.resolution ?? "720p",
|
|
4075
|
-
generate_audio: ctx.generateAudio ??
|
|
4074
|
+
generate_audio: ctx.generateAudio ?? true,
|
|
4076
4075
|
output_format: ctx.outputFormat ?? "mp4"
|
|
4077
4076
|
});
|
|
4078
4077
|
var SEEDANCE_AR = ["16:9", "9:16", "1:1", "4:3", "3:4", "21:9", "adaptive"];
|
|
@@ -4098,7 +4097,7 @@ var { MODELS: MODELS12 } = defineModels("seedance", [
|
|
|
4098
4097
|
...params.aspectRatio(SEEDANCE_AR),
|
|
4099
4098
|
...params.resolution(["480p", "720p"], "720p"),
|
|
4100
4099
|
...params.duration(SEEDANCE_25_DURATIONS, 5),
|
|
4101
|
-
...params.generateAudio(
|
|
4100
|
+
...params.generateAudio(),
|
|
4102
4101
|
...params.returnLastFrame(),
|
|
4103
4102
|
...p.enum("outputFormat", ["mp4", "mov"], "mp4", { label: "Format" }),
|
|
4104
4103
|
// 2.5 lifts the reference caps to 30 images / 10 videos / 10 audios.
|
|
@@ -4128,7 +4127,7 @@ var { MODELS: MODELS12 } = defineModels("seedance", [
|
|
|
4128
4127
|
// source-driven ('-1'), so neither is user-selectable (vendor rule).
|
|
4129
4128
|
...params.aspectRatio(["adaptive"]),
|
|
4130
4129
|
...params.resolution(["480p", "720p"], "720p"),
|
|
4131
|
-
...params.generateAudio(
|
|
4130
|
+
...params.generateAudio(),
|
|
4132
4131
|
...params.returnLastFrame(),
|
|
4133
4132
|
...p.enum("outputFormat", ["mp4", "mov"], "mp4", { label: "Format" }),
|
|
4134
4133
|
...params.videoInput("Source Video"),
|
|
@@ -4155,7 +4154,7 @@ var { MODELS: MODELS12 } = defineModels("seedance", [
|
|
|
4155
4154
|
...params.aspectRatio(["adaptive"]),
|
|
4156
4155
|
...params.resolution(["480p", "720p"], "720p"),
|
|
4157
4156
|
...params.duration(SEEDANCE_25_DURATIONS, 15),
|
|
4158
|
-
...params.generateAudio(
|
|
4157
|
+
...params.generateAudio(),
|
|
4159
4158
|
...p.enum("outputFormat", ["mp4", "mov"], "mp4", { label: "Format" }),
|
|
4160
4159
|
...params.videoInputs(10, "Source Videos", true)
|
|
4161
4160
|
}
|
|
@@ -4179,7 +4178,7 @@ var { MODELS: MODELS12 } = defineModels("seedance", [
|
|
|
4179
4178
|
...params.aspectRatio(SEEDANCE_AR),
|
|
4180
4179
|
...params.resolution(["480p", "720p", "1080p", "4k"], "720p"),
|
|
4181
4180
|
...params.duration(SEEDANCE_V2_DURATIONS, 10),
|
|
4182
|
-
...params.generateAudio(
|
|
4181
|
+
...params.generateAudio(),
|
|
4183
4182
|
...params.returnLastFrame(),
|
|
4184
4183
|
// Reference roles map directly to backend `reference_*` content entries.
|
|
4185
4184
|
// start/end frame stay on their own named slots.
|
|
@@ -4209,7 +4208,7 @@ var { MODELS: MODELS12 } = defineModels("seedance", [
|
|
|
4209
4208
|
...params.aspectRatio(SEEDANCE_AR),
|
|
4210
4209
|
...params.resolution(["480p", "720p"], "720p"),
|
|
4211
4210
|
...params.duration(SEEDANCE_V2_DURATIONS, 10),
|
|
4212
|
-
...params.generateAudio(
|
|
4211
|
+
...params.generateAudio(),
|
|
4213
4212
|
...params.returnLastFrame(),
|
|
4214
4213
|
// Reference roles map directly to backend `reference_*` content entries.
|
|
4215
4214
|
// start/end frame stay on their own named slots.
|
|
@@ -4239,7 +4238,7 @@ var { MODELS: MODELS12 } = defineModels("seedance", [
|
|
|
4239
4238
|
...params.aspectRatio(SEEDANCE_AR),
|
|
4240
4239
|
...params.resolution(["480p", "720p"], "720p"),
|
|
4241
4240
|
...params.duration(SEEDANCE_V2_DURATIONS, 10),
|
|
4242
|
-
...params.generateAudio(
|
|
4241
|
+
...params.generateAudio(),
|
|
4243
4242
|
...params.returnLastFrame(),
|
|
4244
4243
|
// Reference roles map directly to backend `reference_*` content entries.
|
|
4245
4244
|
// start/end frame stay on their own named slots.
|
|
@@ -4268,7 +4267,7 @@ var { MODELS: MODELS12 } = defineModels("seedance", [
|
|
|
4268
4267
|
...params.aspectRatio(SEEDANCE_AR),
|
|
4269
4268
|
...params.resolution(["480p", "720p", "1080p", "4k"], "720p"),
|
|
4270
4269
|
...params.duration(SEEDANCE_V2_DURATIONS, 5),
|
|
4271
|
-
...params.generateAudio(
|
|
4270
|
+
...params.generateAudio(),
|
|
4272
4271
|
...params.returnLastFrame(),
|
|
4273
4272
|
...params.videoInput("Source Video"),
|
|
4274
4273
|
...params.imageInput(9, "Reference Images")
|
|
@@ -4292,7 +4291,7 @@ var { MODELS: MODELS12 } = defineModels("seedance", [
|
|
|
4292
4291
|
...params.aspectRatio(SEEDANCE_AR),
|
|
4293
4292
|
...params.resolution(["480p", "720p"], "720p"),
|
|
4294
4293
|
...params.duration(SEEDANCE_V2_DURATIONS, 5),
|
|
4295
|
-
...params.generateAudio(
|
|
4294
|
+
...params.generateAudio(),
|
|
4296
4295
|
...params.returnLastFrame(),
|
|
4297
4296
|
...params.videoInput("Source Video"),
|
|
4298
4297
|
...params.imageInput(9, "Reference Images")
|
|
@@ -4316,7 +4315,7 @@ var { MODELS: MODELS12 } = defineModels("seedance", [
|
|
|
4316
4315
|
...params.aspectRatio(SEEDANCE_AR),
|
|
4317
4316
|
...params.resolution(["480p", "720p"], "720p"),
|
|
4318
4317
|
...params.duration(SEEDANCE_V2_DURATIONS, 5),
|
|
4319
|
-
...params.generateAudio(
|
|
4318
|
+
...params.generateAudio(),
|
|
4320
4319
|
...params.returnLastFrame(),
|
|
4321
4320
|
...params.videoInput("Source Video"),
|
|
4322
4321
|
...params.imageInput(9, "Reference Images")
|
|
@@ -4340,7 +4339,7 @@ var { MODELS: MODELS12 } = defineModels("seedance", [
|
|
|
4340
4339
|
...params.aspectRatio(SEEDANCE_AR),
|
|
4341
4340
|
...params.resolution(["480p", "720p", "1080p", "4k"], "720p"),
|
|
4342
4341
|
...params.duration(SEEDANCE_V2_DURATIONS, 15),
|
|
4343
|
-
...params.generateAudio(
|
|
4342
|
+
...params.generateAudio(),
|
|
4344
4343
|
...params.videoInputs(3, "Source Videos", true)
|
|
4345
4344
|
}
|
|
4346
4345
|
},
|
|
@@ -4362,7 +4361,7 @@ var { MODELS: MODELS12 } = defineModels("seedance", [
|
|
|
4362
4361
|
...params.aspectRatio(SEEDANCE_AR),
|
|
4363
4362
|
...params.resolution(["480p", "720p"], "720p"),
|
|
4364
4363
|
...params.duration(SEEDANCE_V2_DURATIONS, 15),
|
|
4365
|
-
...params.generateAudio(
|
|
4364
|
+
...params.generateAudio(),
|
|
4366
4365
|
...params.videoInputs(3, "Source Videos", true)
|
|
4367
4366
|
}
|
|
4368
4367
|
},
|
|
@@ -4384,7 +4383,7 @@ var { MODELS: MODELS12 } = defineModels("seedance", [
|
|
|
4384
4383
|
...params.aspectRatio(SEEDANCE_AR),
|
|
4385
4384
|
...params.resolution(["480p", "720p"], "720p"),
|
|
4386
4385
|
...params.duration(SEEDANCE_V2_DURATIONS, 15),
|
|
4387
|
-
...params.generateAudio(
|
|
4386
|
+
...params.generateAudio(),
|
|
4388
4387
|
...params.videoInputs(3, "Source Videos", true)
|
|
4389
4388
|
}
|
|
4390
4389
|
},
|
|
@@ -10148,7 +10147,14 @@ function getCreditsForModel(modelId, ctx) {
|
|
|
10148
10147
|
if (e.credits > max) max = e.credits;
|
|
10149
10148
|
if (e.unit !== unit) unit = void 0;
|
|
10150
10149
|
}
|
|
10151
|
-
|
|
10150
|
+
const tiers = entries.map((e) => ({
|
|
10151
|
+
credits: e.credits,
|
|
10152
|
+
unit: e.unit,
|
|
10153
|
+
quality: e.metadata.quality || void 0,
|
|
10154
|
+
audio: e.metadata.audio,
|
|
10155
|
+
useCase: e.metadata.useCase
|
|
10156
|
+
}));
|
|
10157
|
+
return unit ? { min, max, unit, tiers } : { min, max, tiers };
|
|
10152
10158
|
}
|
|
10153
10159
|
|
|
10154
10160
|
// src/core/descriptors/model-accessor.ts
|
|
@@ -10379,6 +10385,7 @@ var ModelMetaImpl = class {
|
|
|
10379
10385
|
features;
|
|
10380
10386
|
badges;
|
|
10381
10387
|
provider;
|
|
10388
|
+
addedAt;
|
|
10382
10389
|
release;
|
|
10383
10390
|
constructor(def) {
|
|
10384
10391
|
this.mode = def.mode;
|
|
@@ -10393,6 +10400,7 @@ var ModelMetaImpl = class {
|
|
|
10393
10400
|
color: def.providerColor,
|
|
10394
10401
|
label: def.providerLabel
|
|
10395
10402
|
};
|
|
10403
|
+
this.addedAt = def.addedAt ?? null;
|
|
10396
10404
|
}
|
|
10397
10405
|
};
|
|
10398
10406
|
var ModelDescriptorImpl = class {
|