@mynthio/sdk 0.0.14 → 0.0.16

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
@@ -48,7 +48,7 @@ console.log(task.urls);
48
48
  console.log(task.result?.model);
49
49
  ```
50
50
 
51
- If you omit `model` and `size`, Mynth resolves them automatically. By default, `generate()` waits for completion and returns a completed task.
51
+ If you omit `model` and `size`, Mynth resolves them automatically. `generate()` waits for completion and returns a completed task.
52
52
 
53
53
  ## Client Options
54
54
 
@@ -64,11 +64,11 @@ const mynth = new Mynth({
64
64
  - `apiKey`: optional if `MYNTH_API_KEY` is set
65
65
  - `baseUrl`: optional override for proxies or tests
66
66
 
67
- ## Sync vs Async
67
+ ## Generate vs Generate Async
68
68
 
69
- ### Sync Mode
69
+ ### Generate
70
70
 
71
- Sync mode is the default. It polls until the task is completed.
71
+ `generate()` polls until the task is completed.
72
72
 
73
73
  ```ts
74
74
  const task = await mynth.image.generate({
@@ -80,18 +80,15 @@ console.log(task.status); // "completed"
80
80
  console.log(task.urls);
81
81
  ```
82
82
 
83
- ### Async Mode
83
+ ### Generate Async
84
84
 
85
- Use async mode when you want to trigger work now and fetch the final task later.
85
+ Use `generateAsync()` when you want to trigger work now and fetch the final task later.
86
86
 
87
87
  ```ts
88
- const taskAsync = await mynth.image.generate(
89
- {
90
- prompt: "A cinematic fantasy castle on a cliff",
91
- model: "google/gemini-3.1-flash-image",
92
- },
93
- { mode: "async" },
94
- );
88
+ const taskAsync = await mynth.image.generateAsync({
89
+ prompt: "A cinematic fantasy castle on a cliff",
90
+ model: "google/gemini-3.1-flash-image",
91
+ });
95
92
 
96
93
  console.log(taskAsync.id);
97
94
  console.log(taskAsync.access.publicAccessToken);
@@ -105,18 +102,15 @@ console.log(completedTask.urls);
105
102
  You can use it as a Bearer token against:
106
103
 
107
104
  - `GET /tasks/:id/status`
108
- - `GET /tasks/:id/results`
105
+ - `GET /tasks/:id/result`
109
106
 
110
107
  Example:
111
108
 
112
109
  ```ts
113
- const taskAsync = await mynth.image.generate(
114
- {
115
- prompt: "A cinematic fantasy castle on a cliff",
116
- model: "google/gemini-3.1-flash-image",
117
- },
118
- { mode: "async" },
119
- );
110
+ const taskAsync = await mynth.image.generateAsync({
111
+ prompt: "A cinematic fantasy castle on a cliff",
112
+ model: "google/gemini-3.1-flash-image",
113
+ });
120
114
 
121
115
  const taskId = taskAsync.id;
122
116
  const pat = taskAsync.access.publicAccessToken;
@@ -128,13 +122,13 @@ const status = await fetch(`https://api.mynth.io/tasks/${taskId}/status`, {
128
122
  }).then((res) => res.json());
129
123
 
130
124
  if (status.status === "completed") {
131
- const results = await fetch(`https://api.mynth.io/tasks/${taskId}/results`, {
125
+ const taskResult = await fetch(`https://api.mynth.io/tasks/${taskId}/result`, {
132
126
  headers: {
133
127
  Authorization: `Bearer ${pat}`,
134
128
  },
135
129
  }).then((res) => res.json());
136
130
 
137
- console.log(results.images);
131
+ console.log(taskResult.result.images);
138
132
  }
139
133
  ```
140
134
 
@@ -152,11 +146,9 @@ You can also pass structured options:
152
146
 
153
147
  ```ts
154
148
  const task = await mynth.image.generate({
155
- prompt: {
156
- positive: "Studio portrait of a futuristic fashion model",
157
- negative: "blurry, low detail",
158
- enhance: "prefer_magic",
159
- },
149
+ prompt: "Studio portrait of a futuristic fashion model",
150
+ negative_prompt: "blurry, low detail",
151
+ magic_prompt: true,
160
152
  model: "google/gemini-3-pro-image-preview",
161
153
  size: {
162
154
  type: "aspect_ratio",
@@ -168,7 +160,7 @@ const task = await mynth.image.generate({
168
160
  quality: 80,
169
161
  },
170
162
  webhook: {
171
- enabled: true,
163
+ dashboard: false,
172
164
  custom: [{ url: "https://your-app.com/api/mynth-webhook" }],
173
165
  },
174
166
  access: {
@@ -176,8 +168,8 @@ const task = await mynth.image.generate({
176
168
  enabled: true,
177
169
  },
178
170
  },
179
- content_rating: {
180
- enabled: true,
171
+ rating: {
172
+ mode: "custom",
181
173
  levels: [
182
174
  { value: "safe", description: "Safe for all audiences" },
183
175
  { value: "sensitive", description: "Contains mature or suggestive content" },
@@ -205,25 +197,16 @@ const task = await mynth.image.generate({
205
197
 
206
198
  ## Prompt Options
207
199
 
208
- `prompt` can be:
209
-
210
- - a string
211
- - a structured object with `positive`, optional `negative`, and `enhance`
200
+ `prompt` is the positive text prompt. Use `negative_prompt` for exclusions and `magic_prompt: true` to ask Mynth to enhance the prompt before generation.
212
201
 
213
202
  ```ts
214
- prompt: {
215
- positive: "A luxury watch on a marble pedestal",
216
- negative: "text, watermark",
217
- enhance: false,
218
- }
203
+ await mynth.image.generate({
204
+ prompt: "A luxury watch on a marble pedestal",
205
+ negative_prompt: "text, watermark",
206
+ magic_prompt: true,
207
+ });
219
208
  ```
220
209
 
221
- `enhance` accepts:
222
-
223
- - `false`
224
- - `"prefer_magic"`
225
- - `"prefer_native"`
226
-
227
210
  ## Size Options
228
211
 
229
212
  `size` supports:
@@ -257,16 +240,16 @@ size: "landscape";
257
240
  size: "auto";
258
241
  size: { type: "aspect_ratio", aspectRatio: "16:9" };
259
242
  size: { type: "aspect_ratio", aspectRatio: "4:5", scale: "4k" };
260
- size: { type: "auto", prefer: "native" };
243
+ size: { type: "auto", provider: "native" };
261
244
  ```
262
245
 
263
246
  ## Input Images
264
247
 
265
- Use `inputs` to send reference, context, or init images:
248
+ Use `inputs` to send reference or init images:
266
249
 
267
250
  ```ts
268
251
  inputs: [
269
- "https://example.com/context-image.jpg",
252
+ "https://example.com/input-image.jpg",
270
253
  {
271
254
  type: "image",
272
255
  role: "reference",
@@ -278,7 +261,50 @@ inputs: [
278
261
  ];
279
262
  ```
280
263
 
281
- String URLs are a shorthand for image inputs. Structured inputs let you control the role explicitly with `"context"`, `"init"`, or `"reference"`.
264
+ String URLs are a shorthand for image inputs. Structured inputs let you control the role explicitly with `"auto"`, `"init"`, or `"reference"`.
265
+
266
+ ## Rating
267
+
268
+ Enable per-image content rating during generation with `rating`.
269
+
270
+ ```ts
271
+ const task = await mynth.image.generate({
272
+ prompt: "A fashion editorial image",
273
+ rating: true, // same result levels as { mode: "nsfw_sfw" }
274
+ });
275
+
276
+ console.log(task.getImages()[0]?.rating?.level); // "sfw" | "nsfw"
277
+ ```
278
+
279
+ For custom labels, pass at least two and at most seven levels:
280
+
281
+ ```ts
282
+ const task = await mynth.image.generate({
283
+ prompt: "A movie poster",
284
+ rating: {
285
+ mode: "custom",
286
+ levels: [
287
+ { value: "general", description: "Appropriate for all audiences" },
288
+ { value: "teen", description: "Mild mature themes" },
289
+ { value: "adult", description: "Adult-oriented content" },
290
+ ] as const,
291
+ },
292
+ });
293
+
294
+ console.log(task.getImages()[0]?.rating?.level); // "general" | "teen" | "adult"
295
+ ```
296
+
297
+ You can also rate existing image URLs:
298
+
299
+ ```ts
300
+ const result = await mynth.image.rate({
301
+ mode: "nsfw_sfw",
302
+ urls: ["https://example.com/image.webp"],
303
+ });
304
+
305
+ console.log(result.task.id);
306
+ console.log(result.getRatings());
307
+ ```
282
308
 
283
309
  ## Working With Results
284
310
 
@@ -297,7 +323,7 @@ console.log(task.urls);
297
323
  console.log(task.getImages());
298
324
  console.log(task.getImages({ includeFailed: true }));
299
325
  console.log(task.getMetadata());
300
- console.log(task.result?.prompt_enhance);
326
+ console.log(task.result?.magic_prompt);
301
327
  ```
302
328
 
303
329
  `task.urls` and `task.getImages()` return only successful images by default. `task.result?.images` may also include failed image entries.
@@ -335,6 +361,7 @@ Current model IDs include:
335
361
  - `google/gemini-3.1-flash-image`
336
362
  - `google/gemini-3-pro-image-preview`
337
363
  - `imagineart/imagineart-1.5-pro`
364
+ - `openai/gpt-image-2`
338
365
  - `john6666/bismuth-illustrious-mix`
339
366
  - `purplesmartai/pony-diffusion-v6-xl`
340
367
  - `recraft/recraft-v4`
@@ -378,7 +405,7 @@ Set `MYNTH_WEBHOOK_SECRET` in your environment, or pass `webhookSecret` explicit
378
405
 
379
406
  ## Error Handling
380
407
 
381
- `generate()` may throw `MynthAPIError` if the initial request fails. Async polling can also throw task-specific errors:
408
+ `generate()` and `generateAsync()` may throw `MynthAPIError` if the initial request fails. Polling can also throw task-specific errors:
382
409
 
383
410
  ```ts
384
411
  import {
@@ -391,10 +418,7 @@ import {
391
418
  } from "@mynthio/sdk";
392
419
 
393
420
  try {
394
- const taskAsync = await mynth.image.generate(
395
- { prompt: "A watercolor landscape" },
396
- { mode: "async" },
397
- );
421
+ const taskAsync = await mynth.image.generateAsync({ prompt: "A watercolor landscape" });
398
422
 
399
423
  const task = await taskAsync.wait();
400
424
  console.log(task.urls);
@@ -8,6 +8,7 @@ export declare const GENERATE_IMAGE_PATH = "/image/generate";
8
8
  export declare const RATE_IMAGE_PATH = "/image/rate";
9
9
  export declare const TASK_PATH = "/tasks";
10
10
  export declare const TASK_DETAILS_PATH: (id: string) => string;
11
+ export declare const TASK_RESULT_PATH: (id: string) => string;
11
12
  export declare const TASK_STATUS_PATH: (id: string) => string;
12
13
  /**
13
14
  * Model capabilities that affect available generation options.
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,eAAO,MAAM,OAAO,yBAAyB,CAAC;AAE9C,gDAAgD;AAChD,eAAO,MAAM,eAAe,kBAAkB,CAAC;AAE/C,2EAA2E;AAC3E,eAAO,MAAM,mBAAmB,sBAAsB,CAAC;AAEvD,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AACrD,eAAO,MAAM,eAAe,gBAAgB,CAAC;AAC7C,eAAO,MAAM,SAAS,WAAW,CAAC;AAClC,eAAO,MAAM,iBAAiB,GAAI,IAAI,MAAM,WAAyB,CAAC;AACtE,eAAO,MAAM,gBAAgB,GAAI,IAAI,MAAM,WAAgC,CAAC;AAE5E;;;;;;;;GAQG;AACH,MAAM,MAAM,eAAe,GACvB,QAAQ,GACR,oBAAoB,GACpB,iBAAiB,GACjB,IAAI,GACJ,uBAAuB,GACvB,kBAAkB,CAAC;AAEvB;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,mDAAmD;IACnD,EAAE,EAAE,MAAM,CAAC;IACX,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,YAAY,EAAE,SAAS,eAAe,EAAE,CAAC;CAC1C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAAS,cAAc,EA0GrD,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,eAAO,MAAM,OAAO,yBAAyB,CAAC;AAE9C,gDAAgD;AAChD,eAAO,MAAM,eAAe,kBAAkB,CAAC;AAE/C,2EAA2E;AAC3E,eAAO,MAAM,mBAAmB,sBAAsB,CAAC;AAEvD,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AACrD,eAAO,MAAM,eAAe,gBAAgB,CAAC;AAC7C,eAAO,MAAM,SAAS,WAAW,CAAC;AAClC,eAAO,MAAM,iBAAiB,GAAI,IAAI,MAAM,WAAyB,CAAC;AACtE,eAAO,MAAM,gBAAgB,GAAI,IAAI,MAAM,WAAgC,CAAC;AAC5E,eAAO,MAAM,gBAAgB,GAAI,IAAI,MAAM,WAAgC,CAAC;AAE5E;;;;;;;;GAQG;AACH,MAAM,MAAM,eAAe,GACvB,QAAQ,GACR,oBAAoB,GACpB,iBAAiB,GACjB,IAAI,GACJ,uBAAuB,GACvB,kBAAkB,CAAC;AAEvB;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,mDAAmD;IACnD,EAAE,EAAE,MAAM,CAAC;IACX,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,YAAY,EAAE,SAAS,eAAe,EAAE,CAAC;CAC1C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAAS,cAAc,EA+GrD,CAAC"}
@@ -1,24 +1,22 @@
1
1
  import type { MynthSDKTypes } from "./types";
2
- /** Typed image result with custom content rating type */
3
- type TypedImageResultImageSuccess<ContentRatingT> = Omit<MynthSDKTypes.ImageResultImageSuccess, "content_rating"> & {
4
- content_rating?: ContentRatingT;
2
+ type TypedImageResultImageSuccess<RatingT> = Omit<MynthSDKTypes.ImageResultImageSuccess, "rating"> & {
3
+ rating?: RatingT;
5
4
  };
6
5
  type TypedImageResultImageFailure = MynthSDKTypes.ImageResultImageFailure;
7
- type TypedImageResultImage<ContentRatingT> = TypedImageResultImageSuccess<ContentRatingT> | TypedImageResultImageFailure;
8
- /** Typed result with custom content rating type on images */
9
- type TypedImageResult<ContentRatingT> = Omit<MynthSDKTypes.ImageResult, "images"> & {
10
- images: TypedImageResultImage<ContentRatingT>[];
6
+ type TypedImageResultImage<RatingT> = TypedImageResultImageSuccess<RatingT> | TypedImageResultImageFailure;
7
+ type TypedImageResult<RatingT> = Omit<MynthSDKTypes.ImageResult, "images"> & {
8
+ images: TypedImageResultImage<RatingT>[];
11
9
  };
12
10
  /**
13
11
  * Represents a completed image generation task.
14
12
  *
15
13
  * @template MetadataT - Type of the metadata attached to the request
16
- * @template ContentRatingT - Type of the content rating response
14
+ * @template RatingT - Type of the rating response
17
15
  */
18
- export declare class ImageGenerationResult<MetadataT = Record<string, unknown> | undefined, ContentRatingT = MynthSDKTypes.ImageResultContentRating | undefined> {
16
+ export declare class ImageGenerationResult<MetadataT = Record<string, unknown> | undefined, RatingT = MynthSDKTypes.ImageResultRating | undefined> {
19
17
  /** Raw task data from the API */
20
- readonly data: MynthSDKTypes.TaskData;
21
- constructor(data: MynthSDKTypes.TaskData);
18
+ readonly data: MynthSDKTypes.ImageGenerationTaskData;
19
+ constructor(data: MynthSDKTypes.ImageGenerationTaskData);
22
20
  /** Unique identifier for this task */
23
21
  get id(): string;
24
22
  /** Current status of the task */
@@ -27,7 +25,7 @@ export declare class ImageGenerationResult<MetadataT = Record<string, unknown> |
27
25
  * The generation result containing images, cost, and model info.
28
26
  * Returns `null` if the task hasn't completed yet.
29
27
  */
30
- get result(): TypedImageResult<ContentRatingT> | null;
28
+ get result(): TypedImageResult<RatingT> | null;
31
29
  /** Whether the task completed successfully */
32
30
  get isCompleted(): boolean;
33
31
  /** Whether the task failed */
@@ -47,10 +45,10 @@ export declare class ImageGenerationResult<MetadataT = Record<string, unknown> |
47
45
  */
48
46
  getImages(options: {
49
47
  includeFailed: true;
50
- }): TypedImageResultImage<ContentRatingT>[];
48
+ }): TypedImageResultImage<RatingT>[];
51
49
  getImages(options?: {
52
50
  includeFailed?: false;
53
- }): TypedImageResultImageSuccess<ContentRatingT>[];
51
+ }): TypedImageResultImageSuccess<RatingT>[];
54
52
  /**
55
53
  * Get the metadata that was attached to the generation request.
56
54
  */
@@ -1 +1 @@
1
- {"version":3,"file":"image-generation-result.d.ts","sourceRoot":"","sources":["../src/image-generation-result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,yDAAyD;AACzD,KAAK,4BAA4B,CAAC,cAAc,IAAI,IAAI,CACtD,aAAa,CAAC,uBAAuB,EACrC,gBAAgB,CACjB,GAAG;IACF,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC,CAAC;AAEF,KAAK,4BAA4B,GAAG,aAAa,CAAC,uBAAuB,CAAC;AAE1E,KAAK,qBAAqB,CAAC,cAAc,IACrC,4BAA4B,CAAC,cAAc,CAAC,GAC5C,4BAA4B,CAAC;AAEjC,6DAA6D;AAC7D,KAAK,gBAAgB,CAAC,cAAc,IAAI,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,QAAQ,CAAC,GAAG;IAClF,MAAM,EAAE,qBAAqB,CAAC,cAAc,CAAC,EAAE,CAAC;CACjD,CAAC;AAEF;;;;;GAKG;AACH,qBAAa,qBAAqB,CAChC,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC/C,cAAc,GAAG,aAAa,CAAC,wBAAwB,GAAG,SAAS;IAEnE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QAAQ,CAAC,GAAG;IAC3E,MAAM,EAAE,qBAAqB,CAAC,OAAO,CAAC,EAAE,CAAC;CAC1C,CAAC;AAEF;;;;;GAKG;AACH,qBAAa,qBAAqB,CAChC,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC/C,OAAO,GAAG,aAAa,CAAC,iBAAiB,GAAG,SAAS;IAErD,iCAAiC;IACjC,SAAgB,IAAI,EAAE,aAAa,CAAC,uBAAuB,CAAC;gBAEhD,IAAI,EAAE,aAAa,CAAC,uBAAuB;IAIvD,sCAAsC;IACtC,IAAI,EAAE,IAAI,MAAM,CAEf;IAED,iCAAiC;IACjC,IAAI,MAAM,IAAI,aAAa,CAAC,UAAU,CAErC;IAED;;;OAGG;IACH,IAAI,MAAM,IAAI,gBAAgB,CAAC,OAAO,CAAC,GAAG,IAAI,CAE7C;IAED,8CAA8C;IAC9C,IAAI,WAAW,IAAI,OAAO,CAEzB;IAED,8BAA8B;IAC9B,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED;;;;;OAKG;IACH,IAAI,IAAI,IAAI,MAAM,EAAE,CAOnB;IAED;;;;;OAKG;IACH,SAAS,CAAC,OAAO,EAAE;QAAE,aAAa,EAAE,IAAI,CAAA;KAAE,GAAG,qBAAqB,CAAC,OAAO,CAAC,EAAE;IAC7E,SAAS,CAAC,OAAO,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,KAAK,CAAA;KAAE,GAAG,4BAA4B,CAAC,OAAO,CAAC,EAAE;IAWvF;;OAEG;IACH,WAAW,IAAI,SAAS;CAGzB"}
@@ -1,14 +1,16 @@
1
1
  import type { MynthSDKTypes } from "./types";
2
2
  /** A successfully rated image */
3
3
  type ImageRateResultItemSuccess<LevelT extends string> = {
4
- /** The submitted image URL */
4
+ status: "success";
5
5
  url: string;
6
- /** The assigned rating level */
7
- rating: LevelT;
6
+ level: LevelT;
8
7
  };
9
- /** An image that could not be rated */
10
8
  type ImageRateResultItemError = {
11
- error_code: string;
9
+ status: "failed";
10
+ url: string;
11
+ error: {
12
+ code: string;
13
+ };
12
14
  };
13
15
  /** Individual rating result — success or error */
14
16
  export type ImageRateResultItem<LevelT extends string = string> = ImageRateResultItemSuccess<LevelT> | ImageRateResultItemError;
@@ -20,6 +22,8 @@ export type ImageRateResultItem<LevelT extends string = string> = ImageRateResul
20
22
  export declare class ImageRateResult<LevelT extends string = "sfw" | "nsfw"> {
21
23
  /** The task ID created for this rating request */
22
24
  readonly taskId: string;
25
+ /** Task metadata returned by the API */
26
+ readonly task: MynthSDKTypes.ImageRateResponse<LevelT>["task"];
23
27
  /** Raw results array from the API */
24
28
  readonly results: ImageRateResultItem<LevelT>[];
25
29
  constructor(data: MynthSDKTypes.ImageRateResponse<LevelT>);
@@ -1 +1 @@
1
- {"version":3,"file":"image-rate-result.d.ts","sourceRoot":"","sources":["../src/image-rate-result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,iCAAiC;AACjC,KAAK,0BAA0B,CAAC,MAAM,SAAS,MAAM,IAAI;IACvD,8BAA8B;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,gCAAgC;IAChC,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,uCAAuC;AACvC,KAAK,wBAAwB,GAAG;IAC9B,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,kDAAkD;AAClD,MAAM,MAAM,mBAAmB,CAAC,MAAM,SAAS,MAAM,GAAG,MAAM,IAC1D,0BAA0B,CAAC,MAAM,CAAC,GAClC,wBAAwB,CAAC;AAE7B;;;;GAIG;AACH,qBAAa,eAAe,CAAC,MAAM,SAAS,MAAM,GAAG,KAAK,GAAG,MAAM;IACjE,kDAAkD;IAClD,SAAgB,MAAM,EAAE,MAAM,CAAC;IAE/B,qCAAqC;IACrC,SAAgB,OAAO,EAAE,mBAAmB,CAAC,MAAM,CAAC,EAAE,CAAC;gBAE3C,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AwB,EAAE;CAGxC"}
package/dist/index.d.ts CHANGED
@@ -6,13 +6,6 @@ import { ImageRateResult } from "./image-rate-result";
6
6
  import type { TaskAsyncAccess } from "./task-async";
7
7
  import { TaskAsync, TaskAsyncFetchError, TaskAsyncTaskFailedError, TaskAsyncTaskFetchError, TaskAsyncTimeoutError, TaskAsyncUnauthorizedError } from "./task-async";
8
8
  import type { MynthSDKTypes } from "./types";
9
- /**
10
- * Options for the generate method.
11
- */
12
- type GenerateOptions = {
13
- /** Whether to wait for completion ("sync") or return immediately ("async") */
14
- mode?: "sync" | "async";
15
- };
16
9
  /**
17
10
  * Configuration options for the Mynth client.
18
11
  */
@@ -33,32 +26,34 @@ type MynthOptions = {
33
26
  destination?: string;
34
27
  };
35
28
  type ExtractMetadata<T extends MynthSDKTypes.ImageGenerationRequest> = T["metadata"];
36
- type ExtractContentRatingConfig<T extends MynthSDKTypes.ImageGenerationRequest> = T["content_rating"];
37
- type ExtractContentRatingLevels<T extends MynthSDKTypes.ImageGenerationRequest> = ExtractContentRatingConfig<T> extends {
29
+ type ExtractRatingConfig<T extends MynthSDKTypes.ImageGenerationRequest> = T["rating"];
30
+ type ExtractRatingLevels<T extends MynthSDKTypes.ImageGenerationRequest> = ExtractRatingConfig<T> extends {
38
31
  levels: readonly (infer L)[];
39
- } ? L : ExtractContentRatingConfig<T> extends {
32
+ } ? L : ExtractRatingConfig<T> extends {
40
33
  levels: (infer L)[];
41
34
  } ? L : never;
42
- type ExtractContentRatingLevelValues<T extends MynthSDKTypes.ImageGenerationRequest> = ExtractContentRatingLevels<T> extends {
35
+ type ExtractRatingLevelValues<T extends MynthSDKTypes.ImageGenerationRequest> = ExtractRatingLevels<T> extends {
43
36
  value: infer V;
44
37
  } ? (V extends string ? V : never) : never;
45
- type IsContentRatingCustom<T extends MynthSDKTypes.ImageGenerationRequest> = ExtractContentRatingConfig<T> extends {
38
+ type IsRatingCustom<T extends MynthSDKTypes.ImageGenerationRequest> = ExtractRatingConfig<T> extends {
39
+ mode: "custom";
46
40
  levels: readonly any[] | any[];
47
41
  } ? true : false;
48
- type ExtractContentRatingResponse<T extends MynthSDKTypes.ImageGenerationRequest> = IsContentRatingCustom<T> extends true ? {
49
- mode: "custom";
50
- level: ExtractContentRatingLevelValues<T>;
51
- } : ExtractContentRatingConfig<T> extends {
52
- enabled?: true;
42
+ type ExtractRatingResponse<T extends MynthSDKTypes.ImageGenerationRequest> = IsRatingCustom<T> extends true ? {
43
+ status: "success";
44
+ level: ExtractRatingLevelValues<T>;
45
+ } | MynthSDKTypes.ImageResultRatingFailure : ExtractRatingConfig<T> extends true | {
46
+ mode: "nsfw_sfw";
53
47
  } ? {
54
- mode: "default";
55
- level: MynthSDKTypes.ImageResultContentRatingDefaultLevel;
56
- } : MynthSDKTypes.ImageResultContentRating | undefined;
57
- type ExtractRateLevelValues<T extends MynthSDKTypes.ImageRateRequest> = T["levels"] extends readonly {
58
- value: infer V;
59
- }[] ? V extends string ? V : string : T["levels"] extends {
60
- value: infer V;
61
- }[] ? V extends string ? V : string : "sfw" | "nsfw";
48
+ status: "success";
49
+ level: MynthSDKTypes.ImageResultRatingDefaultLevel;
50
+ } | MynthSDKTypes.ImageResultRatingFailure : MynthSDKTypes.ImageResultRating | undefined;
51
+ type ExtractRateLevelValues<T extends MynthSDKTypes.ImageRateRequest> = T extends {
52
+ mode: "custom";
53
+ levels: readonly {
54
+ value: infer V;
55
+ }[];
56
+ } ? V extends string ? V : string : MynthSDKTypes.ImageResultRatingDefaultLevel;
62
57
  /**
63
58
  * Client for interacting with the Mynth image generation and rating APIs.
64
59
  *
@@ -107,41 +102,24 @@ declare class MynthImage {
107
102
  * console.log(result.urls);
108
103
  * ```
109
104
  */
110
- generate<const T extends MynthSDKTypes.ImageGenerationRequest>(request: T): Promise<ImageGenerationResult<ExtractMetadata<T>, ExtractContentRatingResponse<T>>>;
105
+ generate<const T extends MynthSDKTypes.ImageGenerationRequest>(request: T): Promise<ImageGenerationResult<ExtractMetadata<T>, ExtractRatingResponse<T>>>;
111
106
  /**
112
- * Generate images asynchronously without waiting for completion.
107
+ * Start image generation without waiting for completion.
113
108
  *
114
109
  * @param request - Image generation request parameters
115
- * @param opts - Options with mode set to "async"
116
110
  * @returns A TaskAsync that can be polled for completion via `.wait()`
117
111
  *
118
112
  * @example
119
113
  * ```typescript
120
- * const taskAsync = await image.generate(
121
- * { prompt: "A futuristic cityscape" },
122
- * { mode: "async" }
123
- * );
114
+ * const taskAsync = await image.generateAsync({
115
+ * prompt: "A futuristic cityscape",
116
+ * });
124
117
  *
125
- * // Return task ID for client-side polling
126
118
  * return { id: taskAsync.id, access: taskAsync.access };
127
- *
128
- * // Or wait for completion later
129
- * const result = await taskAsync.wait();
130
119
  * ```
131
120
  */
132
- generate<const T extends MynthSDKTypes.ImageGenerationRequest>(request: T, opts: {
133
- mode: "async";
134
- }): Promise<TaskAsync<ImageGenerationResult<ExtractMetadata<T>, ExtractContentRatingResponse<T>>>>;
135
- /**
136
- * Generate images synchronously, waiting for completion.
137
- *
138
- * @param request - Image generation request parameters
139
- * @param opts - Options with mode set to "sync"
140
- * @returns A completed ImageGenerationResult with the generation results
141
- */
142
- generate<const T extends MynthSDKTypes.ImageGenerationRequest>(request: T, opts: {
143
- mode: "sync";
144
- }): Promise<ImageGenerationResult<ExtractMetadata<T>, ExtractContentRatingResponse<T>>>;
121
+ generateAsync<const T extends MynthSDKTypes.ImageGenerationRequest>(request: T): Promise<TaskAsync<ImageGenerationResult<ExtractMetadata<T>, ExtractRatingResponse<T>>>>;
122
+ private createGenerationTask;
145
123
  /**
146
124
  * Rate the content of one or more images.
147
125
  *
@@ -155,19 +133,20 @@ declare class MynthImage {
155
133
  * @example
156
134
  * ```typescript
157
135
  * // Default sfw/nsfw
158
- * const result = await image.rate({ urls: ["https://..."] });
159
- * console.log(result.getRatings()); // [{ url: "...", rating: "sfw" }]
136
+ * const result = await image.rate({ urls: ["https://..."], mode: "nsfw_sfw" });
137
+ * console.log(result.getRatings()); // [{ status: "success", url: "...", level: "sfw" }]
160
138
  *
161
139
  * // Custom levels
162
140
  * const result = await image.rate({
163
141
  * urls: ["https://..."],
142
+ * mode: "custom",
164
143
  * levels: [
165
144
  * { value: "safe", description: "No explicit content" },
166
145
  * { value: "mature", description: "Adult themes, no nudity" },
167
146
  * { value: "explicit", description: "Contains nudity or graphic content" },
168
147
  * ] as const,
169
148
  * });
170
- * result.getRatings(); // [{ url: "...", rating: "safe" | "mature" | "explicit" }]
149
+ * result.getRatings(); // [{ status: "success", url: "...", level: "safe" | "mature" | "explicit" }]
171
150
  * ```
172
151
  */
173
152
  rate<const T extends MynthSDKTypes.ImageRateRequest>(request: T): Promise<ImageRateResult<ExtractRateLevelValues<T>>>;
@@ -197,7 +176,7 @@ declare class Mynth {
197
176
  */
198
177
  constructor(options?: MynthOptions);
199
178
  }
200
- export { AVAILABLE_MODELS, ImageGenerationResult, ImageRateResult, Mynth, MynthImage, MynthAPIError, TaskAsyncFetchError, TaskAsyncTaskFailedError, TaskAsyncTaskFetchError, TaskAsyncTimeoutError, TaskAsyncUnauthorizedError, };
201
- export type { AvailableModel, GenerateOptions, ModelCapability, MynthOptions, MynthSDKTypes, TaskAsyncAccess, };
179
+ export { AVAILABLE_MODELS, ImageGenerationResult, ImageRateResult, Mynth, MynthImage, TaskAsync, MynthAPIError, TaskAsyncFetchError, TaskAsyncTaskFailedError, TaskAsyncTaskFetchError, TaskAsyncTimeoutError, TaskAsyncUnauthorizedError, };
180
+ export type { AvailableModel, ModelCapability, MynthOptions, MynthSDKTypes, TaskAsyncAccess };
202
181
  export default Mynth;
203
182
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAe,MAAM,UAAU,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAEL,gBAAgB,EA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C;AAED,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EACf,KAAK,EACL,UAAU,EACV,SAAS,EAET,aAAa,EACb,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,EACvB,qBAAqB,EACrB,0BAA0B,GAC3B,CAAC;AACF,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,CAAC;AAC9F,eAAe,KAAK,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- var b="https://api.mynth.io",X="MYNTH_API_KEY",v="MYNTH_DESTINATION",G="/image/generate",K="/image/rate";var O=(J)=>`/tasks/${J}`,F=(J)=>`/tasks/${J}/status`,_=[{id:"auto",label:"Auto",capabilities:[]},{id:"alibaba/qwen-image-2.0",label:"Qwen Image 2.0",capabilities:["inputs","native_enhance_prompt"]},{id:"alibaba/qwen-image-2.0-pro",label:"Qwen Image 2.0 Pro",capabilities:["inputs","native_enhance_prompt"]},{id:"bytedance/seedream-5.0-lite",label:"Seedream 5.0 Lite",capabilities:["inputs"]},{id:"black-forest-labs/flux.1-dev",label:"FLUX.1 Dev",capabilities:["mynth_magic_prompt"]},{id:"black-forest-labs/flux-1-schnell",label:"FLUX.1 Schnell",capabilities:["mynth_magic_prompt"]},{id:"tongyi-mai/z-image-turbo",label:"Z Image Turbo",capabilities:["mynth_magic_prompt"]},{id:"black-forest-labs/flux.2-dev",label:"FLUX.2 Dev",capabilities:["inputs","mynth_magic_prompt"]},{id:"black-forest-labs/flux.2-pro",label:"FLUX.2 Pro",capabilities:["inputs"]},{id:"black-forest-labs/flux.2-flex",label:"FLUX.2 Flex",capabilities:["inputs"]},{id:"black-forest-labs/flux.2-max",label:"FLUX.2 Max",capabilities:["inputs"]},{id:"black-forest-labs/flux.2-klein-4b",label:"FLUX.2 Klein 4B",capabilities:["inputs"]},{id:"john6666/bismuth-illustrious-mix",label:"Bismuth Illustrious Mix",capabilities:["mynth_magic_prompt","negative_prompt"]},{id:"purplesmartai/pony-diffusion-v6-xl",label:"Pony Diffusion V6 XL",capabilities:["negative_prompt"]},{id:"recraft/recraft-v4",label:"Recraft V4",capabilities:[]},{id:"recraft/recraft-v4-pro",label:"Recraft V4 Pro",capabilities:[]},{id:"google/gemini-3.1-flash-image",label:"Nano Banana 2",capabilities:["inputs","4k","native_enhance_prompt","native_auto_size"]},{id:"google/gemini-3-pro-image-preview",label:"Nano Banana Pro",capabilities:["4k","native_enhance_prompt"]},{id:"imagineart/imagineart-1.5-pro",label:"ImagineArt 1.5 Pro",capabilities:["4k"]},{id:"wan/wan2.6-image",label:"Wan 2.6 Image",capabilities:[]},{id:"xai/grok-imagine-image",label:"Grok Imagine Image",capabilities:["inputs","native_auto_size"]}];class w extends Error{status;code;constructor(J,Q,Z){super(J);this.name="MynthAPIError",this.status=Q,this.code=Z}}class j{apiKey;baseUrl;constructor(J){this.apiKey=J.apiKey,this.baseUrl=J.baseUrl?J.baseUrl.endsWith("/")?J.baseUrl.slice(0,-1):J.baseUrl:b}getAuthHeaders(J){return{Authorization:`Bearer ${J?.accessToken??this.apiKey}`}}getUrl(J){return`${this.baseUrl}${J}`}async post(J,Q){let Z=await fetch(this.getUrl(J),{method:"POST",headers:{"Content-Type":"application/json",...this.getAuthHeaders()},body:JSON.stringify(Q)}),$=await Z.json();if(!Z.ok){let x=$,B=x.error||x.message||`Request failed with status ${Z.status}`;throw new w(B,Z.status,x.code)}return $}async get(J,{headers:Q,accessToken:Z}={}){let $=await fetch(this.getUrl(J),{headers:{...this.getAuthHeaders({accessToken:Z}),...Q}});return{data:await $.json(),status:$.status,ok:$.ok}}}class H{data;constructor(J){this.data=J}get id(){return this.data.id}get status(){return this.data.status}get result(){return this.data.result}get isCompleted(){return this.data.status==="completed"}get isFailed(){return this.data.status==="failed"}get urls(){return this.data.result?.images.filter((J)=>J.status==="succeeded").map((J)=>J.url).filter((J)=>J!==null)??[]}getImages(J={}){if(J.includeFailed)return this.data.result?.images??[];return this.data.result?.images.filter((Q)=>Q.status==="succeeded")??[]}getMetadata(){return this.data.request?.metadata}}class Y{taskId;results;constructor(J){this.taskId=J.taskId,this.results=J.results}getRatings(){return this.results.filter((J)=>("url"in J))}getErrors(){return this.results.filter((J)=>("error_code"in J))}}var z=300000,m=12000,h=2500,k=5000,E=7;class D extends Error{constructor(J){super(`Task ${J} polling timed out after ${z}ms`);this.name="TaskAsyncTimeoutError"}}class W extends Error{constructor(J){super(`Unauthorized access to task ${J}`);this.name="TaskAsyncUnauthorizedError"}}class f extends Error{constructor(J,Q){super(`Failed to fetch status for task ${J} after multiple retries`);this.name="TaskAsyncFetchError",this.cause=Q}}class q extends Error{constructor(J,Q){let Z=Q?` (status ${Q})`:"";super(`Failed to fetch task ${J}${Z}`);this.name="TaskAsyncTaskFetchError"}}class V extends Error{constructor(J){super(`Task ${J} failed during generation`);this.name="TaskAsyncTaskFailedError"}}class C{id;client;_access;resultFactory;_completionPromise=null;constructor(J,Q){this.id=J,this.client=Q.client,this._access={publicAccessToken:Q.pat},this.resultFactory=Q.resultFactory}get access(){return this._access}toString(){return this.id}async wait(){if(!this._completionPromise)this._completionPromise=this.pollUntilCompleted();return this._completionPromise}async pollUntilCompleted(){let J=Date.now(),Q=0,Z=!1,$;while(!0){let x=Date.now()-J;if(x>=z)throw new D(this.id);let B=await this.fetchStatus(Z);if(B.ok){if(Q=0,B.status==="completed"){let M=await this.fetchTask();return this.resultFactory(M)}if(B.status==="failed")throw new V(this.id)}else{if(B.unauthorized){if(this._access.publicAccessToken&&!Z){Z=!0;continue}throw new W(this.id)}if(B.retryable){if(Q++,$=B.error,Q>=E)throw new f(this.id,$)}}let N=x<m?h:k,P=Math.random()*500,R=N+P,L=z-x,g=Math.min(R,L);await this.sleep(g)}}async fetchStatus(J){let Q=J||!this._access.publicAccessToken?void 0:this._access.publicAccessToken;try{let Z=await this.client.get(F(this.id),{accessToken:Q});if(Z.ok)return{ok:!0,status:Z.data.status};if(Z.status===401||Z.status===403)return{ok:!1,unauthorized:!0,retryable:!1};if(Z.status===404)return{ok:!1,unauthorized:!0,retryable:!1};if(Z.status>=500)return{ok:!1,unauthorized:!1,retryable:!0};return{ok:!1,unauthorized:!1,retryable:!1}}catch(Z){return{ok:!1,unauthorized:!1,retryable:!0,error:Z instanceof Error?Z:Error(String(Z))}}}async fetchTask(){let J=await this.client.get(O(this.id));if(J.ok)return J.data;if(J.status===401||J.status===403)throw new W(this.id);if(J.status===404)throw new W(this.id);throw new q(this.id,J.status)}sleep(J){return new Promise((Q)=>setTimeout(Q,J))}}function I(){if(typeof process<"u"&&process.env)return process.env[X];return}function y(){if(typeof process<"u"&&process.env)return process.env[v];return}class S{client;defaultDestination;constructor(J={}){let Q=J.apiKey??I();if(!Q)throw Error(`Mynth API key is required. Either pass it as an option or set the ${X} environment variable.`);this.defaultDestination=J.destination??y(),this.client=new j({apiKey:Q,baseUrl:J.baseUrl})}async generate(J,Q={}){let Z=Q.mode??"sync",$=await this.client.post(G,{...J,destination:J.destination??this.defaultDestination}),x=new C($.taskId,{client:this.client,pat:$.access?.publicAccessToken,resultFactory:(B)=>new H(B)});if(Z==="async")return x;return x.wait()}async rate(J){let Q=await this.client.post(K,J);return new Y(Q)}}class U{image;constructor(J={}){this.image=new S(J)}}var s=U;export{s as default,W as TaskAsyncUnauthorizedError,D as TaskAsyncTimeoutError,q as TaskAsyncTaskFetchError,V as TaskAsyncTaskFailedError,f as TaskAsyncFetchError,S as MynthImage,w as MynthAPIError,U as Mynth,Y as ImageRateResult,H as ImageGenerationResult,_ as AVAILABLE_MODELS};
2
+ var q="https://api.mynth.io",X="MYNTH_API_KEY",v="MYNTH_DESTINATION",G="/image/generate",K="/image/rate";var O=(J)=>`/tasks/${J}`;var F=(J)=>`/tasks/${J}/status`,_=[{id:"auto",label:"Auto",capabilities:[]},{id:"alibaba/qwen-image-2.0",label:"Qwen Image 2.0",capabilities:["inputs","native_enhance_prompt"]},{id:"alibaba/qwen-image-2.0-pro",label:"Qwen Image 2.0 Pro",capabilities:["inputs","native_enhance_prompt"]},{id:"bytedance/seedream-5.0-lite",label:"Seedream 5.0 Lite",capabilities:["inputs"]},{id:"black-forest-labs/flux.1-dev",label:"FLUX.1 Dev",capabilities:["mynth_magic_prompt"]},{id:"black-forest-labs/flux-1-schnell",label:"FLUX.1 Schnell",capabilities:["mynth_magic_prompt"]},{id:"tongyi-mai/z-image-turbo",label:"Z Image Turbo",capabilities:["mynth_magic_prompt"]},{id:"black-forest-labs/flux.2-dev",label:"FLUX.2 Dev",capabilities:["inputs","mynth_magic_prompt"]},{id:"black-forest-labs/flux.2-pro",label:"FLUX.2 Pro",capabilities:["inputs"]},{id:"black-forest-labs/flux.2-flex",label:"FLUX.2 Flex",capabilities:["inputs"]},{id:"black-forest-labs/flux.2-max",label:"FLUX.2 Max",capabilities:["inputs"]},{id:"black-forest-labs/flux.2-klein-4b",label:"FLUX.2 Klein 4B",capabilities:["inputs"]},{id:"john6666/bismuth-illustrious-mix",label:"Bismuth Illustrious Mix",capabilities:["mynth_magic_prompt","negative_prompt"]},{id:"purplesmartai/pony-diffusion-v6-xl",label:"Pony Diffusion V6 XL",capabilities:["negative_prompt"]},{id:"recraft/recraft-v4",label:"Recraft V4",capabilities:[]},{id:"recraft/recraft-v4-pro",label:"Recraft V4 Pro",capabilities:[]},{id:"google/gemini-3.1-flash-image",label:"Nano Banana 2",capabilities:["inputs","4k","native_enhance_prompt","native_auto_size"]},{id:"google/gemini-3-pro-image-preview",label:"Nano Banana Pro",capabilities:["4k","native_enhance_prompt"]},{id:"imagineart/imagineart-1.5-pro",label:"ImagineArt 1.5 Pro",capabilities:["4k"]},{id:"openai/gpt-image-2",label:"GPT Image 2",capabilities:["inputs"]},{id:"wan/wan2.6-image",label:"Wan 2.6 Image",capabilities:[]},{id:"xai/grok-imagine-image",label:"Grok Imagine Image",capabilities:["inputs","native_auto_size"]}];class w extends Error{status;code;constructor(J,Q,Z){super(J);this.name="MynthAPIError",this.status=Q,this.code=Z}}class j{apiKey;baseUrl;constructor(J){this.apiKey=J.apiKey,this.baseUrl=J.baseUrl?J.baseUrl.endsWith("/")?J.baseUrl.slice(0,-1):J.baseUrl:q}getAuthHeaders(J){return{Authorization:`Bearer ${J?.accessToken??this.apiKey}`}}getUrl(J){return`${this.baseUrl}${J}`}async post(J,Q){let Z=await fetch(this.getUrl(J),{method:"POST",headers:{"Content-Type":"application/json",...this.getAuthHeaders()},body:JSON.stringify(Q)}),$=await Z.json();if(!Z.ok){let x=$,B=x.error||x.message||`Request failed with status ${Z.status}`;throw new w(B,Z.status,x.code)}return $}async get(J,{headers:Q,accessToken:Z}={}){let $=await fetch(this.getUrl(J),{headers:{...this.getAuthHeaders({accessToken:Z}),...Q}});return{data:await $.json(),status:$.status,ok:$.ok}}}class H{data;constructor(J){this.data=J}get id(){return this.data.id}get status(){return this.data.status}get result(){return this.data.result}get isCompleted(){return this.data.status==="completed"}get isFailed(){return this.data.status==="failed"}get urls(){return this.data.result?.images.filter((J)=>J.status==="success").map((J)=>J.url).filter((J)=>J!==null)??[]}getImages(J={}){if(J.includeFailed)return this.data.result?.images??[];return this.data.result?.images.filter((Q)=>Q.status==="success")??[]}getMetadata(){return this.data.request?.metadata}}class Y{taskId;task;results;constructor(J){this.task=J.task,this.taskId=J.task.id,this.results=J.results}getRatings(){return this.results.filter((J)=>J.status==="success")}getErrors(){return this.results.filter((J)=>J.status==="failed")}}var z=300000,m=12000,h=2500,k=5000,E=7;class D extends Error{constructor(J){super(`Task ${J} polling timed out after ${z}ms`);this.name="TaskAsyncTimeoutError"}}class W extends Error{constructor(J){super(`Unauthorized access to task ${J}`);this.name="TaskAsyncUnauthorizedError"}}class f extends Error{constructor(J,Q){super(`Failed to fetch status for task ${J} after multiple retries`);this.name="TaskAsyncFetchError",this.cause=Q}}class V extends Error{constructor(J,Q){let Z=Q?` (status ${Q})`:"";super(`Failed to fetch task ${J}${Z}`);this.name="TaskAsyncTaskFetchError"}}class C extends Error{constructor(J){super(`Task ${J} failed during generation`);this.name="TaskAsyncTaskFailedError"}}class b{id;client;_access;resultFactory;_completionPromise=null;constructor(J,Q){this.id=J,this.client=Q.client,this._access={publicAccessToken:Q.pat},this.resultFactory=Q.resultFactory}get access(){return this._access}toString(){return this.id}async wait(){if(!this._completionPromise)this._completionPromise=this.pollUntilCompleted();return this._completionPromise}async pollUntilCompleted(){let J=Date.now(),Q=0,Z=!1,$;while(!0){let x=Date.now()-J;if(x>=z)throw new D(this.id);let B=await this.fetchStatus(Z);if(B.ok){if(Q=0,B.status==="completed"){let M=await this.fetchTask();return this.resultFactory(M)}if(B.status==="failed")throw new C(this.id)}else{if(B.unauthorized){if(this._access.publicAccessToken&&!Z){Z=!0;continue}throw new W(this.id)}if(B.retryable){if(Q++,$=B.error,Q>=E)throw new f(this.id,$)}}let N=x<m?h:k,P=Math.random()*500,R=N+P,L=z-x,g=Math.min(R,L);await this.sleep(g)}}async fetchStatus(J){let Q=J||!this._access.publicAccessToken?void 0:this._access.publicAccessToken;try{let Z=await this.client.get(F(this.id),{accessToken:Q});if(Z.ok)return{ok:!0,status:Z.data.status};if(Z.status===401||Z.status===403)return{ok:!1,unauthorized:!0,retryable:!1};if(Z.status===404)return{ok:!1,unauthorized:!0,retryable:!1};if(Z.status>=500)return{ok:!1,unauthorized:!1,retryable:!0};return{ok:!1,unauthorized:!1,retryable:!1}}catch(Z){return{ok:!1,unauthorized:!1,retryable:!0,error:Z instanceof Error?Z:Error(String(Z))}}}async fetchTask(){let J=await this.client.get(O(this.id));if(J.ok)return J.data;if(J.status===401||J.status===403)throw new W(this.id);if(J.status===404)throw new W(this.id);throw new V(this.id,J.status)}sleep(J){return new Promise((Q)=>setTimeout(Q,J))}}function I(){if(typeof process<"u"&&process.env)return process.env[X];return}function y(){if(typeof process<"u"&&process.env)return process.env[v];return}class S{client;defaultDestination;constructor(J={}){let Q=J.apiKey??I();if(!Q)throw Error(`Mynth API key is required. Either pass it as an option or set the ${X} environment variable.`);this.defaultDestination=J.destination??y(),this.client=new j({apiKey:Q,baseUrl:J.baseUrl})}async generate(J){return(await this.createGenerationTask(J)).wait()}async generateAsync(J){return this.createGenerationTask(J)}async createGenerationTask(J){let Q=await this.client.post(G,{...J,destination:J.destination??this.defaultDestination});return new b(Q.taskId,{client:this.client,pat:Q.access?.publicAccessToken,resultFactory:($)=>new H($)})}async rate(J){let Q=await this.client.post(K,J);return new Y(Q)}}class U{image;constructor(J={}){this.image=new S(J)}}var e=U;export{e as default,W as TaskAsyncUnauthorizedError,D as TaskAsyncTimeoutError,V as TaskAsyncTaskFetchError,C as TaskAsyncTaskFailedError,f as TaskAsyncFetchError,b as TaskAsync,S as MynthImage,w as MynthAPIError,U as Mynth,Y as ImageRateResult,H as ImageGenerationResult,_ as AVAILABLE_MODELS};
package/dist/types.d.ts CHANGED
@@ -3,108 +3,71 @@
3
3
  * Import as `import type { MynthSDKTypes } from "@mynthio/sdk"`.
4
4
  */
5
5
  export declare namespace MynthSDKTypes {
6
- /** Status of a generation task */
7
6
  type TaskStatus = "pending" | "completed" | "failed";
8
- /** Type of task */
9
7
  type TaskType = "image.generate" | "image.rate";
10
- /** Full task data returned from the API */
11
- type TaskData = {
12
- /** Unique task identifier */
8
+ type TaskBase = {
13
9
  id: string;
14
- /** Current status of the task */
15
10
  status: TaskStatus;
16
- /** Type of task */
17
- type: TaskType;
18
- /** ID of the API key used (null for public access) */
19
11
  apiKeyId: string | null;
20
- /** ID of the user who created the task */
21
12
  userId: string;
22
- /** Total cost in string format (null if not yet calculated) */
23
13
  cost: string | null;
24
- /** Generation result (null if not completed) */
25
- result: ImageResult | null;
26
- /** Original generation request (null if not available) */
27
- request: ImageGenerationRequest;
28
- /** ISO 8601 timestamp of creation */
29
14
  createdAt: string;
30
- /** ISO 8601 timestamp of last update */
31
15
  updatedAt: string;
16
+ errors?: TaskError[];
32
17
  };
33
- /** Available model identifiers */
34
- type ImageGenerationModelId = "alibaba/qwen-image-2.0" | "alibaba/qwen-image-2.0-pro" | "bytedance/seedream-5.0-lite" | "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" | "google/gemini-3.1-flash-image" | "google/gemini-3-pro-image-preview" | "imagineart/imagineart-1.5-pro" | "tongyi-mai/z-image-turbo" | "john6666/bismuth-illustrious-mix" | "purplesmartai/pony-diffusion-v6-xl" | "recraft/recraft-v4" | "recraft/recraft-v4-pro" | "wan/wan2.6-image" | "xai/grok-imagine-image";
35
- /** Model to use for generation ("auto" lets the system choose) */
36
- type ImageGenerationModel = ImageGenerationModelId | "auto";
37
- /** Prompt enhancement mode for structured prompts */
38
- type ImageGenerationRequestEnhance = false | "prefer_magic" | "prefer_native";
39
- /** Structured prompt with positive and optional negative text */
40
- type PromptStructured = {
41
- /** Main prompt describing what to generate */
42
- positive: string;
43
- /** Elements to exclude from the generation */
44
- negative?: string;
45
- /** Prompt enhancement mode */
46
- enhance: ImageGenerationRequestEnhance;
18
+ type TaskError = {
19
+ code: string;
47
20
  };
21
+ type TaskData = (TaskBase & {
22
+ type: "image.generate";
23
+ request: ImageGenerationRequest;
24
+ result: ImageResult | null;
25
+ }) | (TaskBase & {
26
+ type: "image.rate";
27
+ request: ImageRateRequest;
28
+ result: ImageRateTaskResult | null;
29
+ });
30
+ type ImageGenerationTaskData = Extract<TaskData, {
31
+ type: "image.generate";
32
+ }>;
33
+ type ImageGenerationModelId = "alibaba/qwen-image-2.0" | "alibaba/qwen-image-2.0-pro" | "bytedance/seedream-5.0-lite" | "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" | "google/gemini-3.1-flash-image" | "google/gemini-3-pro-image-preview" | "imagineart/imagineart-1.5-pro" | "openai/gpt-image-2" | "tongyi-mai/z-image-turbo" | "john6666/bismuth-illustrious-mix" | "purplesmartai/pony-diffusion-v6-xl" | "recraft/recraft-v4" | "recraft/recraft-v4-pro" | "wan/wan2.6-image" | "xai/grok-imagine-image";
34
+ type ImageGenerationModel = ImageGenerationModelId | "auto";
48
35
  type GenerateImageOptionsIn = {
49
- prompt: string | PromptStructured;
36
+ prompt: string;
50
37
  };
51
38
  type GenerateImageOptions = {
52
- prompt: PromptStructured;
39
+ prompt: string;
53
40
  };
54
- /**
55
- * Prompt input for image generation.
56
- * Can be a simple string or structured with positive/negative prompts.
57
- */
58
41
  type ImageGenerationRequestPrompt = GenerateImageOptionsIn["prompt"];
59
- /** Output image format */
60
42
  type ImageGenerationRequestOutputFormat = "png" | "jpg" | "webp";
61
- /** Output configuration for generated images */
62
43
  type ImageGenerationRequestOutput = {
63
- /** Image format (default: "webp") */
64
- format?: ImageGenerationRequestOutputFormat;
65
- /** Quality 0-100 (default: 80) */
66
- quality?: number;
44
+ format: ImageGenerationRequestOutputFormat;
45
+ quality: number;
67
46
  };
68
- /** Custom webhook endpoint configuration */
69
47
  type ImageGenerationRequestCustomWebhook = {
70
- /** URL to receive webhook notifications */
71
48
  url: string;
72
- };
73
- /** Public Access Token configuration */
49
+ }[];
74
50
  type ImageGenerationRequestAccessPat = {
75
- /** Include a short-lived Public Access Token in the create-task response */
76
51
  enabled?: boolean;
77
52
  };
78
- /** Access-token configuration returned from the create-task response */
79
53
  type ImageGenerationRequestAccess = {
80
- /** Controls whether the response includes a task-scoped Public Access Token */
81
54
  pat: ImageGenerationRequestAccessPat;
82
55
  };
83
- /** Webhook configuration */
84
56
  type ImageGenerationRequestWebhook = {
85
- /** Enable/disable webhooks (disabling overrides dashboard settings) */
86
- enabled?: boolean;
87
- /** Additional custom webhook endpoints */
88
- custom?: ImageGenerationRequestCustomWebhook[];
57
+ dashboard?: false;
58
+ custom?: ImageGenerationRequestCustomWebhook;
89
59
  };
90
- /** Custom content rating level definition */
91
- type ImageGenerationRequestContentRatingLevel<T extends string = string> = {
92
- /** Level identifier returned in the result */
60
+ type ImageGenerationRequestRatingLevel<T extends string = string> = {
93
61
  value: T;
94
- /** Human-readable description for the AI classifier */
95
62
  description: string;
96
63
  };
97
- /** Content rating configuration */
98
- type ImageGenerationRequestContentRating = {
99
- /** Enable content rating classification */
100
- enabled?: boolean;
101
- /** Custom rating levels (uses default sfw/nsfw if not provided) */
102
- levels?: readonly ImageGenerationRequestContentRatingLevel[];
64
+ type ImageGenerationRequestRating = true | ImageRateRequestRatingDefault | {
65
+ mode: "custom";
66
+ levels: readonly ImageGenerationRequestRatingLevel[];
103
67
  };
104
68
  /** Available shorthand size presets */
105
- type ImageGenerationRequestSizePreset = "square" | "portrait" | "landscape" | "portrait_tall" | "landscape_wide" | "1:1" | "2:3" | "3:2" | "3:4" | "4:3" | "4:5" | "5:4" | "9:16" | "16:9" | "21:9" | "2:1" | "1:2" | "1:1_4k" | "2:3_4k" | "3:2_4k" | "3:4_4k" | "4:3_4k" | "4:5_4k" | "5:4_4k" | "9:16_4k" | "16:9_4k" | "21:9_4k" | "2:1_4k" | "1:2_4k";
106
- /** Optional 4k scale for aspect ratio size mode */
107
- type ImageGenerationRequestSizeScale = "4k";
69
+ type ImageGenerationRequestSizePreset = "square" | "portrait" | "landscape" | "portrait_tall" | "landscape_wide" | "square_4k" | "portrait_4k" | "landscape_4k" | "portrait_tall_4k" | "landscape_wide_4k" | "1:1" | "2:3" | "3:2" | "3:4" | "4:3" | "4:5" | "5:4" | "9:16" | "16:9" | "21:9" | "2:1" | "1:2" | "1:1_4k" | "2:3_4k" | "3:2_4k" | "3:4_4k" | "4:3_4k" | "4:5_4k" | "5:4_4k" | "9:16_4k" | "16:9_4k" | "21:9_4k" | "2:1_4k" | "1:2_4k";
70
+ type ImageGenerationRequestSizeScale = "base" | "4k";
108
71
  /** Supported aspect ratio strings */
109
72
  type ImageGenerationRequestAspectRatio = "1:1" | "2:3" | "3:2" | "3:4" | "4:3" | "4:5" | "5:4" | "9:16" | "16:9" | "21:9" | "2:1" | "1:2";
110
73
  /** Structured aspect ratio size configuration */
@@ -116,15 +79,14 @@ export declare namespace MynthSDKTypes {
116
79
  /** Structured auto size configuration */
117
80
  type ImageGenerationRequestSizeAuto = {
118
81
  type: "auto";
119
- prefer: "mynth" | "native";
82
+ provider?: "mynth" | "native";
120
83
  };
121
84
  /** Image input source */
122
85
  type ImageGenerationRequestInputSource = {
123
86
  type: "url";
124
87
  url: string;
125
88
  };
126
- /** Supported input roles */
127
- type ImageGenerationRequestInputRole = "context" | "init" | "reference";
89
+ type ImageGenerationRequestInputRole = "auto" | "init" | "reference";
128
90
  /** Structured image input */
129
91
  type ImageGenerationRequestInput = {
130
92
  type: "image";
@@ -140,112 +102,72 @@ export declare namespace MynthSDKTypes {
140
102
  * Image generation request parameters.
141
103
  */
142
104
  type ImageGenerationRequest = {
143
- /** Text prompt or structured prompt object */
144
105
  prompt: ImageGenerationRequestPrompt;
145
- /** Model to use (default: "auto") */
106
+ negative_prompt?: string;
107
+ magic_prompt?: true;
146
108
  model?: ImageGenerationModel;
147
- /** Image size/dimensions (default: "auto") */
148
109
  size?: ImageGenerationRequestSize;
149
- /** Number of images to generate (default: 1) */
150
110
  count?: number;
151
- /** Output format and quality settings */
152
111
  output?: ImageGenerationRequestOutput;
153
- /** Webhook notification settings */
154
112
  webhook?: ImageGenerationRequestWebhook;
155
- /** Content rating classification settings */
156
- content_rating?: ImageGenerationRequestContentRating;
157
- /** Public Access Token response configuration */
113
+ rating?: ImageGenerationRequestRating;
158
114
  access?: ImageGenerationRequestAccess;
159
- /** Optional input images as URL shortcuts or structured objects */
160
115
  inputs?: (string | ImageGenerationRequestInput)[];
161
- /** Custom metadata to attach (returned in results and webhooks). Max 2KB. */
162
116
  metadata?: Record<string, unknown>;
163
- /** Name (slug) of a user-configured destination to deliver the result to */
164
117
  destination?: string;
165
118
  };
166
- /** Default content rating levels */
167
- type ImageResultContentRatingDefaultLevel = "sfw" | "nsfw";
168
- /** Content rating result */
169
- type ImageResultContentRating = {
170
- mode: "default";
171
- level: ImageResultContentRatingDefaultLevel;
119
+ type ImageResultRatingDefaultLevel = "sfw" | "nsfw";
120
+ type ImageResultRatingFailure = {
121
+ status: "failed";
122
+ error: {
123
+ code: string;
124
+ };
125
+ };
126
+ type ImageResultRating = {
127
+ status: "success";
128
+ level: ImageResultRatingDefaultLevel;
172
129
  } | {
173
- mode: "custom";
130
+ status: "success";
174
131
  level: string;
132
+ } | ImageResultRatingFailure;
133
+ type ImageResultDestination = {
134
+ status: "success";
135
+ name: string;
136
+ } | {
137
+ status: "failed";
138
+ name: string;
139
+ error: {
140
+ code: string;
141
+ message?: string;
142
+ provider_response?: string;
143
+ };
175
144
  };
176
- /** Successfully generated image */
177
145
  type ImageResultImageSuccess = {
178
- status: "succeeded";
179
- /** Image ID */
146
+ status: "success";
180
147
  id: string;
181
- /**
182
- * Delivery URL of the generated image.
183
- * `null` when the image was delivered only to a user destination and no public URL is exposed.
184
- */
185
148
  url: string | null;
186
- /** Mynth CDN URL of the generated image (always present on success) */
187
149
  mynth_url: string;
188
- /** Resolved output image size (for example: "1024x1024") */
189
- size?: string;
190
- /** Cost for this image in string format */
150
+ size: string;
191
151
  cost: string;
192
- /** Content rating if classification was enabled */
193
- content_rating?: ImageResultContentRating;
152
+ destination?: ImageResultDestination;
153
+ rating?: ImageResultRating;
194
154
  };
195
- /** Failed image generation */
196
155
  type ImageResultImageFailure = {
197
156
  status: "failed";
198
- /** Error message describing the failure */
199
- error: string;
200
- /** Mynth CDN URL, if the image was produced before the failure */
201
- mynth_url?: string;
157
+ error: {
158
+ code: string;
159
+ message?: string;
160
+ };
202
161
  };
203
- /** Individual image result (success or failure) */
204
162
  type ImageResultImage = ImageResultImageSuccess | ImageResultImageFailure;
205
- /** Cost breakdown for the generation */
206
- type ImageResultCost = {
207
- /** Cost of image generation */
208
- images: string;
209
- /** Total task cost */
210
- total: string;
211
- /** Reserved for future prompt-enhancement pricing metadata */
212
- magic_prompt?: string;
213
- };
214
- /** Auto size resolution info (when size was determined automatically) */
215
- type ImageResultSizeAuto = {
216
- /** Source that determined the size */
217
- source: "native" | "mynth";
218
- /** Resolved size value (e.g. "1024x1024") */
219
- value?: string;
220
- };
221
- /** Prompt enhancement info (when prompt was enhanced) */
222
- type ImageResultPromptEnhance = {
223
- /** Source that performed the enhancement */
224
- source: "native" | "mynth";
225
- /** Enhanced positive prompt */
226
- positive?: string;
227
- /** Enhanced negative prompt */
163
+ type ImageResultMagicPrompt = {
164
+ positive: string;
228
165
  negative?: string;
229
166
  };
230
- /** Destination delivery info (present when a destination was used) */
231
- type ImageResultDestination = {
232
- /** Destination name (slug) that images were delivered to */
233
- name: string;
234
- };
235
- /** Complete generation result */
236
167
  type ImageResult = {
237
- /** Array of generated images (may include failures) */
238
- images: ImageResultImage[];
239
- /** Destination info, present when generation was delivered to a user destination */
240
- destination?: ImageResultDestination;
241
- /** Cost breakdown */
242
- cost: ImageResultCost;
243
- /** Model that was used */
244
168
  model: ImageGenerationModelId;
245
- /** Auto size resolution info (present when size was determined automatically) */
246
- size_auto?: ImageResultSizeAuto;
247
- /** Prompt enhancement info (present when prompt was enhanced) */
248
- prompt_enhance?: ImageResultPromptEnhance;
169
+ images: ImageResultImage[];
170
+ magic_prompt?: ImageResultMagicPrompt;
249
171
  };
250
172
  /**
251
173
  * Webhook payload for task completion
@@ -280,28 +202,44 @@ export declare namespace MynthSDKTypes {
280
202
  description: string;
281
203
  };
282
204
  /** Request body for the image rate endpoint */
283
- type ImageRateRequest = {
205
+ type ImageRateRequestBase = {
284
206
  /** Image URLs to rate (1–10) */
285
207
  urls: string[];
286
- /** Custom rating levels (uses default sfw/nsfw if not provided) */
287
- levels?: readonly ImageRateRequestLevel[];
288
208
  };
209
+ type ImageRateRequestRatingDefault = {
210
+ /** Default sfw/nsfw classifier */
211
+ mode: "nsfw_sfw";
212
+ };
213
+ type ImageRateRequestRatingCustom = {
214
+ /** Custom classifier levels */
215
+ mode: "custom";
216
+ levels: readonly ImageRateRequestLevel[];
217
+ };
218
+ type ImageRateRequest = ImageRateRequestBase & (ImageRateRequestRatingDefault | ImageRateRequestRatingCustom);
289
219
  /** A successfully rated image */
290
220
  type ImageRateResponseItemSuccess<LevelT extends string = string> = {
291
- /** The submitted image URL */
221
+ status: "success";
292
222
  url: string;
293
- /** The assigned rating level */
294
- rating: LevelT;
223
+ level: LevelT;
295
224
  };
296
- /** An image that could not be rated */
297
225
  type ImageRateResponseItemError = {
298
- error_code: string;
226
+ status: "failed";
227
+ url: string;
228
+ error: {
229
+ code: string;
230
+ };
299
231
  };
300
232
  /** Individual rating result item */
301
233
  type ImageRateResponseItem<LevelT extends string = string> = ImageRateResponseItemSuccess<LevelT> | ImageRateResponseItemError;
302
234
  /** API response from the image rate endpoint */
303
235
  type ImageRateResponse<LevelT extends string = string> = {
304
- taskId: string;
236
+ task: {
237
+ id: string;
238
+ cost: string;
239
+ };
240
+ results: ImageRateResponseItem<LevelT>[];
241
+ };
242
+ type ImageRateTaskResult<LevelT extends string = string> = {
305
243
  results: ImageRateResponseItem<LevelT>[];
306
244
  };
307
245
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,yBAAiB,aAAa,CAAC;IAC7B,kCAAkC;IAClC,KAAY,UAAU,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;IAE5D,mBAAmB;IACnB,KAAY,QAAQ,GAAG,gBAAgB,GAAG,YAAY,CAAC;IAEvD,2CAA2C;IAC3C,KAAY,QAAQ,GAAG;QACrB,6BAA6B;QAC7B,EAAE,EAAE,MAAM,CAAC;QACX,iCAAiC;QACjC,MAAM,EAAE,UAAU,CAAC;QACnB,mBAAmB;QACnB,IAAI,EAAE,QAAQ,CAAC;QACf,sDAAsD;QACtD,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;QACxB,0CAA0C;QAC1C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AA4B,CAAC,MAAM,CAAC,GACpC,0BAA0B,CAAC;IAE/B,gDAAgD;IAChD,KAAY,iBAAiB,CAAC,MAAM,SAAS,MAAM,GAAG,MAAM,IAAI;QAC9D,IAAI,EAAE;YACJ,EAAE,EAAE,MAAM,CAAC;YACX,IAAI,EAAE,MAAM,CAAC;SACd,CAAC;QACF,OAAO,EAAE,qBAAqB,CAAC,MAAM,CAAC,EAAE,CAAC;KAC1C,CAAC;IAEF,KAAY,mBAAmB,CAAC,MAAM,SAAS,MAAM,GAAG,MAAM,IAAI;QAChE,OAAO,EAAE,qBAAqB,CAAC,MAAM,CAAC,EAAE,CAAC;KAC1C,CAAC;CACH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mynthio/sdk",
3
- "version": "0.0.14",
3
+ "version": "0.0.16",
4
4
  "description": "Official Mynth SDK for image generation",
5
5
  "keywords": [
6
6
  "ai",