Skip to main content
This quickstart gets you from zero to a completed image task using the official JavaScript and TypeScript SDK.
1

Create an API key

Create a key in the Mynth dashboard.If you work with multiple environments, create separate keys and set a spending limit for each one.
2

Install the SDK

3

Set your environment variable

bash export MYNTH_API_KEY=mak_your_key_here
4

Generate an image

By default, generate() waits for completion. The returned task is already a completed task object, so task.urls contains the successful image URLs immediately.
5

Return immediately with generateAsync

generateAsync() returns a TaskAsync. Use it when your server should start work now and your app will poll or wait later.
Set model explicitly in production. model: "auto" is an early preview feature intended for experimentation.

Async and Polling

Learn when to use sync, async, polling, and browser-safe access tokens.

Use Webhooks

Send results to your backend automatically.

Request Reference

See every request field that Mynth accepts.

SDK Tasks

Understand Task, TaskAsync, and polling behavior in detail.