@mynthio/sdk 0.0.4 → 0.0.6

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,394 @@
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
53
66
 
54
- ## Async Mode
67
+ ## Sync vs Async
55
68
 
56
- Sometimes you don't want to wait for the task, and you just want to trigger generation. For example:
69
+ ### Sync Mode
57
70
 
58
- - You use webhooks to save data, and you just trigger generation
59
- - You want to poll for images on client side
71
+ Sync mode is the default. It polls until the task is completed.
60
72
 
61
- ```typescript
62
- import { mynth } from "./lib/mynth";
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
63
84
 
85
+ Use async mode when you want to trigger work now and fetch the final task later.
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.
104
+
105
+ You can use it as a Bearer token against:
79
106
 
80
- ```typescript
81
- import { mynth } from "./lib/mynth";
107
+ - `GET /tasks/:id/status`
108
+ - `GET /tasks/:id/results`
82
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: "john6666/bismuth-illustrious-mix",
161
+ size: {
162
+ type: "aspect_ratio",
163
+ aspectRatio: "4:5",
164
+ scale: "2k",
129
165
  },
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
166
+ count: 2,
133
167
  output: {
134
- format: "webp", // Default "webp", Examples: "png", "jpg", "webp"
168
+ format: "webp",
135
169
  quality: 80,
136
- upscale: 2, // 2x or 4x upscaling
137
170
  },
138
171
  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" }],
172
+ enabled: true,
173
+ custom: [{ url: "https://your-app.com/api/mynth-webhook" }],
141
174
  },
142
- /**
143
- * Single level deep metadata you can attach. It will be send with webhook and returned with result.
144
- */
175
+ content_rating: {
176
+ enabled: true,
177
+ levels: [
178
+ { value: "safe", description: "Safe for all audiences" },
179
+ { value: "sensitive", description: "Contains mature or suggestive content" },
180
+ ],
181
+ },
182
+ inputs: [
183
+ "https://example.com/reference-1.jpg",
184
+ {
185
+ type: "image",
186
+ role: "reference",
187
+ source: {
188
+ type: "url",
189
+ url: "https://example.com/reference-2.jpg",
190
+ },
191
+ },
192
+ ],
145
193
  metadata: {
146
- internalGenerationId: "gen_123",
147
- userId: "user_...",
194
+ generationId: "gen_123",
195
+ userId: "user_123",
196
+ },
197
+ });
198
+ ```
199
+
200
+ ## Prompt Options
201
+
202
+ `prompt` can be:
203
+
204
+ - a string
205
+ - a structured object with `positive`, optional `negative`, and `enhance`
206
+
207
+ ```ts
208
+ prompt: {
209
+ positive: "A luxury watch on a marble pedestal",
210
+ negative: "text, watermark",
211
+ enhance: false,
212
+ }
213
+ ```
214
+
215
+ `enhance` accepts:
216
+
217
+ - `false`
218
+ - `"prefer_magic"`
219
+ - `"prefer_native"`
220
+
221
+ ## Size Options
222
+
223
+ `size` supports:
224
+
225
+ - presets: `"instagram"`, `"square"`, `"portrait"`, `"landscape"`
226
+ - compact resolution strings like `"1536x1024"`
227
+ - `"auto"`
228
+ - structured objects
229
+
230
+ Examples:
231
+
232
+ ```ts
233
+ size: "landscape";
234
+ size: "1024x1024";
235
+ size: { type: "resolution", width: 1440, height: 960, mode: "strict" };
236
+ size: { type: "aspect_ratio", aspectRatio: "16:9", scale: "2k" };
237
+ size: { type: "auto", prefer: "native" };
238
+ ```
239
+
240
+ ## Input Images
241
+
242
+ Use `inputs` to send reference, context, or init images:
243
+
244
+ ```ts
245
+ inputs: [
246
+ "https://example.com/context-image.jpg",
247
+ {
248
+ type: "image",
249
+ role: "reference",
250
+ source: {
251
+ type: "url",
252
+ url: "https://example.com/reference-image.jpg",
253
+ },
148
254
  },
255
+ ];
256
+ ```
257
+
258
+ String URLs are a shorthand for image inputs. Structured inputs let you control the role explicitly with `"context"`, `"init"`, or `"reference"`.
259
+
260
+ ## Working With Results
261
+
262
+ Completed tasks expose a few helpful accessors:
263
+
264
+ ```ts
265
+ const task = await mynth.generate({
266
+ prompt: "An orange cat astronaut on the moon",
267
+ metadata: { source: "readme-example" },
149
268
  });
269
+
270
+ console.log(task.id);
271
+ console.log(task.status);
272
+ console.log(task.isCompleted);
273
+ console.log(task.urls);
274
+ console.log(task.getImages());
275
+ console.log(task.getImages({ includeFailed: true }));
276
+ console.log(task.getMetadata());
277
+ console.log(task.result?.prompt_enhance);
278
+ ```
279
+
280
+ `task.urls` and `task.getImages()` return only successful images by default. `task.result?.images` may also include failed image entries.
281
+
282
+ ## Available Models
283
+
284
+ The SDK exports `AVAILABLE_MODELS`, which mirrors the current model list and capability metadata shipped with the package.
285
+
286
+ ```ts
287
+ import { AVAILABLE_MODELS } from "@mynthio/sdk";
288
+
289
+ const model = AVAILABLE_MODELS.find((item) => item.id === "google/gemini-3.1-flash-image");
290
+
291
+ console.log(model);
292
+ // {
293
+ // id: "google/gemini-3.1-flash-image",
294
+ // label: "Nano Banana 2",
295
+ // capabilities: ["inputs", "enhance_prompt", "auto_size"]
296
+ // }
297
+ ```
298
+
299
+ Current model IDs include:
300
+
301
+ - `auto`
302
+ - `alibaba/qwen-image-2.0`
303
+ - `alibaba/qwen-image-2.0-pro`
304
+ - `bytedance/seedream-5.0-lite`
305
+ - `black-forest-labs/flux.1-dev`
306
+ - `black-forest-labs/flux-1-schnell`
307
+ - `black-forest-labs/flux.2-dev`
308
+ - `black-forest-labs/flux.2-klein-4b`
309
+ - `google/gemini-3.1-flash-image`
310
+ - `google/gemini-3-pro-image-preview`
311
+ - `tongyi-mai/z-image-turbo`
312
+ - `john6666/bismuth-illustrious-mix`
313
+ - `wan/wan2.6-image`
314
+ - `xai/grok-imagine-image`
315
+
316
+ ## TypeScript Types
317
+
318
+ The SDK exports the request and payload types via `MynthSDKTypes`.
319
+
320
+ ```ts
321
+ import type { MynthSDKTypes } from "@mynthio/sdk";
322
+
323
+ const request: MynthSDKTypes.ImageGenerationRequest = {
324
+ prompt: "Minimal product shot of a glass bottle",
325
+ model: "auto",
326
+ };
150
327
  ```
151
328
 
152
329
  ## Convex Integration
153
330
 
154
- The SDK includes a Convex webhook handler for easy integration:
331
+ The package includes a Convex HTTP action helper for webhook verification and event routing.
155
332
 
156
- ```typescript
333
+ ```ts
157
334
  import { mynthWebhookAction } from "@mynthio/sdk/convex";
158
335
 
159
336
  export const mynthWebhook = mynthWebhookAction({
160
337
  imageTaskCompleted: async (payload, { context }) => {
161
- console.log("Image generated:", payload.result.images);
338
+ console.log("Completed task:", payload.task.id);
339
+ console.log(payload.result.images);
340
+ },
341
+ imageTaskFailed: async (payload) => {
342
+ console.error("Mynth task failed:", payload.task.id);
162
343
  },
163
344
  });
164
345
  ```
165
346
 
166
- Set `MYNTH_WEBHOOK_SECRET` in your environment variables.
347
+ Set `MYNTH_WEBHOOK_SECRET` in your environment, or pass `webhookSecret` explicitly as the second argument to `mynthWebhookAction(...)`.
167
348
 
168
349
  ## Error Handling
169
350
 
170
- ```typescript
351
+ `generate()` may throw `MynthAPIError` if the initial request fails. Async polling can also throw task-specific errors:
352
+
353
+ ```ts
171
354
  import {
172
- Mynth,
355
+ MynthAPIError,
356
+ TaskAsyncFetchError,
357
+ TaskAsyncTaskFailedError,
358
+ TaskAsyncTaskFetchError,
173
359
  TaskAsyncTimeoutError,
174
360
  TaskAsyncUnauthorizedError,
175
- TaskAsyncFetchError,
176
361
  } from "@mynthio/sdk";
177
362
 
178
363
  try {
179
- const task = await mynth.generate({ ... });
364
+ const taskAsync = await mynth.generate({ prompt: "A watercolor landscape" }, { mode: "async" });
365
+
366
+ const task = await taskAsync.toTask();
367
+ console.log(task.urls);
180
368
  } catch (error) {
181
- if (error instanceof TaskAsyncTimeoutError) {
369
+ if (error instanceof MynthAPIError) {
370
+ console.error(error.status, error.code, error.message);
371
+ } else if (error instanceof TaskAsyncTimeoutError) {
182
372
  console.error("Task polling timed out");
183
373
  } else if (error instanceof TaskAsyncUnauthorizedError) {
184
- console.error("Invalid API key or access denied");
374
+ console.error("Task access was denied");
185
375
  } else if (error instanceof TaskAsyncFetchError) {
186
- console.error("Network error while polling task status");
376
+ console.error("Repeated status fetch failures");
377
+ } else if (error instanceof TaskAsyncTaskFailedError) {
378
+ console.error("The generation task failed");
379
+ } else if (error instanceof TaskAsyncTaskFetchError) {
380
+ console.error("Fetching the completed task failed");
187
381
  }
188
382
  }
189
383
  ```
190
384
 
191
385
  ## Documentation
192
386
 
193
- For full documentation, visit [docs.mynth.io](https://docs.mynth.io).
387
+ For product documentation and API guides, visit [docs.mynth.io](https://docs.mynth.io).
194
388
 
195
389
  ## Contributing
196
390
 
197
- See [CONTRIBUTING.md](./CONTRIBUTING.md) for development setup, commit message rules (Conventional Commits), and how the automated release process works.
391
+ See [CONTRIBUTING.md](./CONTRIBUTING.md) for development setup, Conventional Commits guidance, and release process notes.
198
392
 
199
393
  ## License
200
394
 
@@ -8,11 +8,17 @@ export declare const TASK_DETAILS_PATH: (id: string) => string;
8
8
  export declare const TASK_STATUS_PATH: (id: string) => string;
9
9
  /**
10
10
  * Model capabilities that affect available generation options.
11
- * - `magic_prompt`: Supports automatic prompt enhancement
11
+ * - `mynth_magic_prompt`: Supports Mynth-side prompt enhancement
12
+ * - `enhance_prompt`: Supports provider-native prompt enhancement
13
+ * - `inputs`: Supports reference/input images
14
+ * - `custom_resolution`: Supports custom width/height requests
12
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
13
19
  * - `steps`: Supports custom inference step count
14
20
  */
15
- export type ModelCapability = "magic_prompt" | "negative_prompt" | "steps";
21
+ export type ModelCapability = "steps" | "inputs" | "custom_resolution" | "mynth_magic_prompt" | "enhance_prompt" | "negative_prompt" | "cfg_scale" | "scheduler" | "auto_size";
16
22
  /**
17
23
  * Information about an available image generation model.
18
24
  */
@@ -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;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,cAAc,GAAG,iBAAiB,GAAG,OAAO,CAAC;AAE3E;;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,EA6DrD,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;;;;;;;;;;;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,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:"bytedance/seedream-5.0-lite",label:"Seedream 5.0 Lite",capabilities:[]},{id:"black-forest-labs/flux.1-dev",label:"FLUX.1 Dev",capabilities:["magic_prompt","steps"]},{id:"black-forest-labs/flux-1-schnell",label:"FLUX.1 Schnell",capabilities:["magic_prompt"]},{id:"tongyi-mai/z-image-turbo",label:"Z Image Turbo",capabilities:["magic_prompt","steps"]},{id:"black-forest-labs/flux.2-dev",label:"FLUX.2 Dev",capabilities:["magic_prompt","steps"]},{id:"black-forest-labs/flux.2-klein-4b",label:"FLUX.2 Klein 4B",capabilities:[]},{id:"john6666/bismuth-illustrious-mix",label:"Bismuth Illustrious Mix",capabilities:["magic_prompt","negative_prompt","steps"]},{id:"google/gemini-3.1-flash-image",label:"Nano Banana 2",capabilities:[]},{id:"google/gemini-3-pro-image-preview",label:"Nano Banana Pro",capabilities:[]},{id:"wan/wan2.6-image",label:"Wan 2.6 Image",capabilities:[]},{id:"xai/grok-imagine-image",label:"Grok Imagine Image",capabilities:[]}];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","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:"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","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};
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 = "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 */
@@ -56,14 +56,6 @@ export declare namespace MynthSDKTypes {
56
56
  * Can be a simple string or structured with positive/negative prompts.
57
57
  */
58
58
  type ImageGenerationRequestPrompt = GenerateImageOptionsIn["prompt"];
59
- /** Access configuration for the generated task */
60
- type ImageGenerationRequestAccess = {
61
- /** Public access token configuration */
62
- pat: {
63
- /** Generate a public access token for client-side polling */
64
- enabled?: boolean;
65
- };
66
- };
67
59
  /** Output image format */
68
60
  type ImageGenerationRequestOutputFormat = "png" | "jpg" | "webp";
69
61
  /** Output configuration for generated images */
@@ -155,8 +147,6 @@ export declare namespace MynthSDKTypes {
155
147
  count?: number;
156
148
  /** Output format and quality settings */
157
149
  output?: ImageGenerationRequestOutput;
158
- /** Public access token configuration */
159
- access?: ImageGenerationRequestAccess;
160
150
  /** Webhook notification settings */
161
151
  webhook?: ImageGenerationRequestWebhook;
162
152
  /** Content rating classification settings */
@@ -184,9 +174,7 @@ export declare namespace MynthSDKTypes {
184
174
  /** CDN URL of the generated image */
185
175
  url: string;
186
176
  /** Resolved output image size (for example: "1024x1024") */
187
- size?: `${number}x${number}`;
188
- /** Provider that generated the image */
189
- provider: string;
177
+ size?: string;
190
178
  /** Cost for this image in string format */
191
179
  cost: string;
192
180
  /** Content rating if classification was enabled */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["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A0B;QAC1B,KAAK,EAAE,sBAAsB,CAAC;QAC9B,iFAAiF;QACjF,SAAS,CAAC,EAAE,mBAAmB,CAAC;QAChC,iEAAiE;QACjE,cAAc,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.4",
3
+ "version": "0.0.6",
4
4
  "description": "Official Mynth SDK for image generation",
5
5
  "keywords": [
6
6
  "ai",