@picsart/ai-sdk 1.139.0 → 1.140.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/_cli.js CHANGED
@@ -6270,11 +6270,19 @@ function createClient(config) {
6270
6270
  const completed = await executeModel(resolved, workflow, finalPayload, options?.signal);
6271
6271
  return parseResult(completed, resolved, contract);
6272
6272
  },
6273
+ /** @deprecated Use `getCredits()` instead. */
6274
+ async estimate(model, params2) {
6275
+ if (!transport.options) return null;
6276
+ const resolved = resolveModel(model);
6277
+ const { workflow, payload } = prepareRequest(resolved, params2);
6278
+ return await transport.options(workflow, payload) ?? null;
6279
+ },
6273
6280
  /**
6274
- * Estimate credit cost for a generation.
6281
+ * Get exact credit cost for a model with specific parameters.
6282
+ * Calls the backend /options endpoint for real-time pricing.
6275
6283
  * Returns null if pricing is unavailable.
6276
6284
  */
6277
- async estimate(model, params2) {
6285
+ async getCredits(model, params2) {
6278
6286
  if (!transport.options) return null;
6279
6287
  const resolved = resolveModel(model);
6280
6288
  const { workflow, payload } = prepareRequest(resolved, params2);
package/index.d.ts CHANGED
@@ -940,8 +940,10 @@ interface GenerateOptions {
940
940
  interface AiClient {
941
941
  /** Generate content using a model. Params are type-checked against the model's schema. */
942
942
  generate<M extends TypedModelId>(model: M, params: ModelInputById[M], options?: GenerateOptions): Promise<GenerateResult>;
943
- /** Estimate credit cost for a generation. */
943
+ /** @deprecated Use `getCredits()` instead. */
944
944
  estimate<M extends TypedModelId>(model: M, params: ModelInputById[M]): Promise<number | null>;
945
+ /** Get exact credit cost for a model with specific parameters. */
946
+ getCredits<M extends TypedModelId>(model: M, params: ModelInputById[M]): Promise<number | null>;
945
947
  /** Submit a generation job and get a handle back. */
946
948
  submit<M extends TypedModelId>(model: M, params: ModelInputById[M], options?: GenerateOptions): Promise<WorkflowJobHandle>;
947
949
  /** Check the current status of a submitted job. */
package/index.js CHANGED
@@ -5545,11 +5545,19 @@ function createClient(config) {
5545
5545
  const completed = await executeModel(resolved, workflow, finalPayload, options?.signal);
5546
5546
  return parseResult(completed, resolved, contract);
5547
5547
  },
5548
+ /** @deprecated Use `getCredits()` instead. */
5549
+ async estimate(model, params2) {
5550
+ if (!transport.options) return null;
5551
+ const resolved = resolveModel(model);
5552
+ const { workflow, payload } = prepareRequest(resolved, params2);
5553
+ return await transport.options(workflow, payload) ?? null;
5554
+ },
5548
5555
  /**
5549
- * Estimate credit cost for a generation.
5556
+ * Get exact credit cost for a model with specific parameters.
5557
+ * Calls the backend /options endpoint for real-time pricing.
5550
5558
  * Returns null if pricing is unavailable.
5551
5559
  */
5552
- async estimate(model, params2) {
5560
+ async getCredits(model, params2) {
5553
5561
  if (!transport.options) return null;
5554
5562
  const resolved = resolveModel(model);
5555
5563
  const { workflow, payload } = prepareRequest(resolved, params2);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@picsart/ai-sdk",
3
- "version": "1.139.0",
3
+ "version": "1.140.0",
4
4
  "type": "module",
5
5
  "description": "Type-safe SDK for 100+ AI models — image, video, and audio generation with Picsart",
6
6
  "license": "MIT",