@picsart/ai-sdk 6.32.0 → 6.34.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/_vendor/workflows-types/index.d.ts +2446 -2278
- package/index.d.ts +143 -3
- package/index.js +3597 -3134
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1622,6 +1622,13 @@ type ModelInputById = {
|
|
|
1622
1622
|
aspectRatio?: "16:9" | "9:16";
|
|
1623
1623
|
imageUrls?: string[];
|
|
1624
1624
|
};
|
|
1625
|
+
"sam-3-video": {
|
|
1626
|
+
prompt: string;
|
|
1627
|
+
videoUrl: string;
|
|
1628
|
+
detectionThreshold?: number;
|
|
1629
|
+
applyMask?: boolean;
|
|
1630
|
+
outputFormat?: "mp4" | "webm";
|
|
1631
|
+
};
|
|
1625
1632
|
"seed-audio-1.0": {
|
|
1626
1633
|
prompt: string;
|
|
1627
1634
|
voiceId?: string;
|
|
@@ -2911,7 +2918,8 @@ interface FilenameHints {
|
|
|
2911
2918
|
/**
|
|
2912
2919
|
* Pick a file extension for a generation. Most to least reliable: the result's
|
|
2913
2920
|
* MIME type, the result URL's path extension, the requested output format, then
|
|
2914
|
-
* the mode default (png / mp4 / mp3).
|
|
2921
|
+
* the mode default (png / mp4 / mp3). An unknown mode resolves to '' — the
|
|
2922
|
+
* filename stays extension-less rather than mislabeled.
|
|
2915
2923
|
*/
|
|
2916
2924
|
declare function resolveExtension(mode: string, hints?: FilenameHints): string;
|
|
2917
2925
|
/**
|
|
@@ -3056,6 +3064,20 @@ declare class ApiError extends Error {
|
|
|
3056
3064
|
constructor(message: string, init: ApiErrorInit);
|
|
3057
3065
|
}
|
|
3058
3066
|
|
|
3067
|
+
/** Catalog query filters — map 1:1 onto `/v1/models-catalog` query params. */
|
|
3068
|
+
interface ModelCatalogFilters {
|
|
3069
|
+
/** Restrict to one or more generation modes (`video`, `image`, …). */
|
|
3070
|
+
mode?: GenerationMode | GenerationMode[];
|
|
3071
|
+
/** Restrict to one or more provider ids. */
|
|
3072
|
+
provider?: string | string[];
|
|
3073
|
+
/** Release tiers to request. Server default: production + general-availability. */
|
|
3074
|
+
release?: ReleaseTag | ReleaseTag[];
|
|
3075
|
+
/** Include models flagged deprecated. */
|
|
3076
|
+
includeDeprecated?: boolean;
|
|
3077
|
+
/** Free-text search across id / name / provider. */
|
|
3078
|
+
search?: string;
|
|
3079
|
+
}
|
|
3080
|
+
|
|
3059
3081
|
/** Worker-reported progress on a generation.progress event. */
|
|
3060
3082
|
type GenerationProgress = WorkflowProgress;
|
|
3061
3083
|
/** A fetch-like function that handles authentication (headers, cookies, etc.). */
|
|
@@ -3079,8 +3101,34 @@ interface AppIdentity {
|
|
|
3079
3101
|
id: string;
|
|
3080
3102
|
type: AppType;
|
|
3081
3103
|
}
|
|
3104
|
+
/**
|
|
3105
|
+
* How the client sources its model catalog and builds generation requests.
|
|
3106
|
+
* - `'static'` (default) — the bundled catalog: per-model workflows and local
|
|
3107
|
+
* payload builders, exactly as before.
|
|
3108
|
+
* - `'dynamic'` — generation routes through the models-hub `v1/models`
|
|
3109
|
+
* workflow (the server builds the vendor payload), and the model catalog is
|
|
3110
|
+
* loaded from the backend via {@link AiClient.initModelCatalog}. Until that
|
|
3111
|
+
* load completes, the sync accessors (`Model()`, `catalog.*`) throw
|
|
3112
|
+
* `ApiError` 409 `catalog_not_loaded`; `generate()`/`submit()` never wait.
|
|
3113
|
+
*
|
|
3114
|
+
* The loaded catalog is process-global (`Model()` and `catalog.*` are
|
|
3115
|
+
* module-level): one catalog source per process, last install wins.
|
|
3116
|
+
*
|
|
3117
|
+
* **One catalog MODE per process, too — do not mix static and dynamic
|
|
3118
|
+
* clients.** Creating a dynamic client flips the process-global catalog:
|
|
3119
|
+
* a static client in the same process then throws `catalog_not_loaded` from
|
|
3120
|
+
* its sync accessors until the load lands, and once the loaded catalog is
|
|
3121
|
+
* installed its generation pipeline would resolve definitions that carry no
|
|
3122
|
+
* payload builders (builders are code and never ride the wire) — producing
|
|
3123
|
+
* invalid vendor payloads. Run static clients in a separate process. Static
|
|
3124
|
+
* mode is the compatibility path and is slated for removal once all
|
|
3125
|
+
* consumers run dynamic.
|
|
3126
|
+
*/
|
|
3127
|
+
type SdkMode = 'static' | 'dynamic';
|
|
3082
3128
|
/** Settings that apply whichever transport serves the client. */
|
|
3083
3129
|
interface ClientConfigBase {
|
|
3130
|
+
/** Catalog/generation mode — see {@link SdkMode}. Default: `'static'`. */
|
|
3131
|
+
mode?: SdkMode;
|
|
3084
3132
|
/** Enable Drive integration — auto-save generations to a Drive folder. */
|
|
3085
3133
|
drive?: DriveConfig;
|
|
3086
3134
|
/**
|
|
@@ -3274,6 +3322,13 @@ interface GenerateOptions {
|
|
|
3274
3322
|
*/
|
|
3275
3323
|
app?: AppIdentity;
|
|
3276
3324
|
}
|
|
3325
|
+
|
|
3326
|
+
/** Options for {@link AiClient.initModelCatalog}. The endpoint is always
|
|
3327
|
+
* `${apiUrl}/gw-v2/v1/models-catalog` — derived from the client's `apiUrl`. */
|
|
3328
|
+
interface InitModelCatalogOptions {
|
|
3329
|
+
/** Restrict what the catalog load requests — mode, provider, release, deprecated, search. */
|
|
3330
|
+
filtersOptions?: ModelCatalogFilters;
|
|
3331
|
+
}
|
|
3277
3332
|
/** Non-text (image/video/audio) model IDs — the media generation surface. */
|
|
3278
3333
|
type MediaModelId = Exclude<TypedModelId, TextModelId | JsonModelId>;
|
|
3279
3334
|
/** AI SDK client with type-safe, model-aware method signatures. */
|
|
@@ -3308,8 +3363,27 @@ interface AiClient {
|
|
|
3308
3363
|
* exceptions.
|
|
3309
3364
|
*/
|
|
3310
3365
|
subscribe(model: MediaModelId, generationId: string, options?: GenerationOptions): AsyncGenerator<GenerationEvent, void, void>;
|
|
3311
|
-
/** Build the vendor-specific payload for a model without submitting. */
|
|
3366
|
+
/** Build the vendor-specific payload for a model without submitting. Static mode only. */
|
|
3312
3367
|
buildPayload<M extends TypedModelId>(model: M, params: ModelInputById[M]): Record<string, unknown>;
|
|
3368
|
+
/**
|
|
3369
|
+
* Dynamic mode only: fetch the model catalog from models-hub and install it
|
|
3370
|
+
* as the active catalog — afterwards `Model()`, `catalog.*` and
|
|
3371
|
+
* `ai.validate()` serve the loaded data. The ONLY trigger for the load
|
|
3372
|
+
* (`createClient` never starts it). Idempotent: concurrent/repeat calls
|
|
3373
|
+
* share one in-flight load; a failed load may be retried. Rejects with
|
|
3374
|
+
* `ApiError` 400 `invalid_mode` on a static client, and 409
|
|
3375
|
+
* `catalog_conflict` when a different url/filters catalog is already loaded
|
|
3376
|
+
* in this process.
|
|
3377
|
+
*/
|
|
3378
|
+
initModelCatalog(options?: InitModelCatalogOptions): Promise<void>;
|
|
3379
|
+
/**
|
|
3380
|
+
* Validate params against the model's descriptors without generating.
|
|
3381
|
+
* Static mode: resolves immediately off the bundled catalog. Dynamic mode:
|
|
3382
|
+
* awaits the catalog load started by {@link initModelCatalog} — rejects
|
|
3383
|
+
* with `ApiError` 409 `catalog_not_loaded` when it was never called.
|
|
3384
|
+
* Unknown models reject with `ApiError` 400 `unknown_model`.
|
|
3385
|
+
*/
|
|
3386
|
+
validate(model: string, params: Record<string, unknown>): Promise<ValidationResult>;
|
|
3313
3387
|
/**
|
|
3314
3388
|
* Direct, low-level access to the Picsart model APIs — run any API by name.
|
|
3315
3389
|
* See {@link ApisClient}.
|
|
@@ -3324,6 +3398,23 @@ interface AiClient {
|
|
|
3324
3398
|
drive: DriveClient | undefined;
|
|
3325
3399
|
}
|
|
3326
3400
|
|
|
3401
|
+
/** Platform options carried on a {@link ModelsCommand} (ModelsGenAIOptions on the backend). */
|
|
3402
|
+
interface ModelsGenAIOptions {
|
|
3403
|
+
safety_checks?: {
|
|
3404
|
+
enabled?: boolean;
|
|
3405
|
+
};
|
|
3406
|
+
drive?: PayloadDriveOptions;
|
|
3407
|
+
inputs_transformation?: {
|
|
3408
|
+
downscale_oversized_images?: boolean;
|
|
3409
|
+
};
|
|
3410
|
+
}
|
|
3411
|
+
/** The `v1/models` request body: which model, the SDK-shaped params, platform options. */
|
|
3412
|
+
interface ModelsCommand {
|
|
3413
|
+
model: string;
|
|
3414
|
+
params: Record<string, unknown>;
|
|
3415
|
+
options?: ModelsGenAIOptions;
|
|
3416
|
+
}
|
|
3417
|
+
|
|
3327
3418
|
/**
|
|
3328
3419
|
* Create an AI SDK client.
|
|
3329
3420
|
*
|
|
@@ -3563,6 +3654,7 @@ declare const Models: {
|
|
|
3563
3654
|
readonly RunwayGen4Aleph: "runway-gen4-aleph";
|
|
3564
3655
|
readonly RunwayGen4Ref: "runway-gen4-ref";
|
|
3565
3656
|
readonly RunwayGen45: "runway-gen4.5";
|
|
3657
|
+
readonly Sam3Video: "sam-3-video";
|
|
3566
3658
|
readonly SeedAudio10: "seed-audio-1.0";
|
|
3567
3659
|
readonly SeedAudio10Multilingual: "seed-audio-1.0-multilingual";
|
|
3568
3660
|
readonly Seedance15Pro: "seedance-1.5-pro";
|
|
@@ -3618,6 +3710,54 @@ declare const Models: {
|
|
|
3618
3710
|
|
|
3619
3711
|
declare function getVoiceById(id: string): VoiceOption | undefined;
|
|
3620
3712
|
|
|
3713
|
+
/** Nested provider block — flattened onto `ModelDefinition.provider*`. */
|
|
3714
|
+
interface CatalogProvider {
|
|
3715
|
+
id: string;
|
|
3716
|
+
name: string;
|
|
3717
|
+
color: string;
|
|
3718
|
+
label: string;
|
|
3719
|
+
}
|
|
3720
|
+
/**
|
|
3721
|
+
* A param as served on the wire: the SDK's flat entry form (descriptor
|
|
3722
|
+
* fields merged with `label` / `required` / `category`), keyed by param
|
|
3723
|
+
* name instead of carrying `key`.
|
|
3724
|
+
*/
|
|
3725
|
+
type CatalogParam = {
|
|
3726
|
+
label?: string;
|
|
3727
|
+
required?: boolean;
|
|
3728
|
+
category?: 'asset' | 'reference';
|
|
3729
|
+
} & ParamDescriptor;
|
|
3730
|
+
interface CatalogModel {
|
|
3731
|
+
id: string;
|
|
3732
|
+
name: string;
|
|
3733
|
+
description?: string;
|
|
3734
|
+
mode: GenerationMode;
|
|
3735
|
+
inputType: InputType;
|
|
3736
|
+
provider: CatalogProvider;
|
|
3737
|
+
badges?: BadgeType[];
|
|
3738
|
+
features?: ModelFeature[];
|
|
3739
|
+
release?: ReleaseTag;
|
|
3740
|
+
addedAt?: string;
|
|
3741
|
+
estimatedTime?: number | Record<string, number>;
|
|
3742
|
+
deprecated?: boolean;
|
|
3743
|
+
/** `include=schema` */
|
|
3744
|
+
params?: Record<string, CatalogParam>;
|
|
3745
|
+
/** `include=constraints` */
|
|
3746
|
+
constraints?: Constraint[];
|
|
3747
|
+
/** `include=routing` */
|
|
3748
|
+
workflow?: string;
|
|
3749
|
+
editWorkflow?: string;
|
|
3750
|
+
modelId?: string;
|
|
3751
|
+
syncExecute?: boolean;
|
|
3752
|
+
}
|
|
3753
|
+
interface CatalogModelsResponse {
|
|
3754
|
+
status: 'success';
|
|
3755
|
+
response: {
|
|
3756
|
+
total: number;
|
|
3757
|
+
models: CatalogModel[];
|
|
3758
|
+
};
|
|
3759
|
+
}
|
|
3760
|
+
|
|
3621
3761
|
/**
|
|
3622
3762
|
* Pricing internals — owns the ModelPricingClient, the per-model cache, and
|
|
3623
3763
|
* the credit-range lookup. The Model accessor delegates to the helpers below
|
|
@@ -3750,4 +3890,4 @@ declare const getModel: (id: string) => ModelDefinition | undefined;
|
|
|
3750
3890
|
*/
|
|
3751
3891
|
declare const findModel: (ref: string) => ModelDefinition | undefined;
|
|
3752
3892
|
|
|
3753
|
-
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 JsonModelId, 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 OptionsResult, type ParamDescriptor, type ParamEntry, type ParamOption, type PayloadDriveFolderOptions, type PayloadDriveOptions, type PayloadInputsTransformationOptions, type PricingOptions, type ProviderInfo, type RangeDescriptor, type RangeEntry, type ReleaseTag, type RunResponse, 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 UnknownDescriptor, type UnknownEntry, 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 };
|
|
3893
|
+
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 CatalogModel, type CatalogModelsResponse, type CatalogPage, type CatalogPageOptions, type CatalogParam, type CatalogPreview, type CatalogProvider, 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 InitModelCatalogOptions, type JsonModelId, type ListOptions, type MediaModelId, type MediaTypeFilter, Model, type ModelCatalogFilters, type ModelDefinition, type ModelDescriptor, type ModelFilter, type ModelInput, type ModelInputById, type ModelMeta, type ModelParams, type ModelParamsAccessor, Models, type ModelsCommand, type ModelsGenAIOptions, type ObjectDescriptor, type ObjectEntry, type OptionsResult, type ParamDescriptor, type ParamEntry, type ParamOption, type PayloadDriveFolderOptions, type PayloadDriveOptions, type PayloadInputsTransformationOptions, type PricingOptions, type ProviderInfo, type RangeDescriptor, type RangeEntry, type ReleaseTag, type RunResponse, type SaveParams, type SdkMode, type SdkPayload, type SdkTransport, type SeedanceDraftTask, type TextDescriptor, type TextEntry, type TextModelId, type TextModelInputById, type ToolUsage, type TransportPollOptions, type TransportResult, type TypedModelId, type UnknownDescriptor, type UnknownEntry, 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 };
|