@picsart/ai-sdk 4.0.0 → 4.1.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.
Files changed (3) hide show
  1. package/index.d.ts +25 -5
  2. package/index.js +10 -2
  3. 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. Pass context to narrow by
1850
- * resolution/audio. Returns the per-unit range — callers with time-based
1851
- * parameters should scale by the value themselves (e.g. multiply by
1852
- * duration when range.unit === 'second'). Returns null if pricing is not loaded. */
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.",
@@ -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
- return unit ? { min, max, unit } : { min, max };
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 {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@picsart/ai-sdk",
3
- "version": "4.0.0",
3
+ "version": "4.1.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",