@mynthio/sdk 0.0.40 → 0.0.41
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 +3 -3
- package/dist/convex/index.d.ts +39 -100
- package/dist/convex/index.js +41 -2
- package/dist/handler.d.ts +28 -0
- package/dist/handler.js +121 -0
- package/dist/index.d.ts +674 -360
- package/dist/index.js +1469 -2
- package/dist/next/index.d.ts +14 -24
- package/dist/next/index.js +25 -2
- package/dist/tanstack-start/index.d.ts +18 -23
- package/dist/tanstack-start/index.js +11 -2
- package/dist/types.d.ts +610 -660
- package/package.json +16 -21
- package/dist/client.d.ts +0 -41
- package/dist/client.d.ts.map +0 -1
- package/dist/constants.d.ts +0 -95
- package/dist/constants.d.ts.map +0 -1
- package/dist/convex/index.d.ts.map +0 -1
- package/dist/convex/utils.d.ts +0 -2
- package/dist/convex/utils.d.ts.map +0 -1
- package/dist/image-alt-result.d.ts +0 -19
- package/dist/image-alt-result.d.ts.map +0 -1
- package/dist/image-generation-result.d.ts +0 -58
- package/dist/image-generation-result.d.ts.map +0 -1
- package/dist/image-rate-result.d.ts +0 -21
- package/dist/image-rate-result.d.ts.map +0 -1
- package/dist/image-remove-background-result.d.ts +0 -24
- package/dist/image-remove-background-result.d.ts.map +0 -1
- package/dist/image-review-result.d.ts +0 -28
- package/dist/image-review-result.d.ts.map +0 -1
- package/dist/index-apss16tr.js +0 -3
- package/dist/index-ty295921.js +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/next/index.d.ts.map +0 -1
- package/dist/tanstack-start/index.d.ts.map +0 -1
- package/dist/task-async.d.ts +0 -95
- package/dist/task-async.d.ts.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/uploads.d.ts +0 -31
- package/dist/uploads.d.ts.map +0 -1
- package/dist/video-generation-result.d.ts +0 -46
- package/dist/video-generation-result.d.ts.map +0 -1
- package/dist/webhooks/utils.d.ts +0 -5
- package/dist/webhooks/utils.d.ts.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,34 +1,350 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { a as AvailableVideoModel, c as VideoResolutionTier, i as AvailableModel, n as AVAILABLE_MODELS, o as ModelCapability, r as AVAILABLE_VIDEO_MODELS, s as VideoInputRole, t as MynthSDKTypes } from "./types.js";
|
|
2
|
+
//#region src/client.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Error thrown when an API request fails.
|
|
5
|
+
*/
|
|
6
|
+
export declare class MynthAPIError extends Error {
|
|
7
|
+
/** HTTP status code of the failed request */
|
|
8
|
+
readonly status: number;
|
|
9
|
+
/** Error code from the API response, if available */
|
|
10
|
+
readonly code?: string | undefined;
|
|
11
|
+
constructor(message: string, status: number, code?: string);
|
|
12
|
+
}
|
|
13
|
+
type MynthClientRequestOptions = {
|
|
14
|
+
headers?: Record<string, string>;
|
|
15
|
+
accessToken?: string | undefined;
|
|
16
|
+
auth?: boolean | undefined;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Internal HTTP client for making API requests.
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
declare class MynthClient {
|
|
23
|
+
private readonly apiKey;
|
|
24
|
+
private readonly baseUrl;
|
|
25
|
+
constructor(options: {
|
|
26
|
+
apiKey?: string | undefined;
|
|
27
|
+
baseUrl?: string | undefined;
|
|
28
|
+
});
|
|
29
|
+
getAuthHeaders(override?: Omit<MynthClientRequestOptions, "headers">): Record<string, string>;
|
|
30
|
+
getUrl(path: string): string;
|
|
31
|
+
post<DataType>(path: string, data: unknown): Promise<DataType>;
|
|
32
|
+
get<DataType>(path: string, { headers, accessToken, auth }?: MynthClientRequestOptions): Promise<{
|
|
33
|
+
data: DataType;
|
|
34
|
+
status: number;
|
|
35
|
+
ok: boolean;
|
|
36
|
+
}>;
|
|
37
|
+
getOrThrow<DataType>(path: string, options?: MynthClientRequestOptions): Promise<DataType>;
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/image-alt-result.d.ts
|
|
41
|
+
/**
|
|
42
|
+
* Represents the result of a completed image alt text task.
|
|
43
|
+
*/
|
|
44
|
+
export declare class ImageAltResult {
|
|
45
|
+
/** The task ID created for this alt text request */
|
|
46
|
+
readonly taskId: string;
|
|
47
|
+
/** Cost charged for the completed task */
|
|
48
|
+
readonly cost: string;
|
|
49
|
+
/** Generated alt text */
|
|
50
|
+
readonly alt: string;
|
|
51
|
+
constructor(data: {
|
|
52
|
+
taskId: string;
|
|
53
|
+
cost: string;
|
|
54
|
+
alt: string;
|
|
55
|
+
});
|
|
56
|
+
static fromTaskData(data: MynthSDKTypes.ImageAltTaskData): ImageAltResult;
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/image-generation-result.d.ts
|
|
60
|
+
type TypedImageResultImageSuccess<RatingT> = Omit<MynthSDKTypes.ImageResultImageSuccess, "rating"> & {
|
|
61
|
+
rating?: RatingT;
|
|
62
|
+
};
|
|
63
|
+
type TypedImageResultImageFailure = MynthSDKTypes.ImageResultImageFailure;
|
|
64
|
+
type TypedImageResultImage<RatingT> = TypedImageResultImageSuccess<RatingT> | TypedImageResultImageFailure;
|
|
65
|
+
type TypedImageResult<RatingT> = Omit<MynthSDKTypes.ImageResult, "images"> & {
|
|
66
|
+
images: TypedImageResultImage<RatingT>[];
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Represents a completed image generation task.
|
|
70
|
+
*
|
|
71
|
+
* @template MetadataT - Type of the metadata attached to the request
|
|
72
|
+
* @template RatingT - Type of the rating response
|
|
73
|
+
*/
|
|
74
|
+
export declare class ImageGenerationResult<MetadataT = Record<string, unknown> | undefined, RatingT = MynthSDKTypes.ImageResultRating | undefined> {
|
|
75
|
+
/** Raw task data from the API */
|
|
76
|
+
readonly data: MynthSDKTypes.ImageGenerationTaskData;
|
|
77
|
+
constructor(data: MynthSDKTypes.ImageGenerationTaskData);
|
|
78
|
+
/** Unique identifier for this task */
|
|
79
|
+
get id(): string;
|
|
80
|
+
/** Current status of the task */
|
|
81
|
+
get status(): MynthSDKTypes.TaskStatus;
|
|
82
|
+
/**
|
|
83
|
+
* The generation result containing images, cost, and model info.
|
|
84
|
+
* Returns `null` if the task hasn't completed yet.
|
|
85
|
+
*/
|
|
86
|
+
get result(): TypedImageResult<RatingT> | null;
|
|
87
|
+
/** Whether the task completed successfully */
|
|
88
|
+
get isCompleted(): boolean;
|
|
89
|
+
/** Whether the task failed */
|
|
90
|
+
get isFailed(): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Get all successfully generated image URLs.
|
|
93
|
+
* Convenience method that extracts just the URLs from successful images.
|
|
94
|
+
* Images delivered only to a user destination may have a `null` url and are omitted here;
|
|
95
|
+
* use `getImages()` and read `mynth_url` to access the CDN URL directly.
|
|
96
|
+
*/
|
|
97
|
+
get urls(): string[];
|
|
98
|
+
/**
|
|
99
|
+
* Get generated images from the task result.
|
|
100
|
+
*
|
|
101
|
+
* @param options.includeFailed - If true, includes failed image results
|
|
102
|
+
* @returns Array of image results
|
|
103
|
+
*/
|
|
104
|
+
getImages(options: {
|
|
105
|
+
includeFailed: true;
|
|
106
|
+
}): TypedImageResultImage<RatingT>[];
|
|
107
|
+
getImages(options?: {
|
|
108
|
+
includeFailed?: false;
|
|
109
|
+
}): TypedImageResultImageSuccess<RatingT>[];
|
|
110
|
+
/**
|
|
111
|
+
* Get the metadata that was attached to the generation request.
|
|
112
|
+
*/
|
|
113
|
+
getMetadata(): MetadataT;
|
|
114
|
+
}
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region src/image-rate-result.d.ts
|
|
117
|
+
/**
|
|
118
|
+
* Represents the result of a completed image content rating task.
|
|
119
|
+
*
|
|
120
|
+
* @template LevelT - Union of possible rating level strings (e.g. `"sfw" | "nsfw"`)
|
|
121
|
+
*/
|
|
122
|
+
export declare class ImageRateResult<LevelT extends string = "sfw" | "nsfw"> {
|
|
123
|
+
/** The task ID created for this rating request */
|
|
124
|
+
readonly taskId: string;
|
|
125
|
+
/** Cost charged for the completed task */
|
|
126
|
+
readonly cost: string;
|
|
127
|
+
/** Assigned rating level */
|
|
128
|
+
readonly level: LevelT;
|
|
129
|
+
constructor(data: {
|
|
130
|
+
taskId: string;
|
|
131
|
+
cost: string;
|
|
132
|
+
level: LevelT;
|
|
133
|
+
});
|
|
134
|
+
static fromTaskData<LevelT extends string = "sfw" | "nsfw">(data: MynthSDKTypes.ImageRateTaskData): ImageRateResult<LevelT>;
|
|
135
|
+
}
|
|
136
|
+
//#endregion
|
|
137
|
+
//#region src/image-remove-background-result.d.ts
|
|
138
|
+
/**
|
|
139
|
+
* Represents the result of a completed image background removal task.
|
|
140
|
+
*
|
|
141
|
+
* @template MetadataT - Type of the metadata attached to the request
|
|
142
|
+
*/
|
|
143
|
+
export declare class ImageRemoveBackgroundResult<MetadataT = Record<string, unknown> | undefined> {
|
|
144
|
+
/** The task ID created for this request */
|
|
145
|
+
readonly taskId: string;
|
|
146
|
+
/** Cost charged for the completed task */
|
|
147
|
+
readonly cost: string;
|
|
148
|
+
/** The image with its background removed */
|
|
149
|
+
readonly image: MynthSDKTypes.ImageRemoveBackgroundResultImage;
|
|
150
|
+
/** Metadata attached to the request */
|
|
151
|
+
readonly metadata: MetadataT;
|
|
152
|
+
constructor(data: {
|
|
153
|
+
taskId: string;
|
|
154
|
+
cost: string;
|
|
155
|
+
image: MynthSDKTypes.ImageRemoveBackgroundResultImage;
|
|
156
|
+
metadata: MetadataT;
|
|
157
|
+
});
|
|
158
|
+
static fromTaskData<MetadataT = Record<string, unknown> | undefined>(data: MynthSDKTypes.ImageRemoveBackgroundTaskData): ImageRemoveBackgroundResult<MetadataT>;
|
|
159
|
+
}
|
|
160
|
+
//#endregion
|
|
161
|
+
//#region src/image-review-result.d.ts
|
|
162
|
+
/**
|
|
163
|
+
* Represents the result of a completed image quality review task.
|
|
164
|
+
*/
|
|
165
|
+
export declare class ImageReviewResult {
|
|
166
|
+
/** The task ID created for this review request */
|
|
167
|
+
readonly taskId: string;
|
|
168
|
+
/** Cost charged for the completed task */
|
|
169
|
+
readonly cost: string;
|
|
170
|
+
/** Median reviewer score from 1 to 4. Higher is better. */
|
|
171
|
+
readonly score: number;
|
|
172
|
+
/** Review summary */
|
|
173
|
+
readonly summary: string;
|
|
174
|
+
/** Defects found by the reviewer panel */
|
|
175
|
+
readonly findings: MynthSDKTypes.ImageReviewFinding[];
|
|
176
|
+
/** Strengths identified by the reviewer panel */
|
|
177
|
+
readonly strengths: MynthSDKTypes.ImageReviewStrength[];
|
|
178
|
+
constructor(data: {
|
|
179
|
+
taskId: string;
|
|
180
|
+
cost: string;
|
|
181
|
+
score: number;
|
|
182
|
+
summary: string;
|
|
183
|
+
findings: MynthSDKTypes.ImageReviewFinding[];
|
|
184
|
+
strengths: MynthSDKTypes.ImageReviewStrength[];
|
|
185
|
+
});
|
|
186
|
+
static fromTaskData(data: MynthSDKTypes.ImageReviewTaskData): ImageReviewResult;
|
|
187
|
+
}
|
|
188
|
+
//#endregion
|
|
189
|
+
//#region src/task-async.d.ts
|
|
190
|
+
/**
|
|
191
|
+
* Polling cadence overrides. Anything omitted keeps the image-task default.
|
|
192
|
+
*/
|
|
193
|
+
type TaskAsyncPolling = {
|
|
194
|
+
/** Total wait budget before `TaskAsyncTimeoutError`. */
|
|
195
|
+
timeoutMs?: number;
|
|
196
|
+
/** How long the opening fast-polling phase lasts. `0` disables it. */
|
|
197
|
+
fastDurationMs?: number;
|
|
198
|
+
/** Interval used during the fast phase. */
|
|
199
|
+
fastIntervalMs?: number;
|
|
200
|
+
/** Interval used after the fast phase. */
|
|
201
|
+
intervalMs?: number;
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
204
|
+
* Error thrown when task polling exceeds the maximum timeout duration.
|
|
205
|
+
*/
|
|
206
|
+
export declare class TaskAsyncTimeoutError extends Error {
|
|
207
|
+
constructor(taskId: string, timeoutMs?: number);
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Error thrown when access to a task is denied (invalid API key or PAT).
|
|
211
|
+
*/
|
|
212
|
+
export declare class TaskAsyncUnauthorizedError extends Error {
|
|
213
|
+
constructor(taskId: string);
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Error thrown when fetching task status fails after multiple retries.
|
|
217
|
+
*/
|
|
218
|
+
export declare class TaskAsyncFetchError extends Error {
|
|
219
|
+
constructor(taskId: string, cause?: Error);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Error thrown when fetching full task data fails.
|
|
223
|
+
*/
|
|
224
|
+
export declare class TaskAsyncTaskFetchError extends Error {
|
|
225
|
+
constructor(taskId: string, status?: number, cause?: Error);
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Error thrown when a task fails before completion.
|
|
229
|
+
*/
|
|
230
|
+
export declare class TaskAsyncTaskFailedError extends Error {
|
|
231
|
+
constructor(taskId: string);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Public access information for a task, used for client-side polling.
|
|
235
|
+
*/
|
|
236
|
+
type TaskAsyncAccess = {
|
|
237
|
+
/** Public access token for client-side status polling */
|
|
238
|
+
publicAccessToken?: string | undefined;
|
|
239
|
+
};
|
|
240
|
+
/**
|
|
241
|
+
* Represents an async task that can be polled for completion.
|
|
242
|
+
* Use `wait()` to poll until completion and get the typed result.
|
|
243
|
+
*
|
|
244
|
+
* @template ResultT - The result type returned once the task completes
|
|
245
|
+
*/
|
|
246
|
+
export declare class TaskAsync<ResultT> {
|
|
247
|
+
/** The unique identifier for this task */
|
|
248
|
+
readonly id: string;
|
|
249
|
+
private readonly client;
|
|
250
|
+
private readonly _access;
|
|
251
|
+
private readonly resultFactory;
|
|
252
|
+
private readonly polling;
|
|
253
|
+
private _completionPromise;
|
|
254
|
+
constructor(id: string, options: {
|
|
255
|
+
client: MynthClient;
|
|
256
|
+
pat?: string | undefined;
|
|
257
|
+
resultFactory: (data: MynthSDKTypes.TaskData) => ResultT;
|
|
258
|
+
polling?: TaskAsyncPolling;
|
|
259
|
+
});
|
|
260
|
+
/**
|
|
261
|
+
* Public access information for client-side polling.
|
|
262
|
+
* Contains the public access token if one was generated.
|
|
263
|
+
*/
|
|
264
|
+
get access(): TaskAsyncAccess;
|
|
265
|
+
toString(): string;
|
|
266
|
+
/**
|
|
267
|
+
* Polls the task until completion and returns the typed result.
|
|
268
|
+
* Multiple calls to this method return the same promise.
|
|
269
|
+
*
|
|
270
|
+
* @throws {TaskAsyncTimeoutError} If polling exceeds the timeout
|
|
271
|
+
* @throws {TaskAsyncUnauthorizedError} If access is denied
|
|
272
|
+
* @throws {TaskAsyncFetchError} If fetching status fails repeatedly
|
|
273
|
+
* @throws {TaskAsyncTaskFetchError} If fetching the completed task fails
|
|
274
|
+
* @throws {TaskAsyncTaskFailedError} If the task fails before completion
|
|
275
|
+
*/
|
|
276
|
+
wait(): Promise<ResultT>;
|
|
277
|
+
private pollUntilCompleted;
|
|
278
|
+
private fetchStatus;
|
|
279
|
+
private fetchTask;
|
|
280
|
+
private sleep;
|
|
281
|
+
}
|
|
282
|
+
//#endregion
|
|
283
|
+
//#region src/video-generation-result.d.ts
|
|
284
|
+
/**
|
|
285
|
+
* Represents a completed video generation task.
|
|
286
|
+
*
|
|
287
|
+
* @template MetadataT - Type of the metadata attached to the request
|
|
288
|
+
*/
|
|
289
|
+
export declare class VideoGenerationResult<MetadataT = Record<string, unknown> | undefined> {
|
|
290
|
+
/** Raw task data from the API */
|
|
291
|
+
readonly data: MynthSDKTypes.VideoGenerationTaskData;
|
|
292
|
+
constructor(data: MynthSDKTypes.VideoGenerationTaskData);
|
|
293
|
+
/** Unique identifier for this task */
|
|
294
|
+
get id(): string;
|
|
295
|
+
/** Current status of the task */
|
|
296
|
+
get status(): MynthSDKTypes.TaskStatus;
|
|
297
|
+
/**
|
|
298
|
+
* The generation result containing videos and model info.
|
|
299
|
+
* Returns `null` if the task hasn't completed yet.
|
|
300
|
+
*/
|
|
301
|
+
get result(): MynthSDKTypes.VideoResult | null;
|
|
302
|
+
/** Whether the task completed successfully */
|
|
303
|
+
get isCompleted(): boolean;
|
|
304
|
+
/** Whether the task failed */
|
|
305
|
+
get isFailed(): boolean;
|
|
306
|
+
/**
|
|
307
|
+
* Get all successfully generated video URLs.
|
|
308
|
+
* Convenience method that extracts just the URLs from successful videos.
|
|
309
|
+
*/
|
|
310
|
+
get urls(): string[];
|
|
311
|
+
/**
|
|
312
|
+
* Get generated videos from the task result.
|
|
313
|
+
*
|
|
314
|
+
* @param options.includeFailed - If true, includes failed video results
|
|
315
|
+
* @returns Array of video results
|
|
316
|
+
*/
|
|
317
|
+
getVideos(options: {
|
|
318
|
+
includeFailed: true;
|
|
319
|
+
}): MynthSDKTypes.VideoResultVideo[];
|
|
320
|
+
getVideos(options?: {
|
|
321
|
+
includeFailed?: false;
|
|
322
|
+
}): MynthSDKTypes.VideoResultVideoSuccess[];
|
|
323
|
+
/**
|
|
324
|
+
* Get the metadata that was attached to the generation request.
|
|
325
|
+
*/
|
|
326
|
+
getMetadata(): MetadataT;
|
|
327
|
+
}
|
|
328
|
+
//#endregion
|
|
329
|
+
//#region src/index.d.ts
|
|
14
330
|
/**
|
|
15
331
|
* Configuration options for the Mynth client.
|
|
16
332
|
*/
|
|
17
333
|
type MynthOptions = {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
334
|
+
/**
|
|
335
|
+
* Your Mynth API key. If not provided, reads from MYNTH_API_KEY environment variable.
|
|
336
|
+
*/
|
|
337
|
+
apiKey?: string | undefined;
|
|
338
|
+
/**
|
|
339
|
+
* Custom base URL for the API. Useful for proxies or testing.
|
|
340
|
+
*/
|
|
341
|
+
baseUrl?: string | undefined;
|
|
342
|
+
/**
|
|
343
|
+
* Default destination name (slug) to deliver generated images to.
|
|
344
|
+
* If not provided, reads from MYNTH_DESTINATION environment variable.
|
|
345
|
+
* Can be overridden on a per-request basis via `request.destination`.
|
|
346
|
+
*/
|
|
347
|
+
destination?: string | undefined;
|
|
32
348
|
};
|
|
33
349
|
type MynthModel = MynthSDKTypes.Model;
|
|
34
350
|
type MynthModelPricing = MynthSDKTypes.ModelPricing;
|
|
@@ -37,31 +353,31 @@ type ExtractVideoMetadata<T extends MynthSDKTypes.VideoGenerationClientRequest>
|
|
|
37
353
|
type ExtractRemoveBackgroundMetadata<T extends MynthSDKTypes.ImageRemoveBackgroundClientRequest> = T["metadata"];
|
|
38
354
|
type ExtractRatingConfig<T extends MynthSDKTypes.ImageGenerationClientRequest> = T["rating"];
|
|
39
355
|
type ExtractRatingLevels<T extends MynthSDKTypes.ImageGenerationClientRequest> = ExtractRatingConfig<T> extends {
|
|
40
|
-
|
|
356
|
+
levels: readonly (infer L)[];
|
|
41
357
|
} ? L : ExtractRatingConfig<T> extends {
|
|
42
|
-
|
|
358
|
+
levels: (infer L)[];
|
|
43
359
|
} ? L : never;
|
|
44
360
|
type ExtractRatingLevelValues<T extends MynthSDKTypes.ImageGenerationClientRequest> = ExtractRatingLevels<T> extends {
|
|
45
|
-
|
|
361
|
+
value: infer V;
|
|
46
362
|
} ? (V extends string ? V : never) : never;
|
|
47
363
|
type IsRatingCustom<T extends MynthSDKTypes.ImageGenerationClientRequest> = ExtractRatingConfig<T> extends {
|
|
48
|
-
|
|
49
|
-
|
|
364
|
+
mode: "custom";
|
|
365
|
+
levels: readonly any[] | any[];
|
|
50
366
|
} ? true : false;
|
|
51
367
|
type ExtractRatingResponse<T extends MynthSDKTypes.ImageGenerationClientRequest> = IsRatingCustom<T> extends true ? {
|
|
52
|
-
|
|
53
|
-
|
|
368
|
+
status: "success";
|
|
369
|
+
level: ExtractRatingLevelValues<T>;
|
|
54
370
|
} | MynthSDKTypes.ImageResultRatingFailure : ExtractRatingConfig<T> extends true | {
|
|
55
|
-
|
|
371
|
+
mode: "nsfw_sfw";
|
|
56
372
|
} ? {
|
|
57
|
-
|
|
58
|
-
|
|
373
|
+
status: "success";
|
|
374
|
+
level: MynthSDKTypes.ImageResultRatingDefaultLevel;
|
|
59
375
|
} | MynthSDKTypes.ImageResultRatingFailure : MynthSDKTypes.ImageResultRating | undefined;
|
|
60
376
|
type ExtractRateLevelValues<T extends MynthSDKTypes.ImageRateClientRequest> = T extends {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
377
|
+
mode: "custom";
|
|
378
|
+
levels: readonly {
|
|
379
|
+
value: infer V;
|
|
380
|
+
}[];
|
|
65
381
|
} ? V extends string ? V : string : MynthSDKTypes.ImageResultRatingDefaultLevel;
|
|
66
382
|
/**
|
|
67
383
|
* Client for interacting with the Mynth image generation and analysis APIs.
|
|
@@ -84,196 +400,196 @@ type ExtractRateLevelValues<T extends MynthSDKTypes.ImageRateClientRequest> = T
|
|
|
84
400
|
* ```
|
|
85
401
|
*/
|
|
86
402
|
declare class MynthImage {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
403
|
+
private readonly client;
|
|
404
|
+
private readonly defaultDestination;
|
|
405
|
+
/**
|
|
406
|
+
* Creates a new MynthImage client instance.
|
|
407
|
+
*
|
|
408
|
+
* @param options - Configuration options
|
|
409
|
+
* @param options.apiKey - Your API key (defaults to MYNTH_API_KEY env var)
|
|
410
|
+
* @param options.baseUrl - Custom API base URL
|
|
411
|
+
* @param options.destination - Default destination name (defaults to MYNTH_DESTINATION env var)
|
|
412
|
+
* @throws {Error} If no API key is provided and MYNTH_API_KEY is not set
|
|
413
|
+
*/
|
|
414
|
+
constructor(options?: MynthOptions);
|
|
415
|
+
/**
|
|
416
|
+
* Generate images from a text prompt.
|
|
417
|
+
*
|
|
418
|
+
* @param request - Image generation request parameters
|
|
419
|
+
* @returns A completed ImageGenerationResult with the generation results
|
|
420
|
+
*
|
|
421
|
+
* @example
|
|
422
|
+
* ```typescript
|
|
423
|
+
* const result = await image.generate({
|
|
424
|
+
* prompt: "A serene lake at dawn",
|
|
425
|
+
* model: "black-forest-labs/flux.1-dev",
|
|
426
|
+
* });
|
|
427
|
+
* console.log(result.urls);
|
|
428
|
+
* ```
|
|
429
|
+
*/
|
|
430
|
+
generate<const T extends MynthSDKTypes.ImageGenerationClientRequest>(request: T): Promise<ImageGenerationResult<ExtractMetadata<T>, ExtractRatingResponse<T>>>;
|
|
431
|
+
/**
|
|
432
|
+
* Upload one or more images to Mynth temporary input storage.
|
|
433
|
+
*
|
|
434
|
+
* Accepts File/Blob or an array of File/Blob inputs.
|
|
435
|
+
*
|
|
436
|
+
* @param input - Image input or inputs to upload
|
|
437
|
+
* @returns Uploaded image URLs that can be passed to generation `inputs`
|
|
438
|
+
*
|
|
439
|
+
* @example
|
|
440
|
+
* ```typescript
|
|
441
|
+
* const { urls } = await image.upload(file);
|
|
442
|
+
* await image.generate({ prompt: "Use this reference", inputs: urls });
|
|
443
|
+
* ```
|
|
444
|
+
*/
|
|
445
|
+
upload(input: MynthSDKTypes.ImageUploadInput | readonly MynthSDKTypes.ImageUploadInput[]): Promise<MynthSDKTypes.ImageUploadResponse>;
|
|
446
|
+
/**
|
|
447
|
+
* Start image generation without waiting for completion.
|
|
448
|
+
*
|
|
449
|
+
* @param request - Image generation request parameters
|
|
450
|
+
* @returns A TaskAsync that can be polled for completion via `.wait()`
|
|
451
|
+
*
|
|
452
|
+
* @example
|
|
453
|
+
* ```typescript
|
|
454
|
+
* const taskAsync = await image.generateAsync({
|
|
455
|
+
* prompt: "A futuristic cityscape",
|
|
456
|
+
* });
|
|
457
|
+
*
|
|
458
|
+
* return { id: taskAsync.id, access: taskAsync.access };
|
|
459
|
+
* ```
|
|
460
|
+
*/
|
|
461
|
+
generateAsync<const T extends MynthSDKTypes.ImageGenerationClientRequest>(request: T): Promise<TaskAsync<ImageGenerationResult<ExtractMetadata<T>, ExtractRatingResponse<T>>>>;
|
|
462
|
+
private createGenerationTask;
|
|
463
|
+
/**
|
|
464
|
+
* Rate the content of a single image.
|
|
465
|
+
*
|
|
466
|
+
* Uses AI classification to assign a rating level. Mode defaults to
|
|
467
|
+
* `"nsfw_sfw"` (`"sfw"` / `"nsfw"`); pass custom `levels` to define your own scale.
|
|
468
|
+
*
|
|
469
|
+
* @param request - Image URL or local file, and optional rating mode
|
|
470
|
+
* @returns An ImageRateResult with the assigned level
|
|
471
|
+
*
|
|
472
|
+
* @example
|
|
473
|
+
* ```typescript
|
|
474
|
+
* // Default sfw/nsfw (mode optional)
|
|
475
|
+
* const result = await image.rate({ url: "https://..." });
|
|
476
|
+
* console.log(result.level); // "sfw" | "nsfw"
|
|
477
|
+
*
|
|
478
|
+
* // Custom levels
|
|
479
|
+
* const result = await image.rate({
|
|
480
|
+
* url: "https://...",
|
|
481
|
+
* mode: "custom",
|
|
482
|
+
* levels: [
|
|
483
|
+
* { value: "safe", description: "No explicit content" },
|
|
484
|
+
* { value: "mature", description: "Adult themes, no nudity" },
|
|
485
|
+
* { value: "explicit", description: "Contains nudity or graphic content" },
|
|
486
|
+
* ] as const,
|
|
487
|
+
* });
|
|
488
|
+
* console.log(result.level); // "safe" | "mature" | "explicit"
|
|
489
|
+
* ```
|
|
490
|
+
*/
|
|
491
|
+
rate<const T extends MynthSDKTypes.ImageRateClientRequest>(request: T): Promise<ImageRateResult<ExtractRateLevelValues<T>>>;
|
|
492
|
+
/**
|
|
493
|
+
* Start image content rating without waiting for completion.
|
|
494
|
+
*
|
|
495
|
+
* @param request - Image URL or local file, and optional rating mode
|
|
496
|
+
* @returns A TaskAsync that can be polled for completion via `.wait()`
|
|
497
|
+
*
|
|
498
|
+
* @example
|
|
499
|
+
* ```typescript
|
|
500
|
+
* const taskAsync = await image.rateAsync({ url: "https://..." });
|
|
501
|
+
*
|
|
502
|
+
* const result = await taskAsync.wait();
|
|
503
|
+
* console.log(result.level);
|
|
504
|
+
* ```
|
|
505
|
+
*/
|
|
506
|
+
rateAsync<const T extends MynthSDKTypes.ImageRateClientRequest>(request: T): Promise<TaskAsync<ImageRateResult<ExtractRateLevelValues<T>>>>;
|
|
507
|
+
private resolveUrlOrFile;
|
|
508
|
+
private createRateTask;
|
|
509
|
+
/**
|
|
510
|
+
* Generate alt text for a single image.
|
|
511
|
+
*
|
|
512
|
+
* Uses AI image analysis to produce short alt text for the image.
|
|
513
|
+
*
|
|
514
|
+
* @param request - Image URL or local file
|
|
515
|
+
* @returns An ImageAltResult with the generated alt text
|
|
516
|
+
*
|
|
517
|
+
* @example
|
|
518
|
+
* ```typescript
|
|
519
|
+
* const result = await image.alt({ url: "https://..." });
|
|
520
|
+
* console.log(result.alt);
|
|
521
|
+
* ```
|
|
522
|
+
*/
|
|
523
|
+
alt(request: MynthSDKTypes.ImageAltClientRequest): Promise<ImageAltResult>;
|
|
524
|
+
/**
|
|
525
|
+
* Start image alt text generation without waiting for completion.
|
|
526
|
+
*
|
|
527
|
+
* @param request - Image URL or local file
|
|
528
|
+
* @returns A TaskAsync that can be polled for completion via `.wait()`
|
|
529
|
+
*
|
|
530
|
+
* @example
|
|
531
|
+
* ```typescript
|
|
532
|
+
* const taskAsync = await image.altAsync({ url: "https://..." });
|
|
533
|
+
*
|
|
534
|
+
* const result = await taskAsync.wait();
|
|
535
|
+
* console.log(result.alt);
|
|
536
|
+
* ```
|
|
537
|
+
*/
|
|
538
|
+
altAsync(request: MynthSDKTypes.ImageAltClientRequest): Promise<TaskAsync<ImageAltResult>>;
|
|
539
|
+
private createAltTask;
|
|
540
|
+
/**
|
|
541
|
+
* Review a single image with a multi-model quality panel.
|
|
542
|
+
*
|
|
543
|
+
* @param request - Image URL or local file, and optional review effort
|
|
544
|
+
* @returns An ImageReviewResult with the score, summary, findings, and strengths
|
|
545
|
+
*
|
|
546
|
+
* @example
|
|
547
|
+
* ```typescript
|
|
548
|
+
* const result = await image.review({ url: "https://..." });
|
|
549
|
+
* console.log(result.score); // 1–4, higher is better
|
|
550
|
+
* console.log(result.findings);
|
|
551
|
+
* ```
|
|
552
|
+
*/
|
|
553
|
+
review(request: MynthSDKTypes.ImageReviewClientRequest): Promise<ImageReviewResult>;
|
|
554
|
+
/**
|
|
555
|
+
* Start an image quality review without waiting for completion.
|
|
556
|
+
*
|
|
557
|
+
* @param request - Image URL or local file, and optional review effort
|
|
558
|
+
* @returns A TaskAsync that can be polled for completion via `.wait()`
|
|
559
|
+
*/
|
|
560
|
+
reviewAsync(request: MynthSDKTypes.ImageReviewClientRequest): Promise<TaskAsync<ImageReviewResult>>;
|
|
561
|
+
private createReviewTask;
|
|
562
|
+
/**
|
|
563
|
+
* Remove the background from a single image.
|
|
564
|
+
*
|
|
565
|
+
* Mynth picks the model. The result keeps the provider's format unless
|
|
566
|
+
* `output.format` asks for `png` or `webp`.
|
|
567
|
+
*
|
|
568
|
+
* @param request - Image URL or local file, plus optional output, destination, webhook, and metadata
|
|
569
|
+
* @returns An ImageRemoveBackgroundResult with the transparent image
|
|
570
|
+
*
|
|
571
|
+
* @example
|
|
572
|
+
* ```typescript
|
|
573
|
+
* const result = await image.removeBackground({ url: "https://..." });
|
|
574
|
+
* console.log(result.image.url);
|
|
575
|
+
* ```
|
|
576
|
+
*/
|
|
577
|
+
removeBackground<const T extends MynthSDKTypes.ImageRemoveBackgroundClientRequest>(request: T): Promise<ImageRemoveBackgroundResult<ExtractRemoveBackgroundMetadata<T>>>;
|
|
578
|
+
/**
|
|
579
|
+
* Start background removal without waiting for completion.
|
|
580
|
+
*
|
|
581
|
+
* @param request - Image URL or local file, plus optional output, destination, webhook, and metadata
|
|
582
|
+
* @returns A TaskAsync that can be polled for completion via `.wait()`
|
|
583
|
+
*
|
|
584
|
+
* @example
|
|
585
|
+
* ```typescript
|
|
586
|
+
* const taskAsync = await image.removeBackgroundAsync({ url: "https://..." });
|
|
587
|
+
*
|
|
588
|
+
* return { id: taskAsync.id, access: taskAsync.access };
|
|
589
|
+
* ```
|
|
590
|
+
*/
|
|
591
|
+
removeBackgroundAsync<const T extends MynthSDKTypes.ImageRemoveBackgroundClientRequest>(request: T): Promise<TaskAsync<ImageRemoveBackgroundResult<ExtractRemoveBackgroundMetadata<T>>>>;
|
|
592
|
+
private createRemoveBackgroundTask;
|
|
277
593
|
}
|
|
278
594
|
/**
|
|
279
595
|
* Client for interacting with the Mynth video generation API.
|
|
@@ -297,119 +613,119 @@ declare class MynthImage {
|
|
|
297
613
|
* ```
|
|
298
614
|
*/
|
|
299
615
|
declare class MynthVideo {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
616
|
+
private readonly client;
|
|
617
|
+
/**
|
|
618
|
+
* Creates a new MynthVideo client instance.
|
|
619
|
+
*
|
|
620
|
+
* @param options - Configuration options
|
|
621
|
+
* @param options.apiKey - Your API key (defaults to MYNTH_API_KEY env var)
|
|
622
|
+
* @param options.baseUrl - Custom API base URL
|
|
623
|
+
* @throws {Error} If no API key is provided and MYNTH_API_KEY is not set
|
|
624
|
+
*/
|
|
625
|
+
constructor(options?: Omit<MynthOptions, "destination">);
|
|
626
|
+
/**
|
|
627
|
+
* Generate a video from a text prompt, optionally guided by input images.
|
|
628
|
+
*
|
|
629
|
+
* Waits for the task to complete. Video generation is slow: this poll can
|
|
630
|
+
* legitimately run for many minutes. Use `generateAsync()` (or a webhook)
|
|
631
|
+
* when you cannot hold a request open that long.
|
|
632
|
+
*
|
|
633
|
+
* @param request - Video generation request parameters
|
|
634
|
+
* @returns A completed VideoGenerationResult
|
|
635
|
+
*
|
|
636
|
+
* @example
|
|
637
|
+
* ```typescript
|
|
638
|
+
* const result = await video.generate({
|
|
639
|
+
* model: "bytedance/seedance-2.0-mini",
|
|
640
|
+
* prompt: "A drone shot over a misty forest at dawn",
|
|
641
|
+
* });
|
|
642
|
+
* console.log(result.urls);
|
|
643
|
+
* ```
|
|
644
|
+
*/
|
|
645
|
+
generate<const T extends MynthSDKTypes.VideoGenerationClientRequest>(request: T): Promise<VideoGenerationResult<ExtractVideoMetadata<T>>>;
|
|
646
|
+
/**
|
|
647
|
+
* Start video generation without waiting for completion.
|
|
648
|
+
*
|
|
649
|
+
* The preferred entry point for server code: hand `taskAsync.id` and
|
|
650
|
+
* `taskAsync.access.publicAccessToken` to the browser, or register a webhook,
|
|
651
|
+
* instead of holding a connection open for the length of a render.
|
|
652
|
+
*
|
|
653
|
+
* @param request - Video generation request parameters
|
|
654
|
+
* @returns A TaskAsync that can be polled for completion via `.wait()`
|
|
655
|
+
*
|
|
656
|
+
* @example
|
|
657
|
+
* ```typescript
|
|
658
|
+
* const taskAsync = await video.generateAsync({
|
|
659
|
+
* model: "prunaai/p-video",
|
|
660
|
+
* prompt: "A neon city street in the rain",
|
|
661
|
+
* });
|
|
662
|
+
*
|
|
663
|
+
* return { id: taskAsync.id, access: taskAsync.access };
|
|
664
|
+
* ```
|
|
665
|
+
*/
|
|
666
|
+
generateAsync<const T extends MynthSDKTypes.VideoGenerationClientRequest>(request: T): Promise<TaskAsync<VideoGenerationResult<ExtractVideoMetadata<T>>>>;
|
|
667
|
+
/**
|
|
668
|
+
* Upload one or more images to Mynth temporary input storage.
|
|
669
|
+
*
|
|
670
|
+
* Video inputs are images, so this is the same storage `image.upload()` uses.
|
|
671
|
+
* Passing files straight to `generate()` uploads them for you; call this
|
|
672
|
+
* directly only when you want to reuse the URLs across several requests.
|
|
673
|
+
*
|
|
674
|
+
* @param input - Image input or inputs to upload
|
|
675
|
+
* @returns Uploaded image URLs that can be passed to generation `inputs`
|
|
676
|
+
*/
|
|
677
|
+
upload(input: MynthSDKTypes.ImageUploadInput | readonly MynthSDKTypes.ImageUploadInput[]): Promise<MynthSDKTypes.ImageUploadResponse>;
|
|
678
|
+
/**
|
|
679
|
+
* Price a video generation request without generating anything.
|
|
680
|
+
*
|
|
681
|
+
* The request is validated exactly as `generate()` would validate it, so an
|
|
682
|
+
* unsupported duration, resolution or input combination throws here too —
|
|
683
|
+
* making this a cheap pre-flight check as well as a cost lookup. Because
|
|
684
|
+
* video pins a concrete model, the returned estimate is exact.
|
|
685
|
+
*
|
|
686
|
+
* @param request - The same request you would pass to `generate()`
|
|
687
|
+
* @returns The estimated cost in USD
|
|
688
|
+
*
|
|
689
|
+
* @example
|
|
690
|
+
* ```typescript
|
|
691
|
+
* const { estimatedCost } = await video.estimate({
|
|
692
|
+
* model: "google/gemini-omni-flash-1.1",
|
|
693
|
+
* prompt: "A timelapse of clouds over a canyon",
|
|
694
|
+
* duration: 10,
|
|
695
|
+
* resolution: "4k",
|
|
696
|
+
* });
|
|
697
|
+
* ```
|
|
698
|
+
*/
|
|
699
|
+
estimate(request: MynthSDKTypes.VideoGenerationClientRequest): Promise<MynthSDKTypes.VideoGenerationEstimate>;
|
|
700
|
+
private toRequestBody;
|
|
701
|
+
private createGenerationTask;
|
|
386
702
|
}
|
|
387
703
|
/**
|
|
388
704
|
* Client for interacting with the public Mynth model catalog.
|
|
389
705
|
*/
|
|
390
706
|
declare class MynthModels {
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
707
|
+
private readonly client;
|
|
708
|
+
/**
|
|
709
|
+
* Creates a new MynthModels client instance.
|
|
710
|
+
*
|
|
711
|
+
* @param options - Configuration options
|
|
712
|
+
* @param options.baseUrl - Custom API base URL
|
|
713
|
+
*/
|
|
714
|
+
constructor(options?: Pick<MynthOptions, "baseUrl">);
|
|
715
|
+
/**
|
|
716
|
+
* List available image generation models.
|
|
717
|
+
*
|
|
718
|
+
* This endpoint is public and does not require a Mynth API key.
|
|
719
|
+
*
|
|
720
|
+
* @returns Available image and video models with display names, served modes, and pricing
|
|
721
|
+
*
|
|
722
|
+
* @example
|
|
723
|
+
* ```typescript
|
|
724
|
+
* const models = await mynth.models.list();
|
|
725
|
+
* console.log(models[0]?.id);
|
|
726
|
+
* ```
|
|
727
|
+
*/
|
|
728
|
+
list(): Promise<MynthSDKTypes.Model[]>;
|
|
413
729
|
}
|
|
414
730
|
/**
|
|
415
731
|
* Bundled Mynth client providing access to all media type clients.
|
|
@@ -425,25 +741,23 @@ declare class MynthModels {
|
|
|
425
741
|
* ```
|
|
426
742
|
*/
|
|
427
743
|
declare class Mynth {
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
744
|
+
/** Public model catalog client */
|
|
745
|
+
readonly models: MynthModels;
|
|
746
|
+
private readonly options;
|
|
747
|
+
private imageClient?;
|
|
748
|
+
private videoClient?;
|
|
749
|
+
/**
|
|
750
|
+
* Creates a new Mynth client instance.
|
|
751
|
+
*
|
|
752
|
+
* @param options - Configuration options
|
|
753
|
+
* @param options.apiKey - Your API key (defaults to MYNTH_API_KEY env var)
|
|
754
|
+
* @param options.baseUrl - Custom API base URL
|
|
755
|
+
*/
|
|
756
|
+
constructor(options?: MynthOptions);
|
|
757
|
+
/** Image generation and analysis client */
|
|
758
|
+
get image(): MynthImage;
|
|
759
|
+
/** Video generation client */
|
|
760
|
+
get video(): MynthVideo;
|
|
445
761
|
}
|
|
446
|
-
|
|
447
|
-
export type
|
|
448
|
-
export default Mynth;
|
|
449
|
-
//# sourceMappingURL=index.d.ts.map
|
|
762
|
+
//#endregion
|
|
763
|
+
export { AVAILABLE_MODELS, AVAILABLE_VIDEO_MODELS, type AvailableModel, type AvailableVideoModel, type ModelCapability, Mynth, Mynth as default, MynthImage, type MynthModel, type MynthModelPricing, MynthModels, type MynthOptions, type MynthSDKTypes, MynthVideo, type TaskAsyncAccess, type VideoInputRole, type VideoResolutionTier };
|