@mynthio/sdk 0.0.45 → 0.0.47

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 CHANGED
@@ -473,6 +473,51 @@ const taskAsync = await mynth.image.removeBackgroundAsync({
473
473
  return { id: taskAsync.id, access: taskAsync.access };
474
474
  ```
475
475
 
476
+ ## Upscale
477
+
478
+ Enlarge an existing image 2x or 4x. Mynth picks the model, so there is no `model` field. `size` and `effort` are both required:
479
+
480
+ ```ts
481
+ const result = await mynth.image.upscale({
482
+ url: "https://example.com/product.jpg",
483
+ size: "2x",
484
+ effort: "low",
485
+ });
486
+
487
+ console.log(result.image.url); // upscaled image
488
+ console.log(result.image.size); // e.g. "2048x1536"
489
+ ```
490
+
491
+ `effort` sets the price: `low` is fast and sharp, `high` rebuilds fine detail such as small text and faces. `size` is `"2x"` or `"4x"`, or `{ type: "scale", factor: 2 | 4 }`. The upscaled image can be at most 4096x4096 pixels; a larger request fails with `OUTPUT_TOO_LARGE` and is not charged.
492
+
493
+ The result keeps the format the provider returned. Set `output.format` to always get `png`, `jpg`, or `webp`.
494
+ `upscale()` also takes a local `file`, plus `destination`, `webhook`, and `metadata` like `generate()`:
495
+
496
+ ```ts
497
+ const result = await mynth.image.upscale({
498
+ file,
499
+ size: "4x",
500
+ effort: "high",
501
+ output: { format: "webp" },
502
+ destination: "bunny-prod",
503
+ metadata: { productId: "sku_1" },
504
+ });
505
+
506
+ console.log(result.metadata.productId);
507
+ ```
508
+
509
+ Use `upscaleAsync()` to create the task without waiting. It returns a public access token, like `generateAsync()`:
510
+
511
+ ```ts
512
+ const taskAsync = await mynth.image.upscaleAsync({
513
+ url: "https://example.com/product.jpg",
514
+ size: "2x",
515
+ effort: "low",
516
+ });
517
+
518
+ return { id: taskAsync.id, access: taskAsync.access };
519
+ ```
520
+
476
521
  ## Working With Image Results
477
522
 
478
523
  Completed generation tasks expose a few helpful accessors:
@@ -567,6 +612,7 @@ Current model IDs include:
567
612
  - `google/gemini-3-pro-image-preview`
568
613
  - `imagineart/imagineart-1.5-pro`
569
614
  - `imagineart/imagineart-2.0`
615
+ - `ideogram/ideogram-4.5`
570
616
  - `john6666/bismuth-illustrious-mix`
571
617
  - `maxfeifei8/one-obsession`
572
618
  - `krea/krea-2-turbo`
@@ -839,6 +885,13 @@ export const mynthWebhook = mynthWebhookAction({
839
885
  imageRemoveBackgroundTaskFailed: async (payload) => {
840
886
  console.error("Mynth remove background task failed:", payload.task.id);
841
887
  },
888
+ imageUpscaleTaskCompleted: async (payload) => {
889
+ console.log("Completed upscale task:", payload.task.id);
890
+ console.log(payload.result.image.url);
891
+ },
892
+ imageUpscaleTaskFailed: async (payload) => {
893
+ console.error("Mynth upscale task failed:", payload.task.id);
894
+ },
842
895
  videoTaskCompleted: async (payload) => {
843
896
  console.log("Completed video task:", payload.task.id);
844
897
  console.log(payload.result.videos);
@@ -853,7 +906,7 @@ Set `MYNTH_WEBHOOK_SECRET` in your environment, or pass `webhookSecret` explicit
853
906
 
854
907
  ## Error Handling
855
908
 
856
- `upload()`, `generate()`, `generateAsync()`, `rate()`, `rateAsync()`, `alt()`, `altAsync()`, `review()`, `reviewAsync()`, `removeBackground()`, `removeBackgroundAsync()`, `models.list()`, and the `video` equivalents (`video.generate()`, `video.generateAsync()`, `video.upload()`, `video.estimate()`) may throw `MynthAPIError` if the request fails. Polling can also throw task-specific errors:
909
+ `upload()`, `generate()`, `generateAsync()`, `rate()`, `rateAsync()`, `alt()`, `altAsync()`, `review()`, `reviewAsync()`, `removeBackground()`, `removeBackgroundAsync()`, `upscale()`, `upscaleAsync()`, `models.list()`, and the `video` equivalents (`video.generate()`, `video.generateAsync()`, `video.upload()`, `video.estimate()`) may throw `MynthAPIError` if the request fails. Polling can also throw task-specific errors:
857
910
 
858
911
  While polling, transient failures (404, 5xx, dropped connections) are retried: a created task is owed an answer, so a cold cache or a brief outage does not lose you the result. A 429 slows polling down, doubling the interval up to 30 seconds, and only the timeout ends it. Polling gives up after 20 consecutive failures (~100s) with `TaskAsyncFetchError` or `TaskAsyncTaskFetchError`, immediately on a 401 or 403 with `TaskAsyncUnauthorizedError`, and immediately on any other 4xx with `TaskAsyncFetchError` or `TaskAsyncTaskFetchError`. Image waits time out after 30 minutes, video waits after an hour.
859
912
 
@@ -892,7 +945,7 @@ try {
892
945
 
893
946
  ## Documentation
894
947
 
895
- For product documentation and API guides, visit [docs.mynth.io](https://docs.mynth.io).
948
+ For product documentation and API guides, visit [mynth.io/docs](https://mynth.io/docs).
896
949
 
897
950
  ## Contributing
898
951
 
package/dist/handler.d.ts CHANGED
@@ -12,6 +12,8 @@ declare const EVENT_HANDLER_NAMES: {
12
12
  readonly "task.image.review.failed": "imageReviewTaskFailed";
13
13
  readonly "task.image.remove_background.completed": "imageRemoveBackgroundTaskCompleted";
14
14
  readonly "task.image.remove_background.failed": "imageRemoveBackgroundTaskFailed";
15
+ readonly "task.image.upscale.completed": "imageUpscaleTaskCompleted";
16
+ readonly "task.image.upscale.failed": "imageUpscaleTaskFailed";
15
17
  readonly "task.video.generate.completed": "videoTaskCompleted";
16
18
  readonly "task.video.generate.failed": "videoTaskFailed";
17
19
  };
package/dist/handler.js CHANGED
@@ -73,6 +73,8 @@ const EVENT_HANDLER_NAMES = {
73
73
  "task.image.review.failed": "imageReviewTaskFailed",
74
74
  "task.image.remove_background.completed": "imageRemoveBackgroundTaskCompleted",
75
75
  "task.image.remove_background.failed": "imageRemoveBackgroundTaskFailed",
76
+ "task.image.upscale.completed": "imageUpscaleTaskCompleted",
77
+ "task.image.upscale.failed": "imageUpscaleTaskFailed",
76
78
  "task.video.generate.completed": "videoTaskCompleted",
77
79
  "task.video.generate.failed": "videoTaskFailed"
78
80
  };
package/dist/index.d.ts CHANGED
@@ -197,6 +197,30 @@ export declare class ImageReviewResult {
197
197
  static fromTaskData(data: MynthSDKTypes.ImageReviewTaskData): ImageReviewResult;
198
198
  }
199
199
  //#endregion
200
+ //#region src/image-upscale-result.d.ts
201
+ /**
202
+ * Represents the result of a completed image upscale task.
203
+ *
204
+ * @template MetadataT - Type of the metadata attached to the request
205
+ */
206
+ export declare class ImageUpscaleResult<MetadataT = Record<string, unknown> | undefined> {
207
+ /** The task ID created for this request */
208
+ readonly taskId: string;
209
+ /** Cost charged for the completed task */
210
+ readonly cost: string;
211
+ /** The upscaled image */
212
+ readonly image: MynthSDKTypes.ImageUpscaleResultImage;
213
+ /** Metadata attached to the request */
214
+ readonly metadata: MetadataT;
215
+ constructor(data: {
216
+ taskId: string;
217
+ cost: string;
218
+ image: MynthSDKTypes.ImageUpscaleResultImage;
219
+ metadata: MetadataT;
220
+ });
221
+ static fromTaskData<MetadataT = Record<string, unknown> | undefined>(data: MynthSDKTypes.ImageUpscaleTaskData): ImageUpscaleResult<MetadataT>;
222
+ }
223
+ //#endregion
200
224
  //#region src/task-async.d.ts
201
225
  /**
202
226
  * Polling cadence overrides. Anything omitted keeps the image-task default.
@@ -387,6 +411,7 @@ type MynthModelPricing = MynthSDKTypes.ModelPricing;
387
411
  type ExtractMetadata<T extends MynthSDKTypes.ImageGenerationClientRequest> = T["metadata"];
388
412
  type ExtractVideoMetadata<T extends MynthSDKTypes.VideoGenerationClientRequest> = T["metadata"];
389
413
  type ExtractRemoveBackgroundMetadata<T extends MynthSDKTypes.ImageRemoveBackgroundClientRequest> = T["metadata"];
414
+ type ExtractUpscaleMetadata<T extends MynthSDKTypes.ImageUpscaleClientRequest> = T["metadata"];
390
415
  type ExtractRatingConfig<T extends MynthSDKTypes.ImageGenerationClientRequest> = T["rating"];
391
416
  type ExtractRatingLevels<T extends MynthSDKTypes.ImageGenerationClientRequest> = ExtractRatingConfig<T> extends {
392
417
  levels: readonly (infer L)[];
@@ -628,6 +653,38 @@ declare class MynthImage {
628
653
  */
629
654
  removeBackgroundAsync<const T extends MynthSDKTypes.ImageRemoveBackgroundClientRequest>(request: T): Promise<TaskAsync<ImageRemoveBackgroundResult<ExtractRemoveBackgroundMetadata<T>>>>;
630
655
  private createRemoveBackgroundTask;
656
+ /**
657
+ * Upscale a single image 2x or 4x.
658
+ *
659
+ * Mynth picks the model. `effort` sets the price, so it has no default. The
660
+ * upscaled image can be at most 4096x4096 pixels; a larger request fails
661
+ * with `OUTPUT_TOO_LARGE` and is not charged.
662
+ *
663
+ * @param request - Image URL or local file, size, and effort, plus optional output, destination, webhook, and metadata
664
+ * @returns An ImageUpscaleResult with the enlarged image
665
+ *
666
+ * @example
667
+ * ```typescript
668
+ * const result = await image.upscale({ url: "https://...", size: "2x", effort: "low" });
669
+ * console.log(result.image.url);
670
+ * ```
671
+ */
672
+ upscale<const T extends MynthSDKTypes.ImageUpscaleClientRequest>(request: T): Promise<ImageUpscaleResult<ExtractUpscaleMetadata<T>>>;
673
+ /**
674
+ * Start an upscale without waiting for completion.
675
+ *
676
+ * @param request - Image URL or local file, size, and effort, plus optional output, destination, webhook, and metadata
677
+ * @returns A TaskAsync that can be polled for completion via `.wait()`
678
+ *
679
+ * @example
680
+ * ```typescript
681
+ * const taskAsync = await image.upscaleAsync({ url: "https://...", size: "2x", effort: "low" });
682
+ *
683
+ * return { id: taskAsync.id, access: taskAsync.access };
684
+ * ```
685
+ */
686
+ upscaleAsync<const T extends MynthSDKTypes.ImageUpscaleClientRequest>(request: T): Promise<TaskAsync<ImageUpscaleResult<ExtractUpscaleMetadata<T>>>>;
687
+ private createUpscaleTask;
631
688
  }
632
689
  /**
633
690
  * Client for interacting with the Mynth video generation API.
package/dist/index.js CHANGED
@@ -11,6 +11,7 @@ const RATE_IMAGE_PATH = "/image/rate";
11
11
  const ALT_IMAGE_PATH = "/image/alt";
12
12
  const REVIEW_IMAGE_PATH = "/image/review";
13
13
  const REMOVE_BACKGROUND_IMAGE_PATH = "/image/remove-background";
14
+ const UPSCALE_IMAGE_PATH = "/image/upscale";
14
15
  const GENERATE_VIDEO_PATH = "/video/generate";
15
16
  const ESTIMATE_VIDEO_PATH = "/video/generate/estimate";
16
17
  const MODELS_PATH = "/models";
@@ -252,6 +253,11 @@ const AVAILABLE_MODELS = [
252
253
  label: "ImagineArt 2.0",
253
254
  capabilities: ["inputs"]
254
255
  },
256
+ {
257
+ id: "ideogram/ideogram-4.5",
258
+ label: "Ideogram 4.5",
259
+ capabilities: ["inputs"]
260
+ },
255
261
  {
256
262
  id: "openai/gpt-image-2",
257
263
  label: "GPT Image 2",
@@ -654,6 +660,39 @@ var ImageReviewResult = class ImageReviewResult {
654
660
  }
655
661
  };
656
662
  //#endregion
663
+ //#region src/image-upscale-result.ts
664
+ /**
665
+ * Represents the result of a completed image upscale task.
666
+ *
667
+ * @template MetadataT - Type of the metadata attached to the request
668
+ */
669
+ var ImageUpscaleResult = class ImageUpscaleResult {
670
+ /** The task ID created for this request */
671
+ taskId;
672
+ /** Cost charged for the completed task */
673
+ cost;
674
+ /** The upscaled image */
675
+ image;
676
+ /** Metadata attached to the request */
677
+ metadata;
678
+ constructor(data) {
679
+ this.taskId = data.taskId;
680
+ this.cost = data.cost;
681
+ this.image = data.image;
682
+ this.metadata = data.metadata;
683
+ }
684
+ static fromTaskData(data) {
685
+ if (data.status !== "completed" || data.result === null) throw new Error(`Image upscale task ${data.id} is not completed`);
686
+ if (data.cost === null) throw new Error(`Image upscale task ${data.id} is missing cost`);
687
+ return new ImageUpscaleResult({
688
+ taskId: data.id,
689
+ cost: data.cost,
690
+ image: data.result.image,
691
+ metadata: data.request.metadata
692
+ });
693
+ }
694
+ };
695
+ //#endregion
657
696
  //#region src/task-async.ts
658
697
  const POLLING_TIMEOUT_MS = 18e5;
659
698
  const FAST_POLLING_DURATION_MS = 12e3;
@@ -1369,6 +1408,55 @@ var MynthImage = class {
1369
1408
  resultFactory: (taskData) => ImageRemoveBackgroundResult.fromTaskData(taskData)
1370
1409
  });
1371
1410
  }
1411
+ /**
1412
+ * Upscale a single image 2x or 4x.
1413
+ *
1414
+ * Mynth picks the model. `effort` sets the price, so it has no default. The
1415
+ * upscaled image can be at most 4096x4096 pixels; a larger request fails
1416
+ * with `OUTPUT_TOO_LARGE` and is not charged.
1417
+ *
1418
+ * @param request - Image URL or local file, size, and effort, plus optional output, destination, webhook, and metadata
1419
+ * @returns An ImageUpscaleResult with the enlarged image
1420
+ *
1421
+ * @example
1422
+ * ```typescript
1423
+ * const result = await image.upscale({ url: "https://...", size: "2x", effort: "low" });
1424
+ * console.log(result.image.url);
1425
+ * ```
1426
+ */
1427
+ async upscale(request) {
1428
+ return (await this.createUpscaleTask(request)).wait();
1429
+ }
1430
+ /**
1431
+ * Start an upscale without waiting for completion.
1432
+ *
1433
+ * @param request - Image URL or local file, size, and effort, plus optional output, destination, webhook, and metadata
1434
+ * @returns A TaskAsync that can be polled for completion via `.wait()`
1435
+ *
1436
+ * @example
1437
+ * ```typescript
1438
+ * const taskAsync = await image.upscaleAsync({ url: "https://...", size: "2x", effort: "low" });
1439
+ *
1440
+ * return { id: taskAsync.id, access: taskAsync.access };
1441
+ * ```
1442
+ */
1443
+ async upscaleAsync(request) {
1444
+ return this.createUpscaleTask(request);
1445
+ }
1446
+ async createUpscaleTask(request) {
1447
+ const url = await this.resolveUrlOrFile(request);
1448
+ const { file: _, url: __, ...rest } = request;
1449
+ const data = (await this.client.post(UPSCALE_IMAGE_PATH, {
1450
+ ...rest,
1451
+ url,
1452
+ destination: request.destination ?? this.defaultDestination
1453
+ })).data;
1454
+ return new TaskAsync(data.taskId, {
1455
+ client: this.client,
1456
+ pat: data.access?.publicAccessToken,
1457
+ resultFactory: (taskData) => ImageUpscaleResult.fromTaskData(taskData)
1458
+ });
1459
+ }
1372
1460
  };
1373
1461
  /**
1374
1462
  * Client for interacting with the Mynth video generation API.
@@ -1582,4 +1670,4 @@ var Mynth = class {
1582
1670
  }
1583
1671
  };
1584
1672
  //#endregion
1585
- export { AVAILABLE_MODELS, AVAILABLE_VIDEO_MODELS, ImageAltResult, ImageGenerationResult, ImageRateResult, ImageRemoveBackgroundResult, ImageReviewResult, Mynth, Mynth as default, MynthAPIError, MynthImage, MynthModels, MynthVideo, TaskAsync, TaskAsyncFetchError, TaskAsyncTaskFailedError, TaskAsyncTaskFetchError, TaskAsyncTimeoutError, TaskAsyncUnauthorizedError, VideoGenerationResult };
1673
+ export { AVAILABLE_MODELS, AVAILABLE_VIDEO_MODELS, ImageAltResult, ImageGenerationResult, ImageRateResult, ImageRemoveBackgroundResult, ImageReviewResult, ImageUpscaleResult, Mynth, Mynth as default, MynthAPIError, MynthImage, MynthModels, MynthVideo, TaskAsync, TaskAsyncFetchError, TaskAsyncTaskFailedError, TaskAsyncTaskFetchError, TaskAsyncTimeoutError, TaskAsyncUnauthorizedError, VideoGenerationResult };
package/dist/types.d.ts CHANGED
@@ -72,7 +72,7 @@ declare namespace MynthSDKTypes {
72
72
  data: DataT;
73
73
  };
74
74
  type TaskStatus = "pending" | "completed" | "failed";
75
- type TaskType = "image.generate" | "image.rate" | "image.alt" | "image.review" | "image.remove_background" | "video.generate";
75
+ type TaskType = "image.generate" | "image.rate" | "image.alt" | "image.review" | "image.remove_background" | "image.upscale" | "video.generate";
76
76
  type TaskBase = {
77
77
  id: string;
78
78
  status: TaskStatus;
@@ -107,6 +107,10 @@ declare namespace MynthSDKTypes {
107
107
  type: "image.remove_background";
108
108
  request: ImageRemoveBackgroundRequest;
109
109
  result: ImageRemoveBackgroundTaskResult | null;
110
+ }) | (TaskBase & {
111
+ type: "image.upscale";
112
+ request: ImageUpscaleRequest;
113
+ result: ImageUpscaleTaskResult | null;
110
114
  }) | (TaskBase & {
111
115
  type: "video.generate";
112
116
  request: VideoGenerationRequest;
@@ -127,6 +131,9 @@ declare namespace MynthSDKTypes {
127
131
  type ImageRemoveBackgroundTaskData = Extract<TaskData, {
128
132
  type: "image.remove_background";
129
133
  }>;
134
+ type ImageUpscaleTaskData = Extract<TaskData, {
135
+ type: "image.upscale";
136
+ }>;
130
137
  type VideoGenerationTaskData = Extract<TaskData, {
131
138
  type: "video.generate";
132
139
  }>;
@@ -177,7 +184,7 @@ declare namespace MynthSDKTypes {
177
184
  };
178
185
  type Model = ImageModel | VideoModel;
179
186
  type ModelsListResponse = ApiResponse<Model[]>;
180
- type ImageGenerationModelId = "alibaba/qwen-image-2.0" | "alibaba/qwen-image-2.0-pro" | "alibaba/qwen-image-3.0" | "alibaba/qwen-image-3.0-pro" | "bytedance/seedream-5.0-lite" | "bytedance/seedream-pro" | "bytedance/seedream-v5-flash" | "black-forest-labs/flux.1-dev" | "black-forest-labs/flux-1-schnell" | "black-forest-labs/flux.2-dev" | "black-forest-labs/flux.2-pro" | "black-forest-labs/flux.2-flex" | "black-forest-labs/flux.2-max" | "black-forest-labs/flux.2-klein-4b" | "bria/fibo-edit-1.5" | "bria/fibo-generate-1.5" | "circlestone-labs/anima" | "goofy-ai/prefect-pony-xl-lora" | "google/gemini-3.1-flash-lite-image" | "google/gemini-3.1-flash-image" | "google/gemini-3-pro-image-preview" | "imagineart/imagineart-1.5-pro" | "imagineart/imagineart-2.0" | "klingai/kling-image-3.0" | "klingai/kling-image-o3" | "krea/krea-2-turbo" | "krea/krea-2-medium" | "krea/krea-2-large" | "luma/uni-1" | "luma/uni-1-max" | "meta/muse-image" | "microsoft/mai-image-2.6" | "microsoft/mai-image-2.6-flash" | "minimax/h3" | "openai/gpt-image-2" | "openai/gpt-image-2.5-flare" | "openai/gpt-image-2.5-sunburst" | "tongyi-mai/z-image" | "tongyi-mai/z-image-turbo" | "john6666/bismuth-illustrious-mix" | "maxfeifei8/one-obsession" | "purplesmartai/pony-diffusion-v6-xl" | "recraft/recraft-v4" | "recraft/recraft-v4.1-flash" | "recraft/recraft-v4-pro" | "reve/reve" | "reve/reve-remix" | "sourceful/riverflow-2.0-pro" | "wan/wan2.6-image" | "wan/wan2.7-image" | "wan/wan2.7-image-pro" | "xai/grok-imagine-image" | "xai/grok-imagine-image-2.0" | "xai/grok-imagine-image-quality";
187
+ type ImageGenerationModelId = "alibaba/qwen-image-2.0" | "alibaba/qwen-image-2.0-pro" | "alibaba/qwen-image-3.0" | "alibaba/qwen-image-3.0-pro" | "bytedance/seedream-5.0-lite" | "bytedance/seedream-pro" | "bytedance/seedream-v5-flash" | "black-forest-labs/flux.1-dev" | "black-forest-labs/flux-1-schnell" | "black-forest-labs/flux.2-dev" | "black-forest-labs/flux.2-pro" | "black-forest-labs/flux.2-flex" | "black-forest-labs/flux.2-max" | "black-forest-labs/flux.2-klein-4b" | "bria/fibo-edit-1.5" | "bria/fibo-generate-1.5" | "circlestone-labs/anima" | "goofy-ai/prefect-pony-xl-lora" | "google/gemini-3.1-flash-lite-image" | "google/gemini-3.1-flash-image" | "google/gemini-3-pro-image-preview" | "imagineart/imagineart-1.5-pro" | "imagineart/imagineart-2.0" | "ideogram/ideogram-4.5" | "klingai/kling-image-3.0" | "klingai/kling-image-o3" | "krea/krea-2-turbo" | "krea/krea-2-medium" | "krea/krea-2-large" | "luma/uni-1" | "luma/uni-1-max" | "meta/muse-image" | "microsoft/mai-image-2.6" | "microsoft/mai-image-2.6-flash" | "minimax/h3" | "openai/gpt-image-2" | "openai/gpt-image-2.5-flare" | "openai/gpt-image-2.5-sunburst" | "tongyi-mai/z-image" | "tongyi-mai/z-image-turbo" | "john6666/bismuth-illustrious-mix" | "maxfeifei8/one-obsession" | "purplesmartai/pony-diffusion-v6-xl" | "recraft/recraft-v4" | "recraft/recraft-v4.1-flash" | "recraft/recraft-v4-pro" | "reve/reve" | "reve/reve-remix" | "sourceful/riverflow-2.0-pro" | "wan/wan2.6-image" | "wan/wan2.7-image" | "wan/wan2.7-image-pro" | "xai/grok-imagine-image" | "xai/grok-imagine-image-2.0" | "xai/grok-imagine-image-quality";
181
188
  type ImageGenerationModel = ImageGenerationModelId | "auto";
182
189
  type GenerateImageOptionsIn = {
183
190
  prompt: string;
@@ -435,6 +442,50 @@ declare namespace MynthSDKTypes {
435
442
  type ImageRemoveBackgroundTaskResult = {
436
443
  image: ImageRemoveBackgroundResultImage;
437
444
  };
445
+ type ImageUpscaleEffort = "low" | "high";
446
+ type ImageUpscaleFactor = 2 | 4;
447
+ type ImageUpscaleSize = "2x" | "4x" | {
448
+ type: "scale";
449
+ factor: ImageUpscaleFactor;
450
+ };
451
+ type ImageUpscaleOutputFormat = "png" | "jpg" | "webp";
452
+ type ImageUpscaleRequestOutput = {
453
+ /** Converts the result to this format. When omitted, the provider's format is kept. */
454
+ format?: ImageUpscaleOutputFormat;
455
+ };
456
+ type ImageUpscaleRequest = {
457
+ /** Image URL to upscale. */
458
+ url: string;
459
+ size: ImageUpscaleSize;
460
+ /** Sets the price, so there is no default. */
461
+ effort: ImageUpscaleEffort;
462
+ output?: ImageUpscaleRequestOutput;
463
+ webhook?: ImageGenerationRequestWebhook;
464
+ access?: ImageGenerationRequestAccess;
465
+ metadata?: Record<string, unknown>;
466
+ destination?: string;
467
+ };
468
+ type ImageUpscaleClientRequest = ImageClientUrlOrFile & Omit<ImageUpscaleRequest, "url">;
469
+ type ImageUpscaleCreatedResponse = {
470
+ taskId: string;
471
+ estimatedCost: string;
472
+ access?: {
473
+ publicAccessToken: string;
474
+ };
475
+ };
476
+ type ImageUpscaleResultImage = {
477
+ id: string;
478
+ /** Destination URL, or the Mynth URL without a destination. `null` when delivery failed. */
479
+ url: string | null;
480
+ mynth_url: string;
481
+ /** `{width}x{height}`. Can be a few pixels off the source times the factor. */
482
+ size: string;
483
+ format: ImageUpscaleOutputFormat;
484
+ destination?: ImageResultDestination;
485
+ };
486
+ type ImageUpscaleTaskResult = {
487
+ image: ImageUpscaleResultImage;
488
+ };
438
489
  type VideoGenerationModelId = "bytedance/seedance-2.0-mini" | "google/gemini-omni-flash-1.1" | "prunaai/p-video" | "xai/grok-imagine-video-1.5";
439
490
  type VideoGenerationModel = VideoGenerationModelId;
440
491
  type VideoGenerationRequestResolution = "480p" | "720p" | "1080p" | "4k";
@@ -593,6 +644,22 @@ declare namespace MynthSDKTypes {
593
644
  request: ImageRemoveBackgroundRequest;
594
645
  errors: TaskError[];
595
646
  };
647
+ type WebhookTaskImageUpscaleCompletedPayload = {
648
+ task: {
649
+ id: string;
650
+ };
651
+ event: "task.image.upscale.completed";
652
+ result: ImageUpscaleTaskResult;
653
+ request: ImageUpscaleRequest;
654
+ };
655
+ type WebhookTaskImageUpscaleFailedPayload = {
656
+ task: {
657
+ id: string;
658
+ };
659
+ event: "task.image.upscale.failed";
660
+ request: ImageUpscaleRequest;
661
+ errors: TaskError[];
662
+ };
596
663
  type WebhookTaskVideoCompletedPayload = {
597
664
  task: {
598
665
  id: string;
@@ -609,7 +676,7 @@ declare namespace MynthSDKTypes {
609
676
  request: VideoGenerationRequest;
610
677
  errors: TaskError[];
611
678
  };
612
- type WebhookPayload = WebhookTaskImageCompletedPayload | WebhookTaskImageFailedPayload | WebhookTaskImageRateCompletedPayload | WebhookTaskImageRateFailedPayload | WebhookTaskImageAltCompletedPayload | WebhookTaskImageAltFailedPayload | WebhookTaskImageReviewCompletedPayload | WebhookTaskImageReviewFailedPayload | WebhookTaskImageRemoveBackgroundCompletedPayload | WebhookTaskImageRemoveBackgroundFailedPayload | WebhookTaskVideoCompletedPayload | WebhookTaskVideoFailedPayload;
679
+ type WebhookPayload = WebhookTaskImageCompletedPayload | WebhookTaskImageFailedPayload | WebhookTaskImageRateCompletedPayload | WebhookTaskImageRateFailedPayload | WebhookTaskImageAltCompletedPayload | WebhookTaskImageAltFailedPayload | WebhookTaskImageReviewCompletedPayload | WebhookTaskImageReviewFailedPayload | WebhookTaskImageRemoveBackgroundCompletedPayload | WebhookTaskImageRemoveBackgroundFailedPayload | WebhookTaskImageUpscaleCompletedPayload | WebhookTaskImageUpscaleFailedPayload | WebhookTaskVideoCompletedPayload | WebhookTaskVideoFailedPayload;
613
680
  }
614
681
  //#endregion
615
682
  export { AvailableVideoModel as a, VideoResolutionTier as c, AvailableModel as i, AVAILABLE_MODELS as n, ModelCapability as o, AVAILABLE_VIDEO_MODELS as r, VideoInputRole as s, MynthSDKTypes as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mynthio/sdk",
3
- "version": "0.0.45",
3
+ "version": "0.0.47",
4
4
  "description": "Official Mynth SDK for image generation and analysis",
5
5
  "keywords": [
6
6
  "ai",