Skip to main content

Get started in minutes

This guide walks you through generating your first image with the Mynth API.

1) Create an API key

Grab your key from the API Keys page in the dashboard.

2) Install the SDK

See the SDK documentation for more details.
# Bun
bun add @mynthio/sdk

# PNPM
pnpm add @mynthio/sdk

# NPM
npm install @mynthio/sdk

3) Generate your first image

Set your API key:
MYNTH_API_KEY=mak_...
Then generate an image:
import Mynth from "@mynthio/sdk";

const mynth = new Mynth({ apiKey: process.env.MYNTH_API_KEY ?? "" });

const task = await mynth.generate({
  prompt: "A cinematic portrait of a fox in a rainy neon alley",
  model: "black-forest-labs/flux.1-dev",
});

console.log(task.getImages());

4) Make it async (optional)

If you want to return immediately and process results later:
const taskAsync = await mynth.generate(
  {
    prompt: "A floating garden at sunrise",
    model: "black-forest-labs/flux.1-dev",
  },
  { mode: "async" }
);

console.log("Task started:", taskAsync.id);

Next steps