@picsart/ai-sdk 3.17.5 → 3.18.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 +9 -7
- package/index.d.ts +48 -3
- package/index.js +21 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
# @picsart/ai-sdk
|
|
2
2
|
|
|
3
|
-
Generate images,
|
|
3
|
+
Generate images, video, audio, and text with 100+ AI models.
|
|
4
4
|
|
|
5
5
|
## Documentation
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Full guides, the model catalog, and the API reference live on the Picsart API Platform:
|
|
8
8
|
|
|
9
|
-
- [
|
|
10
|
-
- [
|
|
9
|
+
- [Documentation](https://picsart.com/api-platform/docs) -- overview and guides
|
|
10
|
+
- [Quickstart](https://picsart.com/api-platform/docs/quickstart) -- install, authenticate, first generation
|
|
11
|
+
- [SDK guide](https://picsart.com/api-platform/docs/sdk) -- client setup, `generate`/`generateText`, Drive, lifecycle
|
|
12
|
+
- [Authentication](https://picsart.com/api-platform/docs/authentication) -- create an API key
|
|
13
|
+
- [Model catalog](https://picsart.com/api-platform/models) -- browse every supported model
|
|
14
|
+
- [API reference](https://picsart.com/api-platform/docs/api-reference)
|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
Repository: [gitlab.com/picsart/backend/Editor/external-ai-integrations/pa-gen-ai-sdk](https://gitlab.com/picsart/backend/Editor/external-ai-integrations/pa-gen-ai-sdk)
|
|
16
|
+
Repository: [github.com/PicsArt/ai-sdk](https://github.com/PicsArt/ai-sdk)
|
|
15
17
|
|
|
16
18
|
## Quick Start
|
|
17
19
|
|
package/index.d.ts
CHANGED
|
@@ -1798,6 +1798,8 @@ interface ModelMeta {
|
|
|
1798
1798
|
readonly features: ModelFeature[];
|
|
1799
1799
|
readonly badges: BadgeType[];
|
|
1800
1800
|
readonly provider: ProviderInfo;
|
|
1801
|
+
/** Release / availability tier (EAI-3). Absent on the definition ⇒ `'production'`. */
|
|
1802
|
+
readonly release: ReleaseTag;
|
|
1801
1803
|
}
|
|
1802
1804
|
/** Parameter operations — fluent access to model params, schemas, defaults. */
|
|
1803
1805
|
interface ModelParamsAccessor {
|
|
@@ -1870,6 +1872,14 @@ interface ModelDescriptor {
|
|
|
1870
1872
|
interface ModelFilter$1 {
|
|
1871
1873
|
output?: GenerationMode;
|
|
1872
1874
|
provider?: string;
|
|
1875
|
+
/**
|
|
1876
|
+
* Release tiers to include. Omitted ⇒ the default visible set
|
|
1877
|
+
* (`['production', 'general-availability']`). List the tiers you want
|
|
1878
|
+
* explicitly to opt into `preview` — e.g. `['preview']` for stage-only
|
|
1879
|
+
* models, or all three to include everything. `disabled`/`deprecated`
|
|
1880
|
+
* models stay hidden regardless.
|
|
1881
|
+
*/
|
|
1882
|
+
release?: ReleaseTag[];
|
|
1873
1883
|
}
|
|
1874
1884
|
|
|
1875
1885
|
type AppProvider = 'picsart' | 'google' | 'kling' | 'grok' | 'openai' | 'flux' | 'ideogram' | 'elevenlabs' | 'minimax' | 'wan' | 'seedance' | 'ltx' | 'seedream' | 'hunyuan' | 'pika' | 'runway' | 'luma' | 'ovi' | 'creatify' | 'veed' | 'bytedance' | 'qwen' | 'reve' | 'recraft' | 'videography' | 'topaz' | 'heygen' | 'happyhorse' | 'pixverse' | 'anthropic' | 'async';
|
|
@@ -2007,6 +2017,12 @@ interface Constraint {
|
|
|
2007
2017
|
then: Record<string, Restriction>;
|
|
2008
2018
|
}
|
|
2009
2019
|
type BadgeType = 'new' | 'popular' | 'coming-soon' | 'fast' | 'premium' | 'hot';
|
|
2020
|
+
/**
|
|
2021
|
+
* Model release / availability tier. See `ModelDefinition.release`.
|
|
2022
|
+
* Ordered widest-exposure-last: `preview` (stage only) → `production` (our
|
|
2023
|
+
* apps) → `general-availability` (enterprise / external use).
|
|
2024
|
+
*/
|
|
2025
|
+
type ReleaseTag = 'preview' | 'production' | 'general-availability';
|
|
2010
2026
|
interface ModelDefinition {
|
|
2011
2027
|
id: string;
|
|
2012
2028
|
name: string;
|
|
@@ -2038,6 +2054,7 @@ interface ModelDefinition {
|
|
|
2038
2054
|
* from default catalog lookups, same as `disabled`.
|
|
2039
2055
|
*/
|
|
2040
2056
|
deprecated?: boolean;
|
|
2057
|
+
release?: ReleaseTag;
|
|
2041
2058
|
mode: GenerationMode;
|
|
2042
2059
|
inputType: InputType;
|
|
2043
2060
|
modelId?: string;
|
|
@@ -2321,9 +2338,13 @@ declare function isPricingLoaded(): boolean;
|
|
|
2321
2338
|
|
|
2322
2339
|
/** Look up a single model descriptor by id. */
|
|
2323
2340
|
type ModelFunction = (id: string) => ModelDescriptor;
|
|
2324
|
-
declare function _all(
|
|
2341
|
+
declare function _all(filter?: {
|
|
2342
|
+
release?: readonly ReleaseTag[];
|
|
2343
|
+
}): ModelDescriptor[];
|
|
2325
2344
|
declare function _find(filter: ModelFilter$1): ModelDescriptor[];
|
|
2326
|
-
declare function _search(query: string
|
|
2345
|
+
declare function _search(query: string, filter?: {
|
|
2346
|
+
release?: readonly ReleaseTag[];
|
|
2347
|
+
}): ModelDescriptor[];
|
|
2327
2348
|
/** Look up a single model descriptor: `Model('flux-2-pro').params()`. */
|
|
2328
2349
|
declare const Model: ModelFunction;
|
|
2329
2350
|
/**
|
|
@@ -2367,8 +2388,32 @@ declare function decodeDeepLinkPayload(encoded: string): DeepLinkResult | null;
|
|
|
2367
2388
|
|
|
2368
2389
|
/** All models from all vendors. */
|
|
2369
2390
|
declare const ALL_MODELS: ModelDefinition[];
|
|
2391
|
+
/**
|
|
2392
|
+
* Models for a generation mode. By default returns only default-visible models
|
|
2393
|
+
* (production / general-availability — preview, disabled and deprecated are
|
|
2394
|
+
* hidden). `includeDisabled = true` returns every model of the mode, bypassing
|
|
2395
|
+
* all gates. For release-tier filtering use `catalog.find({ output, release })`.
|
|
2396
|
+
*/
|
|
2370
2397
|
declare const getModelsByMode: (mode: ModelDefinition["mode"], includeDisabled?: boolean) => ModelDefinition[];
|
|
2371
2398
|
|
|
2399
|
+
/**
|
|
2400
|
+
* Release tags shown by default in discovery. `preview` is stage-only and
|
|
2401
|
+
* opt-in (pass `release: ['preview', ...]`) — it is never in the default set.
|
|
2402
|
+
*/
|
|
2403
|
+
declare const DEFAULT_VISIBLE_RELEASES: readonly ReleaseTag[];
|
|
2404
|
+
/** Effective release tag of a model — absent ⇒ `'production'`. */
|
|
2405
|
+
declare const releaseOf: (m: ModelDefinition) => ReleaseTag;
|
|
2406
|
+
/**
|
|
2407
|
+
* Whether `m` is visible for the requested `releases` (default: the production
|
|
2408
|
+
* + general-availability set).
|
|
2409
|
+
*
|
|
2410
|
+
* `disabled` and `deprecated` are hard hides layered on top of `release`: a
|
|
2411
|
+
* model carrying either is never visible, regardless of its release tag or the
|
|
2412
|
+
* requested set. (`disabled` is being phased out in favour of
|
|
2413
|
+
* `release: 'preview'` — EAI-3 — but is still honoured during the migration.)
|
|
2414
|
+
*/
|
|
2415
|
+
declare function isVisibleForReleases(m: ModelDefinition, releases?: readonly ReleaseTag[]): boolean;
|
|
2416
|
+
|
|
2372
2417
|
/** Look up a model by its ID or vendor modelId. */
|
|
2373
2418
|
declare const getModel: (id: string) => ModelDefinition | undefined;
|
|
2374
2419
|
/** Find a model by ID, workflow name, or display name (case-insensitive). */
|
|
@@ -2377,4 +2422,4 @@ declare const findModel: (ref: string) => ModelDefinition | undefined;
|
|
|
2377
2422
|
/** Effect scenes that require two input images (e.g. hugs, kisses, swaps). */
|
|
2378
2423
|
declare const KLING_DUAL_IMAGE_EFFECTS: ReadonlySet<string>;
|
|
2379
2424
|
|
|
2380
|
-
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 ClientConfig, type CreditRange, type CreditRangeContext, 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 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, parseGeneration };
|
|
2425
|
+
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 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 };
|
package/index.js
CHANGED
|
@@ -639,6 +639,14 @@ function transferValues(newParams, prev) {
|
|
|
639
639
|
return ctx;
|
|
640
640
|
}
|
|
641
641
|
|
|
642
|
+
// src/core/visibility.ts
|
|
643
|
+
var DEFAULT_VISIBLE_RELEASES = ["production", "general-availability"];
|
|
644
|
+
var releaseOf = (m) => m.release ?? "production";
|
|
645
|
+
function isVisibleForReleases(m, releases = DEFAULT_VISIBLE_RELEASES) {
|
|
646
|
+
if (m.disabled || m.deprecated) return false;
|
|
647
|
+
return releases.includes(releaseOf(m));
|
|
648
|
+
}
|
|
649
|
+
|
|
642
650
|
// src/core/providers.ts
|
|
643
651
|
var providers = {
|
|
644
652
|
picsart: { color: "#FF3399", label: "PA", name: "Picsart" },
|
|
@@ -1028,6 +1036,7 @@ function defineModels(provider, configs) {
|
|
|
1028
1036
|
if (c.addedAt !== void 0) model.addedAt = c.addedAt;
|
|
1029
1037
|
if (c.disabled !== void 0) model.disabled = c.disabled;
|
|
1030
1038
|
if (c.deprecated !== void 0) model.deprecated = c.deprecated;
|
|
1039
|
+
if (c.release !== void 0) model.release = c.release;
|
|
1031
1040
|
if (c.modelId !== void 0) model.modelId = c.modelId;
|
|
1032
1041
|
if (c.constraints !== void 0) model.constraints = c.constraints;
|
|
1033
1042
|
const contract = createModelContract(model);
|
|
@@ -7826,7 +7835,7 @@ var ALL_MODELS = [
|
|
|
7826
7835
|
...MODELS35,
|
|
7827
7836
|
...MODELS36
|
|
7828
7837
|
];
|
|
7829
|
-
var getModelsByMode = (mode, includeDisabled = false) => ALL_MODELS.filter((m) => m.mode === mode && (includeDisabled ||
|
|
7838
|
+
var getModelsByMode = (mode, includeDisabled = false) => ALL_MODELS.filter((m) => m.mode === mode && (includeDisabled || isVisibleForReleases(m)));
|
|
7830
7839
|
|
|
7831
7840
|
// src/core/contracts.ts
|
|
7832
7841
|
function requireObject(value, message) {
|
|
@@ -9617,12 +9626,14 @@ var ModelMetaImpl = class {
|
|
|
9617
9626
|
features;
|
|
9618
9627
|
badges;
|
|
9619
9628
|
provider;
|
|
9629
|
+
release;
|
|
9620
9630
|
constructor(def) {
|
|
9621
9631
|
this.mode = def.mode;
|
|
9622
9632
|
this.inputType = def.inputType;
|
|
9623
9633
|
this.description = def.description;
|
|
9624
9634
|
this.features = def.features;
|
|
9625
9635
|
this.badges = def.badge ?? [];
|
|
9636
|
+
this.release = def.release ?? "production";
|
|
9626
9637
|
this.provider = {
|
|
9627
9638
|
id: def.provider,
|
|
9628
9639
|
name: def.providerName,
|
|
@@ -9678,21 +9689,24 @@ var ModelDescriptorImpl = class {
|
|
|
9678
9689
|
function _model(id) {
|
|
9679
9690
|
return new ModelDescriptorImpl(resolveModel(id));
|
|
9680
9691
|
}
|
|
9681
|
-
function _all() {
|
|
9682
|
-
|
|
9692
|
+
function _all(filter = {}) {
|
|
9693
|
+
const releases = filter.release ?? DEFAULT_VISIBLE_RELEASES;
|
|
9694
|
+
return ALL_MODELS.filter((m) => isVisibleForReleases(m, releases)).map((m) => new ModelDescriptorImpl(m));
|
|
9683
9695
|
}
|
|
9684
9696
|
function _find(filter) {
|
|
9697
|
+
const releases = filter.release ?? DEFAULT_VISIBLE_RELEASES;
|
|
9685
9698
|
return ALL_MODELS.filter((m) => {
|
|
9686
|
-
if (m
|
|
9699
|
+
if (!isVisibleForReleases(m, releases)) return false;
|
|
9687
9700
|
if (filter.output && m.mode !== filter.output) return false;
|
|
9688
9701
|
if (filter.provider && m.provider !== filter.provider) return false;
|
|
9689
9702
|
return true;
|
|
9690
9703
|
}).map((m) => new ModelDescriptorImpl(m));
|
|
9691
9704
|
}
|
|
9692
|
-
function _search(query) {
|
|
9705
|
+
function _search(query, filter = {}) {
|
|
9706
|
+
const releases = filter.release ?? DEFAULT_VISIBLE_RELEASES;
|
|
9693
9707
|
const q = query.toLowerCase();
|
|
9694
9708
|
return ALL_MODELS.filter(
|
|
9695
|
-
(m) =>
|
|
9709
|
+
(m) => isVisibleForReleases(m, releases) && (m.id.toLowerCase().includes(q) || m.name.toLowerCase().includes(q) || m.provider.toLowerCase().includes(q))
|
|
9696
9710
|
).map((m) => new ModelDescriptorImpl(m));
|
|
9697
9711
|
}
|
|
9698
9712
|
var Model = _model;
|
|
@@ -10314,4 +10328,4 @@ function decodeDeepLinkPayload(encoded) {
|
|
|
10314
10328
|
return deserializePayload(encoded);
|
|
10315
10329
|
}
|
|
10316
10330
|
|
|
10317
|
-
export { ALL_MODELS, ExecutionMode as ApiRunMode, KLING_DUAL_IMAGE_EFFECTS, Model, Models, buildFilename, buildGenerationAttributes, catalog, createClient, decodeDeepLinkPayload, encodeDeepLinkPayload, findModel, getModel, getModelsByMode, getVoiceById, inferResourceType, parseGeneration };
|
|
10331
|
+
export { ALL_MODELS, ExecutionMode as ApiRunMode, DEFAULT_VISIBLE_RELEASES, KLING_DUAL_IMAGE_EFFECTS, Model, Models, buildFilename, buildGenerationAttributes, catalog, createClient, decodeDeepLinkPayload, encodeDeepLinkPayload, findModel, getModel, getModelsByMode, getVoiceById, inferResourceType, isVisibleForReleases, parseGeneration, releaseOf };
|