Skip to main content
The official SDK package is @mynthio/sdk. It is the easiest way to integrate Mynth from JavaScript or TypeScript applications.

What the SDK gives you

  • a typed Mynth client
  • sync and async generation flows
  • Task and TaskAsync abstractions
  • built-in polling for async tasks
  • exported runtime model metadata through AVAILABLE_MODELS
  • a Convex webhook helper in @mynthio/sdk/convex

Installation

bun add @mynthio/sdk

Typical server-side use

import Mynth from "@mynthio/sdk";

const mynth = new Mynth();

const task = await mynth.generate({
  prompt: "A premium e-commerce hero image for a leather backpack",
  model: "google/gemini-3.1-flash-image",
});

console.log(task.urls);

Typical async use

const task = await mynth.generate(
  {
    prompt: "A premium e-commerce hero image for a leather backpack",
    model: "google/gemini-3.1-flash-image",
  },
  { mode: "async" },
);

return {
  id: task.id,
  access: task.access,
};

When to use the SDK

Prefer the SDK when you want:
  • strong TypeScript support
  • less boilerplate for polling
  • consistent task handling
Use the raw API when you need another language or total transport-level control.