Overview
@mynthio/sdk is the TypeScript client for Mynth. It creates tasks, waits for them, uploads local files, and ships webhook helpers for Next.js, TanStack Start, and Convex.
@mynthio/sdk is the TypeScript client for Mynth. Construct one client, pass
a model id and a prompt, and read the file URLs from the result.
import Mynth from "@mynthio/sdk";
const mynth = new Mynth(); // reads MYNTH_API_KEY
const task = await mynth.image.generate({
model: "black-forest-labs/flux.2-pro",
prompt: "A lighthouse at dusk, film grain",
});
console.log(task.urls[0]);generate() creates a task and polls it until it settles. Use
generateAsync() when the caller cannot wait, and finish on a webhook.
| Surface | Methods |
|---|---|
mynth.image | generate, rate, alt, review, removeBackground, upscale, each with an Async twin, and upload |
mynth.video | generate, generateAsync, estimate, upload |
mynth.models | list, which needs no API key |
@mynthio/sdk/next, /tanstack-start, /convex | Webhook helpers that verify the signature and call a handler per event. verifyWebhook() for anything else |
The SDK does not wrap account management: keys, webhooks, destinations, and balance. Use the REST API or the CLI for those.
mak_ key on the server. A browser polls one task with the pat_
token from the create response. See tasks and polling.model makes the API use auto, which is
experimental. See the model field.urls and images skip failed images. Compare with the count you
sent when a partial result matters.| Page | Covers |
|---|---|
| Installation | The package, the key, and the entry points |
| Client | apiKey, baseUrl, and the default destination |
| Generating media | Image, video, and tool calls, and what the result objects hold |
| Tasks and polling | generateAsync(), poll intervals, and the browser token |
| Errors | MynthAPIError and the errors a wait throws |
image.generate() sends.