@mynthio/sdk 0.0.5 → 0.0.7

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
@@ -1,200 +1,419 @@
1
1
  # @mynthio/sdk
2
2
 
3
- Official SDK for the [Mynth](https://mynth.io) AI image generation API.
3
+ Official SDK for the [Mynth](https://mynth.io) image generation API.
4
+
5
+ The SDK gives you a typed `Mynth` client, sync and async generation flows, model metadata, and a Convex webhook helper.
4
6
 
5
7
  ## Installation
6
8
 
7
9
  ```bash
8
- // Bun
10
+ # Bun
9
11
  bun add @mynthio/sdk
10
12
 
11
- // PNPM
13
+ # pnpm
12
14
  pnpm add @mynthio/sdk
13
15
 
14
- // NPM
16
+ # npm
15
17
  npm install @mynthio/sdk
16
18
 
17
- // Yarn
19
+ # yarn
18
20
  yarn add @mynthio/sdk
19
21
  ```
20
22
 
21
23
  ## Quick Start
22
24
 
23
- Add `MYNTH_API_KEY` to your environment variables:
25
+ Set your API key:
24
26
 
25
27
  ```env
26
28
  MYNTH_API_KEY=mak_...
27
29
  ```
28
30
 
29
- Create mynth client. For example inside `/lib`
31
+ Create a client:
30
32
 
31
- ```typescript
32
- // lib/mynth.ts
33
+ ```ts
33
34
  import Mynth from "@mynthio/sdk";
34
35
 
35
- export const mynth = new Mynth();
36
+ const mynth = new Mynth();
36
37
  ```
37
38
 
38
- Use client to generate images:
39
-
40
- ```typescript
41
- import { mynth } from "./lib/mynth";
39
+ Generate an image:
42
40
 
43
- // Generate an image (by default it waits for completion)
41
+ ```ts
44
42
  const task = await mynth.generate({
45
- prompt: "A beautiful sunset over mountains",
46
- model: "black-forest-labs/flux.1-dev",
43
+ prompt: "A fox in a neon-lit city at night",
47
44
  });
48
45
 
49
- console.log(task.result.images);
46
+ console.log(task.id);
47
+ console.log(task.urls);
48
+ console.log(task.result?.model);
49
+ ```
50
+
51
+ If you omit `model` and `size`, Mynth resolves them automatically. By default, `generate()` waits for completion and returns a completed task.
52
+
53
+ ## Client Options
54
+
55
+ ```ts
56
+ import Mynth from "@mynthio/sdk";
57
+
58
+ const mynth = new Mynth({
59
+ apiKey: process.env.MYNTH_API_KEY,
60
+ baseUrl: "https://api.mynth.io",
61
+ });
50
62
  ```
51
63
 
52
- Under the hood we poll for the status of the task, waiting until it's completed. When it's done, the `Task` instance is returned.
64
+ - `apiKey`: optional if `MYNTH_API_KEY` is set
65
+ - `baseUrl`: optional override for proxies or tests
66
+
67
+ ## Sync vs Async
53
68
 
54
- ## Async Mode
69
+ ### Sync Mode
55
70
 
56
- Sometimes you don't want to wait for the task, and you just want to trigger generation. For example:
71
+ Sync mode is the default. It polls until the task is completed.
57
72
 
58
- - You use webhooks to save data, and you just trigger generation
59
- - You want to poll for images on client side
73
+ ```ts
74
+ const task = await mynth.generate({
75
+ prompt: "Editorial product photo of a matte black coffee grinder",
76
+ model: "black-forest-labs/flux.2-dev",
77
+ });
78
+
79
+ console.log(task.status); // "completed"
80
+ console.log(task.urls);
81
+ ```
82
+
83
+ ### Async Mode
60
84
 
61
- ```typescript
62
- import { mynth } from "./lib/mynth";
85
+ Use async mode when you want to trigger work now and fetch the final task later.
63
86
 
87
+ ```ts
64
88
  const taskAsync = await mynth.generate(
65
89
  {
66
- prompt: "A futuristic cityscape",
67
- model: "black-forest-labs/flux.1-dev",
90
+ prompt: "A cinematic fantasy castle on a cliff",
91
+ model: "google/gemini-3.1-flash-image",
68
92
  },
69
93
  { mode: "async" },
70
94
  );
71
95
 
72
- console.log("Task started:", taskAsync.id);
96
+ console.log(taskAsync.id);
97
+ console.log(taskAsync.access.publicAccessToken);
73
98
 
74
- // If you want to to get the result later, use .toTask()
75
99
  const completedTask = await taskAsync.toTask();
100
+ console.log(completedTask.urls);
76
101
  ```
77
102
 
78
- Async mode is especially useful for a client side polling. We support public access tokens, and fetching statuses from client side:
103
+ `taskAsync.access.publicAccessToken` is safe to send to the client. It is scoped to that single task, so you can poll task state from the browser without exposing your API key or building your own polling proxy.
79
104
 
80
- ```typescript
81
- import { mynth } from "./lib/mynth";
105
+ You can use it as a Bearer token against:
82
106
 
107
+ - `GET /tasks/:id/status`
108
+ - `GET /tasks/:id/results`
109
+
110
+ Example:
111
+
112
+ ```ts
83
113
  const taskAsync = await mynth.generate(
84
114
  {
85
- prompt: "A futuristic cityscape",
86
- model: "black-forest-labs/flux.1-dev",
115
+ prompt: "A cinematic fantasy castle on a cliff",
116
+ model: "google/gemini-3.1-flash-image",
87
117
  },
88
118
  { mode: "async" },
89
119
  );
90
120
 
91
- return {
92
- id: taskAsync.id,
93
- access: taskAsync.access;
94
- }
121
+ const taskId = taskAsync.id;
122
+ const pat = taskAsync.access.publicAccessToken;
95
123
 
96
- // In frontend:
97
- // TODO: Do proper example for SWR
98
- const { data, error, isLoading } = useSWR(`/api/tasks/${response.id}/images`, fetcher, {
99
- refreshInterval: 1000 // Poll every 1 second
100
- // Token
101
- })
102
- ```
124
+ const status = await fetch(`https://api.mynth.io/tasks/${taskId}/status`, {
125
+ headers: {
126
+ Authorization: `Bearer ${pat}`,
127
+ },
128
+ }).then((res) => res.json());
103
129
 
104
- ## Available Models
130
+ if (status.status === "completed") {
131
+ const results = await fetch(`https://api.mynth.io/tasks/${taskId}/results`, {
132
+ headers: {
133
+ Authorization: `Bearer ${pat}`,
134
+ },
135
+ }).then((res) => res.json());
105
136
 
106
- We provide a helpful object with all supported models, including display names and capabilities so you can use it for validation or generating UIs.
137
+ console.log(results.images);
138
+ }
139
+ ```
107
140
 
108
- ```typescript
109
- import { AVAILABLE_MODELS } from "@mynthio/sdk";
141
+ ## Request Shape
142
+
143
+ `generate()` accepts a typed `ImageGenerationRequest`. The simplest request is just a prompt:
110
144
 
111
- console.log(AVAILABLE_MODELS);
112
- // [
113
- // {
114
- // id: "black-forest-labs/flux.1-dev",
115
- // label: "FLUX.1 Dev",
116
- // capabilities: ["magic_prompt", "steps"],
117
- // },
118
- // ...
145
+ ```ts
146
+ await mynth.generate({
147
+ prompt: "A cozy cabin in a snowy pine forest",
148
+ });
119
149
  ```
120
150
 
121
- ## Request Options
151
+ You can also pass structured options:
122
152
 
123
- ```typescript
153
+ ```ts
124
154
  const task = await mynth.generate({
125
155
  prompt: {
126
- positive: "A serene lake at dawn",
127
- negative: "people, buildings", // Will be used only if supported by model
128
- magic: false, // Default `true`
156
+ positive: "Studio portrait of a futuristic fashion model",
157
+ negative: "blurry, low detail",
158
+ enhance: "prefer_magic",
159
+ },
160
+ model: "google/gemini-3-pro-image-preview",
161
+ size: {
162
+ type: "aspect_ratio",
163
+ aspectRatio: "4:5",
129
164
  },
130
- model: "black-forest-labs/flux.1-dev",
131
- size: "landscape", //Default: "auto", Examples: "portrait", "square", "instagram", { width: 1024, height: 768 }
132
- count: 1, // Default 1
165
+ count: 2,
133
166
  output: {
134
- format: "webp", // Default "webp", Examples: "png", "jpg", "webp"
167
+ format: "webp",
135
168
  quality: 80,
136
- upscale: 2, // 2x or 4x upscaling
137
169
  },
138
170
  webhook: {
139
- enabled: true, // Setting to false will disable webhooks set in dashboard and webhooks configured as `custom` in request
140
- custom: [{ url: "https://your-webhook.com/endpoint" }],
171
+ enabled: true,
172
+ custom: [{ url: "https://your-app.com/api/mynth-webhook" }],
173
+ },
174
+ access: {
175
+ pat: {
176
+ enabled: true,
177
+ },
141
178
  },
142
- /**
143
- * Single level deep metadata you can attach. It will be send with webhook and returned with result.
144
- */
179
+ content_rating: {
180
+ enabled: true,
181
+ levels: [
182
+ { value: "safe", description: "Safe for all audiences" },
183
+ { value: "sensitive", description: "Contains mature or suggestive content" },
184
+ ],
185
+ },
186
+ inputs: [
187
+ "https://example.com/reference-1.jpg",
188
+ {
189
+ type: "image",
190
+ role: "reference",
191
+ source: {
192
+ type: "url",
193
+ url: "https://example.com/reference-2.jpg",
194
+ },
195
+ },
196
+ ],
145
197
  metadata: {
146
- internalGenerationId: "gen_123",
147
- userId: "user_...",
198
+ generationId: "gen_123",
199
+ userId: "user_123",
148
200
  },
149
201
  });
150
202
  ```
151
203
 
204
+ `access.pat.enabled` controls whether the create-task response includes a short-lived Public Access Token for browser-side polling. It defaults to `true`.
205
+
206
+ ## Prompt Options
207
+
208
+ `prompt` can be:
209
+
210
+ - a string
211
+ - a structured object with `positive`, optional `negative`, and `enhance`
212
+
213
+ ```ts
214
+ prompt: {
215
+ positive: "A luxury watch on a marble pedestal",
216
+ negative: "text, watermark",
217
+ enhance: false,
218
+ }
219
+ ```
220
+
221
+ `enhance` accepts:
222
+
223
+ - `false`
224
+ - `"prefer_magic"`
225
+ - `"prefer_native"`
226
+
227
+ ## Size Options
228
+
229
+ `size` supports:
230
+
231
+ - presets such as `"square"`, `"portrait"`, `"landscape"`, `"portrait_tall"`, `"landscape_wide"`, and the explicit aspect-ratio preset IDs
232
+ - `"auto"`
233
+ - structured auto objects
234
+ - structured aspect-ratio objects with an optional `scale: "4k"`
235
+
236
+ Supported aspect ratios:
237
+
238
+ - `"1:1"`
239
+ - `"2:3"`
240
+ - `"3:2"`
241
+ - `"3:4"`
242
+ - `"4:3"`
243
+ - `"4:5"`
244
+ - `"5:4"`
245
+ - `"9:16"`
246
+ - `"16:9"`
247
+ - `"21:9"`
248
+ - `"2:1"`
249
+ - `"1:2"`
250
+
251
+ Use `scale: "4k"` when you want the higher tier and the model supports it.
252
+
253
+ Examples:
254
+
255
+ ```ts
256
+ size: "landscape";
257
+ size: "auto";
258
+ size: { type: "aspect_ratio", aspectRatio: "16:9" };
259
+ size: { type: "aspect_ratio", aspectRatio: "4:5", scale: "4k" };
260
+ size: { type: "auto", prefer: "native" };
261
+ ```
262
+
263
+ ## Input Images
264
+
265
+ Use `inputs` to send reference, context, or init images:
266
+
267
+ ```ts
268
+ inputs: [
269
+ "https://example.com/context-image.jpg",
270
+ {
271
+ type: "image",
272
+ role: "reference",
273
+ source: {
274
+ type: "url",
275
+ url: "https://example.com/reference-image.jpg",
276
+ },
277
+ },
278
+ ];
279
+ ```
280
+
281
+ String URLs are a shorthand for image inputs. Structured inputs let you control the role explicitly with `"context"`, `"init"`, or `"reference"`.
282
+
283
+ ## Working With Results
284
+
285
+ Completed tasks expose a few helpful accessors:
286
+
287
+ ```ts
288
+ const task = await mynth.generate({
289
+ prompt: "An orange cat astronaut on the moon",
290
+ metadata: { source: "readme-example" },
291
+ });
292
+
293
+ console.log(task.id);
294
+ console.log(task.status);
295
+ console.log(task.isCompleted);
296
+ console.log(task.urls);
297
+ console.log(task.getImages());
298
+ console.log(task.getImages({ includeFailed: true }));
299
+ console.log(task.getMetadata());
300
+ console.log(task.result?.prompt_enhance);
301
+ ```
302
+
303
+ `task.urls` and `task.getImages()` return only successful images by default. `task.result?.images` may also include failed image entries.
304
+
305
+ ## Available Models
306
+
307
+ The SDK exports `AVAILABLE_MODELS`, which mirrors the current model list and capability metadata shipped with the package.
308
+
309
+ ```ts
310
+ import { AVAILABLE_MODELS } from "@mynthio/sdk";
311
+
312
+ const model = AVAILABLE_MODELS.find((item) => item.id === "google/gemini-3.1-flash-image");
313
+
314
+ console.log(model);
315
+ // {
316
+ // id: "google/gemini-3.1-flash-image",
317
+ // label: "Nano Banana 2",
318
+ // capabilities: ["inputs", "4k", "native_enhance_prompt", "native_auto_size"]
319
+ // }
320
+ ```
321
+
322
+ Current model IDs include:
323
+
324
+ - `auto`
325
+ - `alibaba/qwen-image-2.0`
326
+ - `alibaba/qwen-image-2.0-pro`
327
+ - `bytedance/seedream-5.0-lite`
328
+ - `black-forest-labs/flux.1-dev`
329
+ - `black-forest-labs/flux-1-schnell`
330
+ - `black-forest-labs/flux.2-dev`
331
+ - `black-forest-labs/flux.2-klein-4b`
332
+ - `google/gemini-3.1-flash-image`
333
+ - `google/gemini-3-pro-image-preview`
334
+ - `john6666/bismuth-illustrious-mix`
335
+ - `recraft/recraft-v4`
336
+ - `recraft/recraft-v4-pro`
337
+ - `tongyi-mai/z-image-turbo`
338
+ - `wan/wan2.6-image`
339
+ - `xai/grok-imagine-image`
340
+
341
+ ## TypeScript Types
342
+
343
+ The SDK exports the request and payload types via `MynthSDKTypes`.
344
+
345
+ ```ts
346
+ import type { MynthSDKTypes } from "@mynthio/sdk";
347
+
348
+ const request: MynthSDKTypes.ImageGenerationRequest = {
349
+ prompt: "Minimal product shot of a glass bottle",
350
+ model: "auto",
351
+ };
352
+ ```
353
+
152
354
  ## Convex Integration
153
355
 
154
- The SDK includes a Convex webhook handler for easy integration:
356
+ The package includes a Convex HTTP action helper for webhook verification and event routing.
155
357
 
156
- ```typescript
358
+ ```ts
157
359
  import { mynthWebhookAction } from "@mynthio/sdk/convex";
158
360
 
159
361
  export const mynthWebhook = mynthWebhookAction({
160
362
  imageTaskCompleted: async (payload, { context }) => {
161
- console.log("Image generated:", payload.result.images);
363
+ console.log("Completed task:", payload.task.id);
364
+ console.log(payload.result.images);
365
+ },
366
+ imageTaskFailed: async (payload) => {
367
+ console.error("Mynth task failed:", payload.task.id);
162
368
  },
163
369
  });
164
370
  ```
165
371
 
166
- Set `MYNTH_WEBHOOK_SECRET` in your environment variables.
372
+ Set `MYNTH_WEBHOOK_SECRET` in your environment, or pass `webhookSecret` explicitly as the second argument to `mynthWebhookAction(...)`.
167
373
 
168
374
  ## Error Handling
169
375
 
170
- ```typescript
376
+ `generate()` may throw `MynthAPIError` if the initial request fails. Async polling can also throw task-specific errors:
377
+
378
+ ```ts
171
379
  import {
172
- Mynth,
380
+ MynthAPIError,
381
+ TaskAsyncFetchError,
382
+ TaskAsyncTaskFailedError,
383
+ TaskAsyncTaskFetchError,
173
384
  TaskAsyncTimeoutError,
174
385
  TaskAsyncUnauthorizedError,
175
- TaskAsyncFetchError,
176
386
  } from "@mynthio/sdk";
177
387
 
178
388
  try {
179
- const task = await mynth.generate({ ... });
389
+ const taskAsync = await mynth.generate({ prompt: "A watercolor landscape" }, { mode: "async" });
390
+
391
+ const task = await taskAsync.toTask();
392
+ console.log(task.urls);
180
393
  } catch (error) {
181
- if (error instanceof TaskAsyncTimeoutError) {
394
+ if (error instanceof MynthAPIError) {
395
+ console.error(error.status, error.code, error.message);
396
+ } else if (error instanceof TaskAsyncTimeoutError) {
182
397
  console.error("Task polling timed out");
183
398
  } else if (error instanceof TaskAsyncUnauthorizedError) {
184
- console.error("Invalid API key or access denied");
399
+ console.error("Task access was denied");
185
400
  } else if (error instanceof TaskAsyncFetchError) {
186
- console.error("Network error while polling task status");
401
+ console.error("Repeated status fetch failures");
402
+ } else if (error instanceof TaskAsyncTaskFailedError) {
403
+ console.error("The generation task failed");
404
+ } else if (error instanceof TaskAsyncTaskFetchError) {
405
+ console.error("Fetching the completed task failed");
187
406
  }
188
407
  }
189
408
  ```
190
409
 
191
410
  ## Documentation
192
411
 
193
- For full documentation, visit [docs.mynth.io](https://docs.mynth.io).
412
+ For product documentation and API guides, visit [docs.mynth.io](https://docs.mynth.io).
194
413
 
195
414
  ## Contributing
196
415
 
197
- See [CONTRIBUTING.md](./CONTRIBUTING.md) for development setup, commit message rules (Conventional Commits), and how the automated release process works.
416
+ See [CONTRIBUTING.md](./CONTRIBUTING.md) for development setup, Conventional Commits guidance, and release process notes.
198
417
 
199
418
  ## License
200
419
 
@@ -9,16 +9,12 @@ export declare const TASK_STATUS_PATH: (id: string) => string;
9
9
  /**
10
10
  * Model capabilities that affect available generation options.
11
11
  * - `mynth_magic_prompt`: Supports Mynth-side prompt enhancement
12
- * - `enhance_prompt`: Supports provider-native prompt enhancement
13
12
  * - `inputs`: Supports reference/input images
14
- * - `custom_resolution`: Supports custom width/height requests
15
- * - `negative_prompt`: Supports negative prompts to exclude elements
16
- * - `cfg_scale`: Supports custom CFG scale
17
- * - `scheduler`: Supports custom scheduler selection
18
- * - `auto_size`: Supports provider-driven auto sizing
19
- * - `steps`: Supports custom inference step count
13
+ * - `4k`: Supports 4k resolution output
14
+ * - `native_enhance_prompt`: Supports provider-native prompt enhancement
15
+ * - `native_auto_size`: Supports provider-driven auto sizing
20
16
  */
21
- export type ModelCapability = "steps" | "inputs" | "custom_resolution" | "mynth_magic_prompt" | "enhance_prompt" | "negative_prompt" | "cfg_scale" | "scheduler" | "auto_size";
17
+ export type ModelCapability = "inputs" | "mynth_magic_prompt" | "4k" | "native_enhance_prompt" | "native_auto_size";
22
18
  /**
23
19
  * Information about an available image generation model.
24
20
  */
@@ -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,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AACrD,eAAO,MAAM,SAAS,WAAW,CAAC;AAClC,eAAO,MAAM,iBAAiB,GAAI,IAAI,MAAM,WAAyB,CAAC;AACtE,eAAO,MAAM,gBAAgB,GAAI,IAAI,MAAM,WAAgC,CAAC;AAE5E;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,eAAe,GACvB,OAAO,GACP,QAAQ,GACR,mBAAmB,GACnB,oBAAoB,GACpB,gBAAgB,GAChB,iBAAiB,GACjB,WAAW,GACX,WAAW,GACX,WAAW,CAAC;AAEhB;;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,EAuErD,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,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AACrD,eAAO,MAAM,SAAS,WAAW,CAAC;AAClC,eAAO,MAAM,iBAAiB,GAAI,IAAI,MAAM,WAAyB,CAAC;AACtE,eAAO,MAAM,gBAAgB,GAAI,IAAI,MAAM,WAAgC,CAAC;AAE5E;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,GACvB,QAAQ,GACR,oBAAoB,GACpB,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,EAiFrD,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- var V="https://api.mynth.io",X="MYNTH_API_KEY",b="/image/generate";var v=(J)=>`/tasks/${J}`,G=(J)=>`/tasks/${J}/status`,P=[{id:"auto",label:"Auto",capabilities:[]},{id:"alibaba/qwen-image-2.0",label:"Qwen Image 2.0",capabilities:["inputs","enhance_prompt","custom_resolution"]},{id:"alibaba/qwen-image-2.0-pro",label:"Qwen Image 2.0 Pro",capabilities:["inputs","enhance_prompt","custom_resolution"]},{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:["steps","mynth_magic_prompt"]},{id:"black-forest-labs/flux-1-schnell",label:"FLUX.1 Schnell",capabilities:["steps","mynth_magic_prompt"]},{id:"tongyi-mai/z-image-turbo",label:"Z Image Turbo",capabilities:["steps","mynth_magic_prompt"]},{id:"black-forest-labs/flux.2-dev",label:"FLUX.2 Dev",capabilities:["mynth_magic_prompt"]},{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:["steps","negative_prompt","cfg_scale","scheduler","mynth_magic_prompt"]},{id:"google/gemini-3.1-flash-image",label:"Nano Banana 2",capabilities:["inputs","enhance_prompt","auto_size"]},{id:"google/gemini-3-pro-image-preview",label:"Nano Banana Pro",capabilities:["enhance_prompt"]},{id:"wan/wan2.6-image",label:"Wan 2.6 Image",capabilities:[]},{id:"xai/grok-imagine-image",label:"Grok Imagine Image",capabilities:["auto_size"]}];class Y extends Error{status;code;constructor(J,Q,Z){super(J);this.name="MynthAPIError",this.status=Q,this.code=Z}}class H{apiKey;baseUrl;constructor(J){this.apiKey=J.apiKey,this.baseUrl=J.baseUrl?J.baseUrl.endsWith("/")?J.baseUrl.slice(0,-1):J.baseUrl:V}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 Y(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 j{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)??[]}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}}var D=300000,g=12000,L=2500,M=5000,_=7;class f extends Error{constructor(J){super(`Task ${J} polling timed out after ${D}ms`);this.name="TaskAsyncTimeoutError"}}class W extends Error{constructor(J){super(`Unauthorized access to task ${J}`);this.name="TaskAsyncUnauthorizedError"}}class q extends Error{constructor(J,Q){super(`Failed to fetch status for task ${J} after multiple retries`);this.name="TaskAsyncFetchError",this.cause=Q}}class w extends Error{constructor(J,Q){let Z=Q?` (status ${Q})`:"";super(`Failed to fetch task ${J}${Z}`);this.name="TaskAsyncTaskFetchError"}}class z extends Error{constructor(J){super(`Task ${J} failed during generation`);this.name="TaskAsyncTaskFailedError"}}class C{id;client;_access;_completionPromise=null;constructor(J,Q){this.id=J,this.client=Q.client,this._access={publicAccessToken:Q.pat}}get access(){return this._access}toString(){return this.id}async toTask(){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>=D)throw new f(this.id);let B=await this.fetchStatus(Z);if(B.ok){if(Q=0,B.status==="completed"){let U=await this.fetchTask();return new j(U)}if(B.status==="failed")throw new z(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>=_)throw new q(this.id,$)}}let R=x<g?L:M,N=Math.random()*500,O=R+N,F=D-x,S=Math.min(O,F);await this.sleep(S)}}async fetchStatus(J){let Q=J||!this._access.publicAccessToken?void 0:this._access.publicAccessToken;try{let Z=await this.client.get(G(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(v(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 w(this.id,J.status)}sleep(J){return new Promise((Q)=>setTimeout(Q,J))}}function m(){if(typeof process<"u"&&process.env)return process.env[X];return}class K{client;constructor(J={}){let Q=J.apiKey??m();if(!Q)throw Error(`Mynth API key is required. Either pass it as an option or set the ${X} environment variable.`);this.client=new H({apiKey:Q,baseUrl:J.baseUrl})}async generate(J,Q={}){let Z=Q.mode??"sync",$=await this.client.post(b,J),x=new C($.taskId,{client:this.client,pat:$.access?.publicAccessToken});if(Z==="async")return x;return x.toTask()}}var i=K;export{i as default,W as TaskAsyncUnauthorizedError,f as TaskAsyncTimeoutError,w as TaskAsyncTaskFetchError,z as TaskAsyncTaskFailedError,q as TaskAsyncFetchError,Y as MynthAPIError,K as Mynth,P as AVAILABLE_MODELS};
2
+ var V="https://api.mynth.io",X="MYNTH_API_KEY",b="/image/generate";var v=(J)=>`/tasks/${J}`,G=(J)=>`/tasks/${J}/status`,P=[{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:["mynth_magic_prompt"]},{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"]},{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:"wan/wan2.6-image",label:"Wan 2.6 Image",capabilities:[]},{id:"xai/grok-imagine-image",label:"Grok Imagine Image",capabilities:["native_auto_size"]}];class Y extends Error{status;code;constructor(J,Q,Z){super(J);this.name="MynthAPIError",this.status=Q,this.code=Z}}class H{apiKey;baseUrl;constructor(J){this.apiKey=J.apiKey,this.baseUrl=J.baseUrl?J.baseUrl.endsWith("/")?J.baseUrl.slice(0,-1):J.baseUrl:V}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 Y(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 j{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)??[]}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}}var D=300000,g=12000,L=2500,M=5000,_=7;class f extends Error{constructor(J){super(`Task ${J} polling timed out after ${D}ms`);this.name="TaskAsyncTimeoutError"}}class W extends Error{constructor(J){super(`Unauthorized access to task ${J}`);this.name="TaskAsyncUnauthorizedError"}}class q extends Error{constructor(J,Q){super(`Failed to fetch status for task ${J} after multiple retries`);this.name="TaskAsyncFetchError",this.cause=Q}}class w extends Error{constructor(J,Q){let Z=Q?` (status ${Q})`:"";super(`Failed to fetch task ${J}${Z}`);this.name="TaskAsyncTaskFetchError"}}class z extends Error{constructor(J){super(`Task ${J} failed during generation`);this.name="TaskAsyncTaskFailedError"}}class C{id;client;_access;_completionPromise=null;constructor(J,Q){this.id=J,this.client=Q.client,this._access={publicAccessToken:Q.pat}}get access(){return this._access}toString(){return this.id}async toTask(){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>=D)throw new f(this.id);let B=await this.fetchStatus(Z);if(B.ok){if(Q=0,B.status==="completed"){let U=await this.fetchTask();return new j(U)}if(B.status==="failed")throw new z(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>=_)throw new q(this.id,$)}}let R=x<g?L:M,N=Math.random()*500,O=R+N,F=D-x,S=Math.min(O,F);await this.sleep(S)}}async fetchStatus(J){let Q=J||!this._access.publicAccessToken?void 0:this._access.publicAccessToken;try{let Z=await this.client.get(G(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(v(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 w(this.id,J.status)}sleep(J){return new Promise((Q)=>setTimeout(Q,J))}}function m(){if(typeof process<"u"&&process.env)return process.env[X];return}class K{client;constructor(J={}){let Q=J.apiKey??m();if(!Q)throw Error(`Mynth API key is required. Either pass it as an option or set the ${X} environment variable.`);this.client=new H({apiKey:Q,baseUrl:J.baseUrl})}async generate(J,Q={}){let Z=Q.mode??"sync",$=await this.client.post(b,J),x=new C($.taskId,{client:this.client,pat:$.access?.publicAccessToken});if(Z==="async")return x;return x.toTask()}}var i=K;export{i as default,W as TaskAsyncUnauthorizedError,f as TaskAsyncTimeoutError,w as TaskAsyncTaskFetchError,z as TaskAsyncTaskFailedError,q as TaskAsyncFetchError,Y as MynthAPIError,K as Mynth,P as AVAILABLE_MODELS};
package/dist/types.d.ts CHANGED
@@ -31,7 +31,7 @@ export declare namespace MynthSDKTypes {
31
31
  updatedAt: string;
32
32
  };
33
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-klein-4b" | "google/gemini-3.1-flash-image" | "google/gemini-3-pro-image-preview" | "tongyi-mai/z-image-turbo" | "john6666/bismuth-illustrious-mix" | "wan/wan2.6-image" | "xai/grok-imagine-image";
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-klein-4b" | "google/gemini-3.1-flash-image" | "google/gemini-3-pro-image-preview" | "tongyi-mai/z-image-turbo" | "john6666/bismuth-illustrious-mix" | "recraft/recraft-v4" | "recraft/recraft-v4-pro" | "wan/wan2.6-image" | "xai/grok-imagine-image";
35
35
  /** Model to use for generation ("auto" lets the system choose) */
36
36
  type ImageGenerationModel = ImageGenerationModelId | "auto";
37
37
  /** Prompt enhancement mode for structured prompts */
@@ -70,6 +70,16 @@ export declare namespace MynthSDKTypes {
70
70
  /** URL to receive webhook notifications */
71
71
  url: string;
72
72
  };
73
+ /** Public Access Token configuration */
74
+ type ImageGenerationRequestAccessPat = {
75
+ /** Include a short-lived Public Access Token in the create-task response */
76
+ enabled?: boolean;
77
+ };
78
+ /** Access-token configuration returned from the create-task response */
79
+ type ImageGenerationRequestAccess = {
80
+ /** Controls whether the response includes a task-scoped Public Access Token */
81
+ pat: ImageGenerationRequestAccessPat;
82
+ };
73
83
  /** Webhook configuration */
74
84
  type ImageGenerationRequestWebhook = {
75
85
  /** Enable/disable webhooks (disabling overrides dashboard settings) */
@@ -92,23 +102,16 @@ export declare namespace MynthSDKTypes {
92
102
  levels?: readonly ImageGenerationRequestContentRatingLevel[];
93
103
  };
94
104
  /** Available shorthand size presets */
95
- type ImageGenerationRequestSizePreset = "instagram" | "square" | "portrait" | "landscape";
96
- /** Scale used by aspect ratio size mode */
97
- type ImageGenerationRequestSizeScale = "0.5k" | "1k" | "2k" | "3k" | "4k" | "8k";
98
- /** Aspect ratio string (for example: "16:9") */
99
- type ImageGenerationRequestAspectRatio = string;
100
- /** Structured resolution size configuration */
101
- type ImageGenerationRequestSizeResolution = {
102
- type: "resolution";
103
- width: number;
104
- height: number;
105
- mode?: "strict" | "preset" | "aligned";
106
- };
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";
108
+ /** Supported aspect ratio strings */
109
+ 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";
107
110
  /** Structured aspect ratio size configuration */
108
111
  type ImageGenerationRequestSizeAspectRatio = {
109
112
  type: "aspect_ratio";
110
113
  aspectRatio: ImageGenerationRequestAspectRatio;
111
- scale: ImageGenerationRequestSizeScale;
114
+ scale?: ImageGenerationRequestSizeScale;
112
115
  };
113
116
  /** Structured auto size configuration */
114
117
  type ImageGenerationRequestSizeAuto = {
@@ -130,9 +133,9 @@ export declare namespace MynthSDKTypes {
130
133
  };
131
134
  /**
132
135
  * Image size specification.
133
- * Can be a preset name, compact resolution string, or structured size object.
136
+ * Can be a preset name, auto, or structured aspect-ratio size object with optional 4k scale.
134
137
  */
135
- type ImageGenerationRequestSize = ImageGenerationRequestSizePreset | `${number}x${number}` | ImageGenerationRequestSizeResolution | ImageGenerationRequestSizeAspectRatio | ImageGenerationRequestSizeAuto | "auto";
138
+ type ImageGenerationRequestSize = ImageGenerationRequestSizePreset | ImageGenerationRequestSizeAspectRatio | ImageGenerationRequestSizeAuto | "auto";
136
139
  /**
137
140
  * Image generation request parameters.
138
141
  */
@@ -151,6 +154,8 @@ export declare namespace MynthSDKTypes {
151
154
  webhook?: ImageGenerationRequestWebhook;
152
155
  /** Content rating classification settings */
153
156
  content_rating?: ImageGenerationRequestContentRating;
157
+ /** Public Access Token response configuration */
158
+ access?: ImageGenerationRequestAccess;
154
159
  /** Optional input images as URL shortcuts or structured objects */
155
160
  inputs?: (string | ImageGenerationRequestInput)[];
156
161
  /** Custom metadata to attach (returned in results and webhooks). Max 2KB. */
@@ -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,yDAAyD;IACzD,KAAY,QAAQ,GAAG,OAAO,CAAC;IAE/B,2CAA2C;IAC3C,KAAY,QAA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CAAC,EAAE,wBAAwB,CAAC;KAC3C,CAAC;IAEF;;OAEG;IACH,KAAY,gCAAgC,GAAG;QAC7C,IAAI,EAAE;YAAE,EAAE,EAAE,MAAM,CAAA;SAAE,CAAC;QACrB,KAAK,EAAE,sBAAsB,CAAC;QAC9B,MAAM,EAAE,WAAW,CAAC;QACpB,OAAO,EAAE,sBAAsB,CAAC;KACjC,CAAC;IAEF;;OAEG;IACH,KAAY,6BAA6B,GAAG;QAC1C,IAAI,EAAE;YAAE,EAAE,EAAE,MAAM,CAAA;SAAE,CAAC;QACrB,KAAK,EAAE,mBAAmB,CAAC;QAC3B,OAAO,EAAE,sBAAsB,CAAC;KACjC,CAAC;IAEF;;OAEG;IACH,KAAY,cAAc,GAAG,gCAAgC,GAAG,6BAA6B,CAAC;CAC/F"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mynthio/sdk",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "Official Mynth SDK for image generation",
5
5
  "keywords": [
6
6
  "ai",
@@ -47,8 +47,9 @@
47
47
  "typecheck": "tsc --noEmit"
48
48
  },
49
49
  "devDependencies": {
50
+ "@types/node": "^25.5.0",
50
51
  "convex": "^1.32.0",
51
- "typescript": "5.9.3",
52
+ "typescript": "6.0.2",
52
53
  "vitest": "^4.0.18"
53
54
  },
54
55
  "peerDependencies": {