# Get Account Balance
Source: https://docs.mynth.io/api-reference/account/get-account-balance
https://api.mynth.io/openapi.json get /balance
# Get Current Account
Source: https://docs.mynth.io/api-reference/account/get-current-account
https://api.mynth.io/openapi.json get /me
# Create API Key
Source: https://docs.mynth.io/api-reference/api-keys/create-api-key
https://api.mynth.io/openapi.json post /api-key
# Delete API Key
Source: https://docs.mynth.io/api-reference/api-keys/delete-api-key
https://api.mynth.io/openapi.json delete /api-key/{id}
# List API Keys
Source: https://docs.mynth.io/api-reference/api-keys/list-api-keys
https://api.mynth.io/openapi.json get /api-key
# Update API Key
Source: https://docs.mynth.io/api-reference/api-keys/update-api-key
https://api.mynth.io/openapi.json put /api-key/{id}
# Create Destination
Source: https://docs.mynth.io/api-reference/destinations/create-destination
https://api.mynth.io/openapi.json post /destinations
# Delete Destination
Source: https://docs.mynth.io/api-reference/destinations/delete-destination
https://api.mynth.io/openapi.json delete /destinations/{id}
# Get Destination
Source: https://docs.mynth.io/api-reference/destinations/get-destination
https://api.mynth.io/openapi.json get /destinations/{id}
# List Destinations
Source: https://docs.mynth.io/api-reference/destinations/list-destinations
https://api.mynth.io/openapi.json get /destinations
# Test Destination
Source: https://docs.mynth.io/api-reference/destinations/test-destination
https://api.mynth.io/openapi.json post /destinations/{id}/test
# Update Destination
Source: https://docs.mynth.io/api-reference/destinations/update-destination
https://api.mynth.io/openapi.json put /destinations/{id}
# Estimate Image Generation Cost
Source: https://docs.mynth.io/api-reference/image/estimate-image-generation-cost
https://api.mynth.io/openapi.json post /image/generate/estimate
# Generate Image
Source: https://docs.mynth.io/api-reference/image/generate-image
https://api.mynth.io/openapi.json post /image/generate
# Generate Image Alt Text
Source: https://docs.mynth.io/api-reference/image/generate-image-alt-text
https://api.mynth.io/openapi.json post /image/alt
# Rate Image
Source: https://docs.mynth.io/api-reference/image/rate-image
https://api.mynth.io/openapi.json post /image/rate
# Review Image
Source: https://docs.mynth.io/api-reference/image/review-image
https://api.mynth.io/openapi.json post /image/review
# Upload Images
Source: https://docs.mynth.io/api-reference/image/upload-images
https://api.mynth.io/openapi.json post /image/upload
# List Models
Source: https://docs.mynth.io/api-reference/models/list-models
https://api.mynth.io/openapi.json get /models
# Check API Health
Source: https://docs.mynth.io/api-reference/system/check-api-health
https://api.mynth.io/openapi.json get /health
# Get Task
Source: https://docs.mynth.io/api-reference/tasks/get-task
https://api.mynth.io/openapi.json get /tasks/{id}
# Get Task Result
Source: https://docs.mynth.io/api-reference/tasks/get-task-result
https://api.mynth.io/openapi.json get /tasks/{id}/result
# Get Task Status
Source: https://docs.mynth.io/api-reference/tasks/get-task-status
https://api.mynth.io/openapi.json get /tasks/{id}/status
# List Tasks
Source: https://docs.mynth.io/api-reference/tasks/list-tasks
https://api.mynth.io/openapi.json get /tasks
# Estimate Video Generation Cost
Source: https://docs.mynth.io/api-reference/video/estimate-video-generation-cost
https://api.mynth.io/openapi.json post /video/generate/estimate
# Generate Video
Source: https://docs.mynth.io/api-reference/video/generate-video
https://api.mynth.io/openapi.json post /video/generate
# Create Webhook
Source: https://docs.mynth.io/api-reference/webhooks/create-webhook
https://api.mynth.io/openapi.json post /webhook
# Delete Webhook
Source: https://docs.mynth.io/api-reference/webhooks/delete-webhook
https://api.mynth.io/openapi.json delete /webhook/{id}
# Update Webhook
Source: https://docs.mynth.io/api-reference/webhooks/update-webhook
https://api.mynth.io/openapi.json put /webhook/{id}
# Beta
Source: https://docs.mynth.io/beta
Mynth is now in beta — here's what that means for the API, magic prompt, and using Mynth in production.
Mynth is now in **beta**. The early alpha period is over: the core platform has settled, and Mynth is ready for real use beyond demos and experiments.
## What beta means
Models, image size, magic prompt, webhooks, and the rest of the base API are stable. We won't make
breaking changes to them without a proper migration period and advance notice — so you can build
against Mynth with confidence.
Mynth is now more stable and dependable. It's suitable for non-critical production environments,
or for production use behind a fallback. As always, design for graceful degradation where image
generation is on a critical path.
## Magic prompt is still in beta
Magic prompt remains in **beta** while we keep iterating on it. During the beta period it's **free for testing purposes**, so you can explore what it does without worrying about cost. Expect it to keep evolving — unlike the base API, magic prompt may still change.
## Testing credits for developers
We've paused automatic signup credits because they were repeatedly abused by bots and other automated signups. We still want genuine developers to be able to evaluate Mynth and build with it, regardless of budget.
If you need help getting started, [DM @mynthio on X](https://x.com/mynthio) or [join us on Discord](https://discord.gg/ktHXuPVaqB) and tell us what you're building. We may provide up to **\$10 in testing credits**, based on what you need.
## Top-ups and going to production
Top-ups are enabled. For now, think of them mainly as a way to **support Mynth** while it grows.
That said — if you like Mynth and want to run it in production at higher load, you're very welcome to. We don't have anything against paid production use, and we're happy to collaborate with anyone who wants to use Mynth seriously: helping solve issues, tuning for your workload, and working through whatever comes up.
If that's you, get in touch:
* **Discord** — [join the community](https://discord.gg/ktHXuPVaqB)
* **Email** — [mynth@mynth.io](mailto:mynth@mynth.io)
We'd love to hear what you're building.
# Async and Polling
Source: https://docs.mynth.io/guides/async-and-polling
Wait for task completion with the SDK, or poll status and result endpoints yourself.
Mynth work is task-based. `POST /image/generate` always returns a task (`taskId` + optional Public Access Token). The SDK `generate()` method creates that task and polls until it finishes.
Use this guide when you need to wait for results or poll yourself. For browser UI polling with a Public Access Token, see [Browser Polling](/tutorials/browser-polling). For push delivery instead of polling, see [Use Webhooks](/guides/use-webhooks).
## Wait in the SDK (simplest path)
On a server (or any place that holds your API key), use `generate()`. It returns a completed result wrapper:
```ts theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth({
apiKey: process.env.MYNTH_API_KEY,
});
const result = await mynth.image.generate({
prompt: "Minimal product shot of a matte black espresso grinder",
model: "google/gemini-3.1-flash-image",
});
console.log(result.urls); // string[]
```
`rate()` and `alt()` work the same way: they start a task with `sync: false` and poll until completion.
## Start a task without waiting
Use `generateAsync()` when you need the task ID immediately — for example to return to a client, store the ID, or wait later:
```ts theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generateAsync({
prompt: "Minimal product shot of a matte black espresso grinder",
model: "google/gemini-3.1-flash-image",
});
console.log(task.id);
console.log(task.access.publicAccessToken); // pat_... (generation only, by default)
const result = await task.wait();
console.log(result.urls);
```
Also available: `rateAsync()`, `altAsync()`. Those return a `TaskAsync` without a Public Access Token — poll them from trusted code with your API key.
| Method | Returns | Waits? |
| ------------------------------------------------ | -------------- | -------------------------------- |
| `generate()` / `rate()` / `alt()` | Result wrapper | Yes (`wait()` under the hood) |
| `generateAsync()` / `rateAsync()` / `altAsync()` | `TaskAsync` | No — call `task.wait()` yourself |
## Handle success and failure
`task.wait()` resolves only when the task status is `completed`. It throws dedicated errors otherwise:
```ts theme={"theme":"kanagawa-dragon"}
import {
TaskAsyncTimeoutError,
TaskAsyncTaskFailedError,
TaskAsyncUnauthorizedError,
TaskAsyncFetchError,
TaskAsyncTaskFetchError,
} from "@mynthio/sdk";
try {
const result = await task.wait();
console.log(result.urls);
} catch (error) {
if (error instanceof TaskAsyncTaskFailedError) {
// Task status is "failed"
} else if (error instanceof TaskAsyncTimeoutError) {
// Polled for five minutes without completion
} else if (error instanceof TaskAsyncUnauthorizedError) {
// API key or Public Access Token rejected
} else if (error instanceof TaskAsyncFetchError) {
// Transient status fetches failed after retries
} else if (error instanceof TaskAsyncTaskFetchError) {
// Final task detail fetch failed
} else {
throw error;
}
}
```
Task statuses:
| Status | Meaning |
| ----------- | ---------------------------------------------- |
| `pending` | Queued or still running |
| `completed` | Finished; result payload is available |
| `failed` | Did not complete; see task `errors` if present |
A completed `image.generate` task can still contain per-image failures (`images[].status: "failed"`). Use `result.getImages()` for successes only, or `result.getImages({ includeFailed: true })` for both.
## Poll with REST
Create a generation task (always async at the API):
```bash theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Minimal product shot of a matte black espresso grinder",
"model": "google/gemini-3.1-flash-image"
}'
```
```json theme={"theme":"kanagawa-dragon"}
{
"data": {
"taskId": "tsk_01KE7XWWEQ4MCGWKBQKJ1G47RP",
"estimatedCost": "0.03",
"access": {
"publicAccessToken": "pat_eyJhbGciOi..."
}
}
}
```
### Poll status
`GET /tasks/:id/status` accepts your API key or the task's Public Access Token:
```bash theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/tasks/$TASK_ID/status \
-H "Authorization: Bearer $PUBLIC_ACCESS_TOKEN"
```
```json theme={"theme":"kanagawa-dragon"}
{
"data": {
"status": "pending"
}
}
```
Poll until `completed` or `failed`.
### Fetch the result
`GET /tasks/:id/result` uses the same auth options. It returns `id`, `type`, `status`, and `result` (null while pending or when a failed task has no result):
```bash theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/tasks/$TASK_ID/result \
-H "Authorization: Bearer $PUBLIC_ACCESS_TOKEN"
```
Completed generate example:
```json theme={"theme":"kanagawa-dragon"}
{
"data": {
"id": "tsk_01KE7XWWEQ4MCGWKBQKJ1G47RP",
"type": "image.generate",
"status": "completed",
"result": {
"model": "google/gemini-3.1-flash-image",
"images": [
{
"status": "success",
"id": "img_...",
"url": "https://...",
"mynth_url": "https://...",
"size": "1024x1024"
}
]
}
}
}
```
### Owner-only full task
`GET /tasks/:id` requires your Mynth API key (not a Public Access Token). Use it when you need the original `request`, full `result`, `cost`, timestamps, or `errors`:
```bash theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/tasks/$TASK_ID \
-H "Authorization: Bearer $MYNTH_API_KEY"
```
See [Tasks reference](/reference/tasks#full-task-shape) for the full shape.
## Public Access Tokens
Generation responses include a task-scoped Public Access Token by default (`access.pat.enabled` defaults to `true`). The token:
* is a JWT prefixed with `pat_`
* is scoped to one task
* is valid for one hour
* works only on `GET /tasks/:id/status` and `GET /tasks/:id/result`
Disable it when you only poll from the server with an API key:
```ts theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generateAsync({
prompt: "...",
model: "google/gemini-3.1-flash-image",
access: { pat: { enabled: false } },
});
```
Do not put your API key in the browser. Return only `taskId` and `publicAccessToken` to clients — see [Browser Polling](/tutorials/browser-polling).
`rate` and `alt` tasks do not currently return a Public Access Token. Poll those with your API key from trusted server code.
## SDK polling behavior
`TaskAsync.wait()`:
| Behavior | Detail |
| ------------------ | ---------------------------------------------------------------------- |
| Start | Lazy — polling begins on first `wait()` call |
| Dedup | Multiple `wait()` calls share one promise |
| Interval | \~2.5s for the first 12s, then \~5s (with jitter) |
| Timeout | 30 minutes → `TaskAsyncTimeoutError` |
| Status auth | Prefers the task Public Access Token; falls back to the client API key |
| Final fetch | `GET /tasks/:id` with the client API key after `status: "completed"` |
| Transient failures | Retries up to 7 times; counter resets after a successful status poll |
| Failed task | `status: "failed"` → `TaskAsyncTaskFailedError` |
Because the final detail fetch uses the API key, call `wait()` from code that has the SDK client configured with your key. Browser clients should poll `/status` and `/result` with the Public Access Token instead.
Full SDK helpers and error classes: [SDK tasks](/sdk/js-ts/tasks).
## REST sync mode for rate and alt
Unlike image generation, `POST /image/rate` and `POST /image/alt` default to **server-side sync** (`"sync": true`). The API waits up to \~55 seconds and returns results inline when possible.
Set `"sync": false` (or use `rateAsync()` / `altAsync()`) to get a pending task and poll yourself. If sync mode times out, the API returns a `202` pending task — poll the same task endpoints.
## Choose a completion strategy
| Approach | Best when |
| ------------------------------- | ------------------------------------------------------------- |
| SDK `generate()` / `wait()` | Server code can block until the task finishes |
| REST poll `/status` + `/result` | You own the HTTP client or poll from the browser with a PAT |
| Webhooks | Backend pipelines, durable side effects, multi-system fan-out |
## How async fits generation
1. You create a task (`POST /image/generate`, or `generate` / `generateAsync` in the SDK).
2. Mynth queues work and returns `taskId` (and usually a Public Access Token).
3. You wait in the SDK, poll `/status` then `/result`, or receive a webhook.
4. On `completed`, read images (or rate/alt results) from the result payload.
Creating a task does not return final media in the create response. Always wait, poll, or subscribe before treating the job as done.
# Batch Generate Images
Source: https://docs.mynth.io/guides/batch-generation
Generate multiple images with count, or run independent tasks in parallel across prompts and models.
Use `count` on `POST /image/generate` (or `mynth.image.generate()` / `generateAsync()`) when you want several images from the **same** prompt and model in one task. Default is `1`. Maximum is `20`.
For different prompts or models, create separate tasks in parallel. There is no multi-prompt bulk endpoint.
For a single image, see [Generate Images](/guides/generate-images). For waiting on results, see [Async and polling](/guides/async-and-polling).
## Pricing
Mynth reserves the full cost up front: per-image price × `count` (plus magic prompt once, if enabled). You are charged only for images that succeed. Reserved balance for failed images is released.
If your balance cannot cover the full reservation, task creation fails with `422 INSUFFICIENT_BALANCE`.
## Generate several images in one task
Set `count` to request multiple variants of one prompt:
```ts theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Editorial product photo of a ceramic mug on marble",
model: "google/gemini-3.1-flash-image",
size: "landscape",
count: 4,
});
console.log(task.urls); // successful image URLs only
console.log(task.getImages().length); // 0–4 successful images
```
| Field | Default | Limits |
| ------- | ------- | ------------------------ |
| `count` | `1` | Integer from `1` to `20` |
`count` greater than `20` is rejected with HTTP `400` and `code: "VALIDATION_ERROR"`.
## Handle partial success
Each requested image is generated independently. The task can complete with a mix of successful and failed images. The task status is still `completed` when any images settle; inspect per-image `status`.
Success item:
```json theme={"theme":"kanagawa-dragon"}
{
"status": "success",
"id": "img_...",
"url": "https://...",
"mynth_url": "https://...",
"size": "1536x1024"
}
```
Failed item:
```json theme={"theme":"kanagawa-dragon"}
{
"status": "failed",
"error": { "code": "UNKNOWN_ERROR" }
}
```
Per-image error codes: `INVALID_INPUT`, `INVALID_PROMPT`, `RESTRICTED_CONTENT`, `UNKNOWN_ERROR`.
```ts theme={"theme":"kanagawa-dragon"}
for (const image of task.getImages({ includeFailed: true })) {
if (image.status === "success") {
console.log(image.id, image.url ?? image.mynth_url);
} else {
console.error(image.error.code);
}
}
```
`task.urls` and `task.getImages()` return only successful images. Use `getImages({ includeFailed: true })` when you need failures.
## Fan out across prompts or models
One request has a single `prompt` and `model`. For independent combinations, create one task per combination. Mynth does not enforce API concurrency limits.
```ts theme={"theme":"kanagawa-dragon"}
const prompts = [
"Packaging photo for a botanical tea brand",
"Packaging photo for a specialty coffee brand",
"Packaging photo for a skincare brand",
];
const tasks = await Promise.all(
prompts.map((prompt) =>
mynth.image.generateAsync({
prompt,
model: "google/gemini-3.1-flash-image",
count: 2,
}),
),
);
console.log(tasks.map((task) => task.id));
```
Across models:
```ts theme={"theme":"kanagawa-dragon"}
const models = [
"google/gemini-3.1-flash-image",
"black-forest-labs/flux.2-dev",
"black-forest-labs/flux.2-pro",
"recraft/recraft-v4",
] as const;
const tasks = await Promise.all(
models.map((model) =>
mynth.image.generateAsync({
prompt: "Hero illustration for a fintech landing page",
model,
size: "landscape",
}),
),
);
```
Use `generateAsync` when you want task IDs immediately and will poll or use webhooks later. Use `generate` when you can wait for each task in place. See [Async and polling](/guides/async-and-polling).
Size your own parallelism for budget, downstream capacity, and client UX. Each task reserves cost at creation.
## REST example
```bash theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Editorial product photo of a ceramic mug on marble",
"model": "google/gemini-3.1-flash-image",
"size": "landscape",
"count": 4
}'
```
Creating a task does not return images immediately. Poll task endpoints or use webhooks — see [Async and polling](/guides/async-and-polling) and [Use Webhooks](/guides/use-webhooks).
## Choose count vs parallel tasks
| Goal | Approach |
| ------------------------------------------- | -------------------------------------------------------------- |
| Several variants of one prompt and model | One request with `count` (max `20`) |
| Different prompts, same or different models | One task per combination (`Promise.all`, etc.) |
| Different models for the same prompt | One task per model |
| Track each job with your own IDs | `metadata` per task — see [Use Metadata](/guides/use-metadata) |
## How batch generation works
1. Mynth validates the request (`count` 1–20) and reserves cost for all requested images.
2. The worker runs the `count` generations in parallel for that task.
3. Each image is finalized independently (upload, optional rating, destination).
4. The task completes with `result.images` — one entry per requested image, `success` or `failed`.
5. You are charged only for successful images; unused reservation is released.
For field-level request details, see [Image Generation Request](/reference/image-generation-request). For limits, see [Errors and Limits](/reference/errors-and-limits).
# Control Prompts
Source: https://docs.mynth.io/guides/control-prompts
Set prompt, negative_prompt, and magic_prompt on image generation requests.
Use `prompt`, optional `negative_prompt`, and optional `magic_prompt` on `POST /image/generate` (or `mynth.image.generate()`). `prompt` is required. Negative and magic prompt are omitted by default.
For many independent prompts in parallel, use separate generate calls — see [Batch Generation](/guides/batch-generation). There is no multi-prompt array field on a single request.
For the full request schema, see [Image Generation Request](/reference/image-generation-request).
## Pricing
Magic prompt is included with image generation at no extra charge today (`image.generate.magic_prompt` cost is currently `0`).
Image generation itself is billed per successful image for the chosen model. See model pricing on [mynth.io/models](https://mynth.io/models).
## Send a positive prompt
`prompt` is a plain string (maximum 8192 characters):
```ts theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Editorial portrait of a cyclist in the rain",
model: "google/gemini-3.1-flash-image",
});
```
Omit `magic_prompt` to send this text to the model as-is.
## Discourage content with a negative prompt
Pass `negative_prompt` as a separate top-level string (maximum 8192 characters):
```ts theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Editorial portrait of a cyclist in the rain",
negative_prompt: "text, watermark, extra limbs",
model: "purplesmartai/pony-diffusion-v6-xl",
});
```
| Field | Type | Default | Notes |
| ----------------- | -------- | -------- | ----------------------------------------- |
| `prompt` | `string` | required | Positive prompt, max 8192 characters. |
| `negative_prompt` | `string` | — | Optional exclusions, max 8192 characters. |
Whether the provider applies `negative_prompt` depends on the model. Models that support it list **Negative prompt: Yes** on their model page and expose the `negative_prompt` capability in the SDK’s `AVAILABLE_MODELS`.
Models with native negative-prompt support today:
* [Bismuth Illustrious Mix](/models/john6666-bismuth-illustrious-mix) (`john6666/bismuth-illustrious-mix`)
* [One obsession](/models/maxfeifei8-one-obsession) (`maxfeifei8/one-obsession`)
* [Pony Diffusion V6 XL](/models/purplesmartai-pony-diffusion-v6-xl) (`purplesmartai/pony-diffusion-v6-xl`)
On models without that capability, Mynth accepts `negative_prompt` on the request but does not send it to the provider. Prefer models that document negative-prompt support when exclusions matter.
## Rewrite the prompt with magic prompt
Set `magic_prompt: true` to let Mynth rewrite your prompt before generation. The type accepts only `true` — omit the field to leave the prompt unchanged (do not send `false`).
```ts theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Luxury skincare product photo on sculpted stone",
negative_prompt: "text, watermark",
magic_prompt: true,
model: "bytedance/seedream-pro",
});
```
When enabled:
1. Mynth runs a text model that refines the positive prompt (and can produce or refine a negative when the magic path is configured for negatives).
2. Generation uses the rewritten text.
3. The completed task result includes `magic_prompt` with what was sent downstream.
### Read the rewritten prompt
On a completed generate task, when magic prompt ran:
```json theme={"theme":"kanagawa-dragon"}
{
"model": "bytedance/seedream-pro",
"magic_prompt": {
"positive": "Product photograph of a luxury skincare bottle on sculpted stone...",
"negative": "text, watermark, logo"
},
"images": [/* ... */]
}
```
`magic_prompt.positive` is always present after a successful rewrite. `magic_prompt.negative` is optional — it appears when the rewrite path returns a negative (for example on models that use magic negative-prompt examples).
```ts theme={"theme":"kanagawa-dragon"}
const rewritten = task.result?.magic_prompt;
console.log(rewritten?.positive);
console.log(rewritten?.negative);
```
### Model-tuned magic prompts
Magic prompt works for every model via a general rewrite path. Some models also ship **model-tuned** overrides (style card, examples, and sometimes negative-prompt guidance). On those model pages, magic prompt is listed as **Improved (model-tuned)**.
Models with model-tuned magic prompts today:
* [Seedream Pro](/models/bytedance-seedream-pro)
* [ImagineArt 2.0](/models/imagineart-imagineart-2-0)
* [Bismuth Illustrious Mix](/models/john6666-bismuth-illustrious-mix)
* [Pony Diffusion V6 XL](/models/purplesmartai-pony-diffusion-v6-xl)
* [Z-Image Turbo](/models/tongyi-mai-z-image-turbo)
## REST example
```bash theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Luxury skincare product photo on sculpted stone",
"negative_prompt": "text, watermark",
"magic_prompt": true,
"model": "bytedance/seedream-pro"
}'
```
Creating a task does not return images immediately. Wait in the SDK, poll task endpoints, or use webhooks — see [Async and polling](/guides/async-and-polling). When the task completes, `result.magic_prompt` is present if `magic_prompt: true` was applied.
## How prompts fit generation
1. You send `prompt` (required) and optional `negative_prompt` / `magic_prompt: true`.
2. If magic prompt is enabled, Mynth rewrites the prompt for the resolved model.
3. Mynth generates images with the final positive (and negative when the model supports it).
4. The task result includes images and, when magic ran, `magic_prompt` with the rewritten text.
Prompt fields do not change task shape: you still create one `image.generate` task per request. For many prompts or models at once, fan out with parallel requests — [Batch Generation](/guides/batch-generation).
# Control Size
Source: https://docs.mynth.io/guides/control-size
Set presets, aspect ratios, 4K scale, or auto size on image generation requests.
Use the `size` option on `POST /image/generate` to control layout and scale. `size` is optional. When you omit it, or pass `"auto"`, Mynth chooses dimensions for you.
This page covers request `size` and output file format. For prompts, inputs, and models, see [Generate Images](/guides/generate-images). Full field tables live in [Image Generation Request](/reference/image-generation-request).
## Pricing
Choosing a base preset or aspect ratio does not add a separate fee. You pay the model's per-image price for the resolved scale.
| Scale | Billing |
| ---------------- | -------------------------------------------------------------- |
| `base` (default) | Model `perImage.base` rate |
| `4k` | Model `perImage["4k"]` when published; otherwise the base rate |
Check each model page or [mynth.io/models](https://mynth.io/models) for base and 4K prices. Requesting `4k` on a model that does not support it fails the task — Mynth does not silently downgrade to base.
## Use a named preset
The simplest option is a layout preset string:
```ts theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "google/gemini-3.1-flash-image",
size: "landscape",
});
```
| Preset | Aspect ratio |
| ---------------- | ------------ |
| `square` | `1:1` |
| `portrait` | `2:3` |
| `landscape` | `3:2` |
| `portrait_tall` | `9:16` |
| `landscape_wide` | `16:9` |
Presets resolve to aspect ratios. Exact pixel dimensions depend on the model and scale.
## Use an aspect ratio
Pass a ratio as a shorthand string, or as a structured object:
```ts theme={"theme":"kanagawa-dragon"}
// Shorthand (same as structured with scale "base")
size: "16:9";
// Structured
size: { type: "aspect_ratio", aspectRatio: "16:9" };
// Structured with explicit base scale
size: { type: "aspect_ratio", aspectRatio: "16:9", scale: "base" };
```
### Supported aspect ratios
| Ratio | Typical use |
| ------ | ------------------------------- |
| `1:1` | Square social, icons |
| `2:3` | Portrait photo |
| `3:2` | Landscape photo |
| `3:4` | Portrait product |
| `4:3` | Classic landscape |
| `4:5` | Portrait feed posts |
| `5:4` | Near-square landscape |
| `9:16` | Stories / vertical video frames |
| `16:9` | Widescreen / hero |
| `21:9` | Ultrawide cinematic |
| `2:1` | Wide banner |
| `1:2` | Tall banner |
If a model does not list an exact ratio among its presets, Mynth maps to the closest same-orientation preset for that model. Prefer ratios the model documents when you need a specific layout.
You cannot pass raw `width` / `height` on the public generate API. Use presets, aspect ratios, or auto.
## Request 4K
Set scale to `4k` when the model supports it:
```ts theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Wide aerial of a coastal city at dusk",
model: "google/gemini-3.1-flash-image",
size: { type: "aspect_ratio", aspectRatio: "16:9", scale: "4k" },
});
```
Ratio shorthands with a `_4k` suffix are equivalent:
```ts theme={"theme":"kanagawa-dragon"}
size: "16:9_4k";
```
Supported 4K shorthands: `1:1_4k`, `2:3_4k`, `3:2_4k`, `3:4_4k`, `4:3_4k`, `4:5_4k`, `5:4_4k`, `9:16_4k`, `16:9_4k`, `21:9_4k`, `2:1_4k`, `1:2_4k`.
Named layout presets (`square`, `portrait`, …) do not have `_4k` variants. Use a ratio shorthand or structured `scale: "4k"` instead.
Leave `scale` unset (or set `"base"`) for the model's standard tier. Check the model's capabilities table — **4K: Yes** — before requesting 4K.
## Use auto size
Any of these ask Mynth not to force a fixed user-chosen ratio:
```ts theme={"theme":"kanagawa-dragon"}
// Omitted size (same behavior)
const task = await mynth.image.generate({
prompt: "Editorial product shot on marble",
model: "google/gemini-3.1-flash-image",
});
// Explicit
size: "auto";
size: {
type: "auto";
}
```
What happens next depends on the model and mode:
1. **Native auto size** — if the model supports auto size in the active mode (often image-to-image), the provider chooses dimensions (for example from the input image). Look for **Native auto size: Yes** on the model page.
2. **Mynth-resolved auto** — if the model has no native auto path for that mode, Mynth picks an aspect ratio from your prompt at base scale, then maps it to the model's presets.
Models with native auto size today:
| Model | Notes |
| ------------------------------------------------------------------------- | ------------------------------ |
| [Gemini 3.1 Flash-Lite Image](/models/google-gemini-3-1-flash-lite-image) | Image-to-image |
| [Gemini 3 Pro Image Preview](/models/google-gemini-3-pro-image-preview) | Image-to-image |
| [ImagineArt 2.0](/models/imagineart-imagineart-2-0) | Image-to-image |
| [Reve](/models/reve-reve) | Text-to-image · Image-to-image |
| [Reve Remix](/models/reve-reve-remix) | Image-to-image (required) |
| [Muse Image](/models/meta-muse-image) | Text-to-image · Image-to-image |
| [Grok Imagine Image](/models/xai-grok-imagine-image) | Image-to-image |
| [Grok Imagine Image 2.0](/models/xai-grok-imagine-image-2-0) | Image-to-image |
| [Grok Imagine Image Quality](/models/xai-grok-imagine-image-quality) | Image-to-image |
| [FLUX Virtual Try-On](/models/black-forest-labs-flux-virtual-try-on) | Image-to-image (required) |
| [P-Image Try-On](/models/prunaai-p-image-try-on) | Image-to-image (required) |
| [Ideogram Remove Background](/models/ideogram-remove-background) | Image-to-image (required) |
For a fixed layout, prefer a preset or aspect ratio instead of auto.
## Read the resolved size
Each successful image includes the actual pixel size as `{width}x{height}`:
```json theme={"theme":"kanagawa-dragon"}
{
"status": "success",
"id": "img_...",
"url": "https://...",
"mynth_url": "https://...",
"size": "2688x1536"
}
```
```ts theme={"theme":"kanagawa-dragon"}
for (const image of task.getImages()) {
if (image.status === "success") {
console.log(image.id, image.size); // e.g. "2688x1536"
}
}
```
Request `size` is what you asked for. Result `size` is what was generated.
## Set output format
`output` controls the delivered file, not layout. It is optional, and so is `format` inside it — omit either and each image is delivered in the model's native format:
```ts theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Matte product render on seamless background",
model: "google/gemini-3.1-flash-image",
size: "square",
output: {
format: "webp",
},
});
```
| Field | Values | Default |
| -------- | -------------------- | ------------------- |
| `format` | `png`, `jpg`, `webp` | model native format |
`format` is best effort. A model that cannot deliver the requested format delivers its own instead; the file extension on `mynth_url` is what you actually got.
## REST example
```bash theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "google/gemini-3.1-flash-image",
"size": {
"type": "aspect_ratio",
"aspectRatio": "16:9",
"scale": "base"
},
"output": {
"format": "webp"
}
}'
```
Creating a task does not return images immediately. Wait in the SDK, poll task endpoints, or use webhooks — see [Async and polling](/guides/async-and-polling).
## How size fits generation
1. Mynth validates `size` (preset, aspect ratio, 4K shorthand, or auto).
2. Shorthand presets expand to aspect ratio + scale.
3. For auto: native provider sizing when supported; otherwise Mynth picks a base aspect ratio from the prompt.
4. The resolved size is mapped to the selected model's presets (exact match, or closest same-orientation ratio).
5. After generation, each image reports true pixel size as `size` (`{width}x{height}`).
For the full request schema, see [Image Generation Request](/reference/image-generation-request).
# Convex full-stack image generation
Source: https://docs.mynth.io/guides/convex-full-stack-image-generation
Build Mynth image generation with Convex actions, signed webhooks, and reactive UI updates.
Build a full-stack image generation flow with Convex: start tasks from a Convex action, persist rows in the Convex database, update them from a signed Mynth webhook, and render results with reactive queries.
Use this when you want durable backend state and live UI updates without polling. For a plain Node server or scripts, use the [JavaScript SDK](/sdk/js-ts/overview) directly. For the webhook helper API alone, see [Convex integration](/sdk/integrations/convex).
## Architecture
```mermaid theme={"theme":"kanagawa-dragon"}
flowchart LR
UI["React client"] -->|useAction| A["Convex action"]
A -->|mynth.image.generateAsync(...)| M["Mynth API"]
A -->|create pending image rows| DB["Convex database"]
M -->|signed webhook| H["Convex HTTP action"]
H -->|mark images success or failed| DB
DB -->|reactive query updates| UI
```
## Before you start
You need:
* a Convex project with auth configured (`ctx.auth.getUserIdentity()`)
* a Mynth API key
* a dashboard webhook (created in a later step)
Install the SDK where your Convex functions run:
```bash theme={"theme":"kanagawa-dragon"}
bun add @mynthio/sdk
```
This guide uses the Convex split:
* **actions** for third-party API calls (`generateAsync`)
* **HTTP actions** for incoming webhooks
* **queries** for reactive UI
## 1. Environment variables
Set these on your Convex deployment:
| Variable | Purpose |
| ---------------------- | ----------------------------------------- |
| `MYNTH_API_KEY` | Server-side Mynth API key |
| `MYNTH_WEBHOOK_SECRET` | Signature secret from the Mynth dashboard |
Your webhook URL will be your Convex HTTP action, for example:
```text theme={"theme":"kanagawa-dragon"}
https://.convex.site/webhooks/mynth
```
## 2. Schema
One `images` table is enough for a first integration:
```ts theme={"theme":"kanagawa-dragon"}
// convex/schema.ts
import { defineSchema, defineTable } from "convex/server";
import { v } from "convex/values";
export default defineSchema({
images: defineTable({
userId: v.string(),
mynthTaskId: v.optional(v.string()),
requestedModel: v.string(),
status: v.union(v.literal("pending"), v.literal("success"), v.literal("failed")),
imageId: v.optional(v.string()),
url: v.optional(v.string()),
error: v.optional(v.string()),
}).index("by_mynth_task", ["mynthTaskId"]),
});
```
This supports one prompt generating several images and a reactive gallery keyed by Mynth task ID.
## 3. Database helpers
Put queries and mutations in `convex/images.ts`:
```ts theme={"theme":"kanagawa-dragon"}
// convex/images.ts
import { v } from "convex/values";
import { internalMutation, internalQuery, query } from "./_generated/server";
export const listByMynthTaskId = query({
args: { mynthTaskId: v.string() },
handler: async (ctx, args) => {
const identity = await ctx.auth.getUserIdentity();
if (!identity) throw new Error("Unauthorized");
const rows = await ctx.db
.query("images")
.withIndex("by_mynth_task", (q) => q.eq("mynthTaskId", args.mynthTaskId))
.collect();
return rows.filter((row) => row.userId === identity.subject);
},
});
export const createPendingImages = internalMutation({
args: {
images: v.array(
v.object({
userId: v.string(),
mynthTaskId: v.optional(v.string()),
requestedModel: v.string(),
}),
),
},
handler: async (ctx, args) => {
return await Promise.all(
args.images.map((image) =>
ctx.db.insert("images", {
userId: image.userId,
mynthTaskId: image.mynthTaskId,
requestedModel: image.requestedModel,
status: "pending",
}),
),
);
},
});
export const getByMynthTaskId = internalQuery({
args: { mynthTaskId: v.string() },
handler: async (ctx, args) => {
return await ctx.db
.query("images")
.withIndex("by_mynth_task", (q) => q.eq("mynthTaskId", args.mynthTaskId))
.collect();
},
});
export const attachMynthTaskId = internalMutation({
args: {
ids: v.array(v.id("images")),
mynthTaskId: v.string(),
},
handler: async (ctx, args) => {
await Promise.all(
args.ids.map((id) =>
ctx.db.patch(id, {
mynthTaskId: args.mynthTaskId,
}),
),
);
},
});
export const markSuccess = internalMutation({
args: {
id: v.id("images"),
imageId: v.string(),
url: v.string(),
},
handler: async (ctx, args) => {
await ctx.db.patch(args.id, {
status: "success",
imageId: args.imageId,
url: args.url,
});
},
});
export const markFailed = internalMutation({
args: {
id: v.id("images"),
error: v.optional(v.string()),
},
handler: async (ctx, args) => {
await ctx.db.patch(args.id, {
status: "failed",
error: args.error,
});
},
});
```
`listByMynthTaskId` is public and scoped to the signed-in user. `getByMynthTaskId` is internal for the webhook handler.
## 4. Start generation from a Convex action
Create `convex/imagesActions.ts`. Pattern:
1. Call `mynth.image.generateAsync()` (returns a `TaskAsync` immediately).
2. Create one pending row per expected image, keyed by `task.id`.
3. Return `mynthTaskId` so the UI can subscribe.
```ts theme={"theme":"kanagawa-dragon"}
// convex/imagesActions.ts
import Mynth, { MynthAPIError, type MynthSDKTypes } from "@mynthio/sdk";
import { v } from "convex/values";
import { action } from "./_generated/server";
import { internal } from "./_generated/api";
export const generate = action({
args: {
prompt: v.string(),
model: v.string(),
count: v.optional(v.number()),
},
handler: async (ctx, args) => {
const identity = await ctx.auth.getUserIdentity();
if (!identity) throw new Error("Unauthorized");
const apiKey = process.env.MYNTH_API_KEY;
if (!apiKey) throw new Error("MYNTH_API_KEY is not set");
const count = args.count ?? 1;
const mynth = new Mynth({ apiKey });
let task;
try {
task = await mynth.image.generateAsync({
prompt: args.prompt,
model: args.model as MynthSDKTypes.ImageGenerationModelId,
count,
});
} catch (error) {
if (error instanceof MynthAPIError) {
throw new Error(`Mynth request failed (${error.status}): ${error.message}`);
}
throw error;
}
await ctx.runMutation(internal.images.createPendingImages, {
images: Array.from({ length: count }, () => ({
userId: identity.subject,
mynthTaskId: task.id,
requestedModel: args.model,
})),
});
return { mynthTaskId: task.id };
},
});
```
Create pending rows **after** `generateAsync` succeeds so a failed API call does not leave orphan rows.
With a dashboard-managed webhook (next steps), you do not pass `webhook` on each request.
## 5. Handle signed webhooks in `convex/http.ts`
`@mynthio/sdk/convex` provides `mynthWebhookAction()`, which:
* verifies `X-Mynth-Signature` (HMAC-SHA256) using `MYNTH_WEBHOOK_SECRET`
* requires `X-Mynth-Event`
* routes on `payload.event` to your handlers
* passes Convex `context` so you can run queries and mutations
```ts theme={"theme":"kanagawa-dragon"}
// convex/http.ts
import { mynthWebhookAction } from "@mynthio/sdk/convex";
import { httpRouter } from "convex/server";
import { httpAction } from "./_generated/server";
import { internal } from "./_generated/api";
const http = httpRouter();
http.route({
path: "/webhooks/mynth",
method: "POST",
handler: httpAction(
mynthWebhookAction({
imageTaskCompleted: async (payload, { context }) => {
const rows = await context.runQuery(internal.images.getByMynthTaskId, {
mynthTaskId: payload.task.id,
});
await Promise.all(
payload.result.images.map((image, index) => {
const row = rows[index];
if (!row) return Promise.resolve();
if (image.status === "success") {
// mynth_url is always present; url may be null for destination-only delivery
return context.runMutation(internal.images.markSuccess, {
id: row._id,
imageId: image.id,
url: image.mynth_url,
});
}
return context.runMutation(internal.images.markFailed, {
id: row._id,
error: image.error.code,
});
}),
);
},
imageTaskFailed: async (payload, { context }) => {
const rows = await context.runQuery(internal.images.getByMynthTaskId, {
mynthTaskId: payload.task.id,
});
await Promise.all(
rows.map((row) =>
context.runMutation(internal.images.markFailed, {
id: row._id,
error: "Task failed",
}),
),
);
},
}),
),
});
export default http;
```
| Handler | Event |
| -------------------- | ------------------------------- |
| `imageTaskCompleted` | `task.image.generate.completed` |
| `imageTaskFailed` | `task.image.generate.failed` |
`imageTaskCompleted` can still include per-image failures (`image.status === "failed"` with `error.code`). `imageTaskFailed` means the whole task failed — there is no `result` payload.
Pass `{ webhookSecret: "..." }` as the second argument to `mynthWebhookAction` if you prefer not to use the env var.
## 6. Create the webhook in the Mynth dashboard
Use the [dashboard webhooks page](https://mynth.io/dashboard/webhooks):
```text theme={"theme":"kanagawa-dragon"}
https://.convex.site/webhooks/mynth
```
Subscribe to:
* `task.image.generate.completed`
* `task.image.generate.failed`
Copy the webhook secret into Convex as `MYNTH_WEBHOOK_SECRET`.
With a dashboard-managed webhook, do not attach a `webhook` object on each `generateAsync(...)`
call for this flow.
## 7. Render results in React
Convex queries are reactive. After the action returns a task ID, subscribe with `useQuery`; the UI updates when the webhook patches rows.
```tsx theme={"theme":"kanagawa-dragon"}
import { useAction, useQuery } from "convex/react";
import { api } from "../convex/_generated/api";
import { useState } from "react";
export function ImageDemo() {
const generateImages = useAction(api.imagesActions.generate);
const [mynthTaskId, setMynthTaskId] = useState(null);
const [error, setError] = useState(null);
const [isGenerating, setIsGenerating] = useState(false);
const images = useQuery(api.images.listByMynthTaskId, mynthTaskId ? { mynthTaskId } : "skip");
return (
);
}
```
Loop summary:
1. Action starts async work and returns `mynthTaskId`.
2. UI subscribes by that ID.
3. Webhook updates rows (success or failure per image, or whole-task failure).
4. Convex pushes the latest state into the UI.
## Map webhook results to rows
### Option 1: Match by `mynthTaskId` and array order
Used above. Create pending rows when the task starts, look them up with `getByMynthTaskId`, and match `payload.result.images[index]` to `rows[index]`.
Best for prototypes and one task with a known image count.
### Option 2: Put Convex row IDs in `metadata`
Create rows first, send their IDs in `metadata`, attach `mynthTaskId` after the API call, then update by ID in the webhook from `payload.request.metadata`:
```ts theme={"theme":"kanagawa-dragon"}
const imageRowIds = await ctx.runMutation(internal.images.createPendingImages, {
images: Array.from({ length: count }, () => ({
userId: identity.subject,
requestedModel: args.model,
})),
});
const task = await mynth.image.generateAsync({
prompt: args.prompt,
model: args.model as MynthSDKTypes.ImageGenerationModelId,
count,
metadata: {
imageRowIds,
},
});
await ctx.runMutation(internal.images.attachMynthTaskId, {
ids: imageRowIds,
mynthTaskId: task.id,
});
```
In the completed handler, read `payload.request.metadata.imageRowIds` and patch each ID directly instead of looking up by task and index.
Use this when you need deterministic row-level mapping. If `generateAsync` fails after rows were created, clean up or mark those rows failed yourself.
Metadata is returned on the task and in webhook payloads. Max size: 2 KB — see [Use Metadata](/guides/use-metadata).
## Request-level custom webhooks
Dashboard-managed webhooks are the default for this Convex pattern.
Use request-level custom webhooks only when you need a different destination per request, a tenant-specific URL, or a temporary endpoint:
```ts theme={"theme":"kanagawa-dragon"}
webhook: {
custom: [{ url: "https://example.com/api/mynth-webhook?token=abc123" }],
}
```
Request-level custom webhooks are **not signed**. `mynthWebhookAction()` expects signed dashboard
deliveries (`X-Mynth-Signature` + `MYNTH_WEBHOOK_SECRET`). For custom URLs, add your own
verification token in the path or query string and handle the raw payload yourself.
Details: [Use Webhooks](/guides/use-webhooks).
## Next steps
`mynthWebhookAction` handlers and event map.
Delivery model, signatures, and event payloads.
Multi-model and multi-prompt generation patterns.
Compare webhooks with SDK task polling.
# Generate Image Alt Text
Source: https://docs.mynth.io/guides/generate-alt-text
Generate short alt text for an existing image with POST /image/alt or the SDK.
Use `POST /image/alt` or `mynth.image.alt()` to generate concise alt text for a single existing image URL. The API creates an async task and returns a `taskId`. The SDK waits for completion by default; use `altAsync()` when you want to poll yourself.
This endpoint is for images you already have (including ones not generated by Mynth). For content classification of existing images, use [Rate Image Content](/guides/rate-images) (`POST /image/rate`).
## Pricing
`/image/alt` costs **\$0.0004 per image**. You are charged only when the task completes successfully.
The cost is reserved up front. If the task fails, the reserve is released. If your balance cannot cover the reserve, the request returns `422 INSUFFICIENT_BALANCE`.
## Generate alt text with the SDK
```ts theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const result = await mynth.image.alt({
url: "https://example.com/photo.webp",
});
console.log(result.alt); // "A ceramic mug on a wooden table."
console.log(result.url);
console.log(result.cost);
```
### Local files
Pass `file` instead of `url` when the image is local. The SDK uploads first, then calls `/image/alt` with the resulting URL. See [Upload input images](/guides/upload-input-images).
```ts theme={"theme":"kanagawa-dragon"}
const result = await mynth.image.alt({
file, // File, Blob, Buffer, or path — same inputs as upload
});
```
## Task failures
If alt text cannot be generated, the task status is `failed`. The SDK's `wait()` throws `TaskAsyncTaskFailedError`.
| Code | Meaning |
| ----------------------- | ----------------------------------------------------- |
| `FETCH_FAILED` | The image could not be downloaded from the URL. |
| `ALT_GENERATION_FAILED` | The image was fetched but alt text generation failed. |
| `UNKNOWN_ERROR` | An unexpected error. Retry if it persists. |
## Constraints
| Constraint | Limit |
| ---------------- | ------------------- |
| URLs per request | 1 |
| Alt text length | 1 to 160 characters |
Alt text describes visible content only. The model is prompted for concise, objective labels (typically under \~100 characters); the API allows up to 160.
## Generate alt text with REST
```bash theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/alt \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/photo.webp"
}'
```
Response (`201`):
```json theme={"theme":"kanagawa-dragon"}
{
"data": {
"taskId": "tsk_01KE7XWWEQ4MCGWKBQKJ1G47RP",
"estimatedCost": "0.0004"
}
}
```
Poll `/tasks/:id` for the completed result. Full fields live in [Image Alt Request](/reference/image-alt-request).
## Start now, wait later
Use `altAsync()` when you want to create the task now and wait later:
```ts theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.altAsync({
url: "https://example.com/photo.webp",
});
console.log(task.id);
const result = await task.wait();
console.log(result.alt);
```
Poll `/tasks/:id/status` and `/tasks/:id`, or listen for `task.image.alt.completed` / `task.image.alt.failed` webhooks.
See [Async and polling](/guides/async-and-polling) and [Use webhooks](/guides/use-webhooks).
## How alt text fits
1. You submit one image URL (or upload a file via the SDK).
2. Mynth fetches the image and generates short alt text with a vision model.
3. On success the result is `{ url, alt }`. On failure the task is `failed`.
4. Billing charges only successful tasks; reserved balance for failures is released.
# Generate Images
Source: https://docs.mynth.io/guides/generate-images
Create image generation tasks with the SDK or POST /image/generate.
Use `POST /image/generate` (or `mynth.image.generate()`) to create an image generation task. The only required field is `prompt`. Defaults: `model: "auto"`, `count: 1`. Omitted `size` is treated as auto.
This page is the core generation how-to. For other jobs, use the sibling guides:
* [Control Prompts](/guides/control-prompts) — negative prompts and magic prompt
* [Control Size](/guides/control-size) — presets, aspect ratios, 4K, output format
* [Upload Input Images](/guides/upload-input-images) — image-to-image inputs
* [Use Content Rating](/guides/use-content-rating) — classify generated images
* [Rate Image Content](/guides/rate-images) / [Generate Image Alt Text](/guides/generate-alt-text) — analyze existing images (not generation)
Full field definitions live in [Image Generation Request](/reference/image-generation-request).
## Pricing
Generation is billed per successful image at the selected model's price. Prices vary by model and scale (base vs 4K). Some models also charge per input image. Browse models at [mynth.io/models](https://mynth.io/models) or use the estimate endpoint below.
When you create a task, Mynth reserves an `estimatedCost` up front. Failed images are refunded, so the final task cost may be lower than the reserve.
`model: "auto"` reserves a flat upper-bound of **\$0.20 per image** until a concrete model is selected. Pin a model for exact pricing.
Magic prompt and generation-time content rating do not add an extra fee today.
## Generate with the SDK
```ts theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth(); // uses MYNTH_API_KEY
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "google/gemini-3.1-flash-image",
size: "landscape",
count: 1,
});
console.log(task.urls); // successful delivery URLs
console.log(task.getImages()[0]?.mynth_url); // always on the Mynth CDN
```
`generate()` creates the task and waits until it completes. For fire-and-forget or browser polling, use `generateAsync()` — see [Async and Polling](/guides/async-and-polling).
## Read the result
A completed task has per-image outcomes. Use `task.urls` or `task.getImages()` for successes only.
Success:
```json theme={"theme":"kanagawa-dragon"}
{
"status": "success",
"id": "img_...",
"url": "https://...",
"mynth_url": "https://...",
"size": "1536x1024"
}
```
`url` is the delivery URL. It is `null` when the image was delivered only to a configured destination and that destination upload failed — `mynth_url` still points at the Mynth CDN.
Failure (per image):
```json theme={"theme":"kanagawa-dragon"}
{
"status": "failed",
"error": {
"code": "RESTRICTED_CONTENT",
"message": "The request was blocked by content moderation."
}
}
```
Known per-image codes: `INVALID_INPUT`, `INVALID_PROMPT`, `RESTRICTED_CONTENT`, `UNKNOWN_ERROR`.
```ts theme={"theme":"kanagawa-dragon"}
for (const image of task.getImages({ includeFailed: true })) {
if (image.status === "success") {
console.log(image.id, image.url ?? image.mynth_url, image.size);
} else {
console.error(image.error.code, image.error.message);
}
}
```
If the whole task fails before producing a result, the task status is `failed` and `errors` is an array of `{ code, message? }` — see [Task error codes](/reference/errors-and-limits#task-error-codes).
## Set common options
| Field | Purpose |
| ----------------- | --------------------------------------------------------------------------------- |
| `prompt` | Required positive prompt (max 8192 characters). |
| `model` | Model ID, or `"auto"` (default). Pin a model in production. |
| `size` | Preset, aspect ratio, or auto. Omitted → auto. |
| `count` | Images per task (default `1`, max `20`). |
| `negative_prompt` | Text to discourage. |
| `magic_prompt` | Set `true` to rewrite the prompt before generation. |
| `inputs` | Input images (URL strings or structured objects; max 20). |
| `output` | `{ format }` — `png`, `jpg`, or `webp`. Omitted → the model's native format. |
| `rating` | Optional content classification on each success. |
| `webhook` | Dashboard off-switch and up to 5 custom endpoints. |
| `destination` | Named storage destination for delivery. |
| `metadata` | Your JSON context (max 2 KB), returned on the task and webhooks. |
| `access` | `{ pat: { enabled } }` — Public Access Token in the create response (default on). |
Details: [Control Prompts](/guides/control-prompts), [Control Size](/guides/control-size), [Upload Input Images](/guides/upload-input-images), [Use Content Rating](/guides/use-content-rating), [Use Webhooks](/guides/use-webhooks), [Use Metadata](/guides/use-metadata).
## Choose a model
Set `model` explicitly in production. `model: "auto"` is an early preview that picks a model from the prompt; cost is reserved as an upper bound until selection.
Browse the catalog at [mynth.io/models](https://mynth.io/models). Model pages document capabilities (inputs, negative prompt, 4K, native auto size).
## Estimate cost before generating
`POST /image/generate/estimate` accepts the same body as generate. It validates the request and returns a cost estimate without creating a task or charging.
```bash theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate/estimate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "google/gemini-3.1-flash-image",
"size": "landscape",
"count": 1
}'
```
```json theme={"theme":"kanagawa-dragon"}
{
"data": {
"estimatedCost": "0.03",
"currency": "usd",
"estimateKind": "exact"
}
}
```
`estimateKind` is `"exact"` when `model` is pinned, or `"upper_bound"` for `model: "auto"`.
## Generate with REST
```bash theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "google/gemini-3.1-flash-image",
"size": "landscape",
"count": 1
}'
```
Create response (`201`):
```json theme={"theme":"kanagawa-dragon"}
{
"data": {
"taskId": "tsk_01KE7XWWEQ4MCGWKBQKJ1G47RP",
"estimatedCost": "0.03",
"access": {
"publicAccessToken": "pat_eyJhbGciOi..."
}
}
}
```
Disable the Public Access Token with `"access": { "pat": { "enabled": false } }` when you only poll from the server with your API key.
Creating a task does not return final images. Wait in the SDK, poll task endpoints, or use webhooks — see [Async and Polling](/guides/async-and-polling).
## How generation fits
1. You submit `POST /image/generate` (SDK or REST). Mynth validates, reserves cost, and enqueues an `image.generate` task.
2. The worker resolves model, size, prompt (and optional magic prompt), then generates each image.
3. Each success is uploaded to the Mynth CDN (and optional destination). Optional rating runs after CDN upload.
4. The task completes with per-image success/failure. Failed images refund their reserved cost.
5. You read results via SDK wait, polling, or webhooks (`task.image.generate.completed` / `task.image.generate.failed`).
For many independent prompts or models, fan out parallel requests — see [Batch Generation](/guides/batch-generation).
# Rate Image Content
Source: https://docs.mynth.io/guides/rate-images
Classify an existing image by URL with POST /image/rate or mynth.image.rate() using default sfw/nsfw or custom levels.
Use `POST /image/rate` or `mynth.image.rate()` to classify a single existing image URL. The API creates an async task and returns a `taskId`. The SDK waits for completion by default; use `rateAsync()` when you want to poll yourself.
For images you generate with Mynth, prefer the `rating` option on `POST /image/generate` instead — see [Use Content Rating](/guides/use-content-rating). That path is free with generation and attaches ratings to each image.
## Pricing
Standalone rating is billed at **\$0.0002 per image**. You are charged only when the task completes successfully.
The cost is reserved up front. If the task fails, the reserve is released. Insufficient balance returns `422 INSUFFICIENT_BALANCE`.
Generation-time rating on `/image/generate` is not billed separately — see [Use Content Rating](/guides/use-content-rating).
## Rate with the default scale
Mode defaults to `nsfw_sfw` and returns `sfw` or `nsfw`:
```ts theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const result = await mynth.image.rate({
url: "https://example.com/photo.webp",
});
console.log(result.level); // "sfw" | "nsfw"
console.log(result.url);
console.log(result.cost);
```
### Default levels
| Level | Meaning |
| ------ | ---------------------------------------------------------------------------------------------------------- |
| `sfw` | Safe for work. No nudity, violence, or other explicit content. Non-erotic lingerie and bikini are allowed. |
| `nsfw` | Not safe for work. Contains nudity, violence, or other explicit content. |
Rating labels describe detected content. They do not override the [Mynth Terms of Service](https://mynth.io/legal/terms).
## Task failures
If the image cannot be rated, the task status is `failed` (not a partial success). The SDK's `wait()` throws `TaskAsyncTaskFailedError`. Common error codes: `FETCH_FAILED`, `RATING_FAILED`, `UNKNOWN_ERROR`.
## Use custom rating levels
Provide `mode: "custom"` with 2–7 levels to replace the default scale:
```ts theme={"theme":"kanagawa-dragon"}
const result = await mynth.image.rate({
url: "https://example.com/photo.webp",
mode: "custom",
levels: [
{ value: "safe", description: "Safe for all audiences" },
{ value: "sensitive", description: "Contains mature or suggestive content" },
{ value: "explicit", description: "Explicit adult content" },
] as const,
});
console.log(result.level); // "safe" | "sensitive" | "explicit"
```
Constraints (validated on the request):
| Constraint | Limit |
| -------------------- | ------------------- |
| URLs per request | 1 |
| Number of levels | 2 to 7 |
| `value` length | 1 to 24 characters |
| `description` length | 1 to 150 characters |
`value` is the string returned in `level`. `description` is what the rating model uses to choose a level.
### Choosing effective levels
Content rating is performed by a vision language model. Results for borderline images may vary between requests.
This feature is for high-level, coarse classification — not fine-grained tagging. Broad, clearly separated categories work best:
* `sfw` / `nsfw`
* `safe` / `suggestive` / `explicit`
* `safe-for-children` / `safe-for-adults` / `nsfw`
* `blood` / `no-blood`
Scales that rely on subtle visual distinctions — for example `subtle-nudity` vs `artistic-nudity` vs `explicit-nudity` — are outside the intended scope and may produce inconsistent results. Test thoroughly before relying on custom levels in production.
## REST example
```bash theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/rate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/photo.webp"
}'
```
Response (`201`):
```json theme={"theme":"kanagawa-dragon"}
{
"data": {
"taskId": "tsk_01KE7XWWEQ4MCGWKBQKJ1G47RP",
"estimatedCost": "0.0002"
}
}
```
Poll `/tasks/:id` for the completed result:
```json theme={"theme":"kanagawa-dragon"}
{
"result": {
"url": "https://example.com/photo.webp",
"level": "sfw"
}
}
```
## Rate without waiting
Use `rateAsync()` when you want to create the task now and wait later:
```ts theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.rateAsync({
url: "https://example.com/photo.webp",
});
console.log(task.id);
const result = await task.wait();
console.log(result.level);
```
Poll task endpoints or listen for `task.image.rate.completed` / `task.image.rate.failed` webhooks — see [Async and polling](/guides/async-and-polling).
## How standalone rating fits
1. You submit one public image URL (or upload a file via the SDK, which converts it to a URL first).
2. Mynth reserves cost and queues an `image.rate` task.
3. On success the result is `{ url, level }`. On failure the task is `failed`.
4. You are charged only for successful ratings.
This creates a separate `image.rate` task (unlike generate-time rating, which runs inside `image.generate`).
## Rate during generation instead
If you want ratings on images Mynth generates, set `rating` on the generate request. That attaches `rating` to each successful image, is free with generation, and does not create a separate rate task.
See [Use Content Rating](/guides/use-content-rating).
# Upload Input Images
Source: https://docs.mynth.io/guides/upload-input-images
Upload local images to Mynth, or pass public URLs, as inputs for image-to-image generation.
Use `POST /image/upload` (or `mynth.image.upload()`) when you need Mynth-hosted URLs for input images. Pass those URLs — or any public image URL — in `inputs` on `POST /image/generate`.
If your images are already publicly reachable over HTTP(S), skip upload and put the URLs in `inputs` directly. This page is not about delivering **generated** images to your own storage — that is the optional `destination` field on generate (see [Image Generation Request](/reference/image-generation-request)).
## Pricing
Upload is free. Mynth does not charge for `POST /image/upload`.
Generation still bills per successful output image. Some models also charge **per input image** on each successful output (`perImage + perInput × inputs.length`). Check the model page for `perInput` pricing.
## Pass a public URL (no upload)
The simplest path: put a URL string in `inputs`.
```ts theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Restyle this photo as a cinematic still",
model: "xai/grok-imagine-image",
inputs: ["https://example.com/input-image.jpg"],
});
```
String entries are shorthand for structured image inputs. Equivalent form:
```ts theme={"theme":"kanagawa-dragon"}
inputs: [
{
type: "image",
source: { type: "url", url: "https://example.com/input-image.jpg" },
},
];
```
## Upload local files with the SDK
`mynth.image.upload()` accepts a `File` / `Blob`, or an array of them, and returns CDN URLs.
```ts theme={"theme":"kanagawa-dragon"}
const { urls } = await mynth.image.upload(file);
const task = await mynth.image.generate({
prompt: "Luxury watch campaign shot with dramatic reflections",
model: "xai/grok-imagine-image",
inputs: urls,
});
```
You can also pass `File` / `Blob` values in `inputs` on generate. The SDK uploads them first, then sends URL inputs to the API:
```ts theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Restyle this photo as a cinematic still",
model: "xai/grok-imagine-image",
inputs: [file], // File or Blob — uploaded automatically
});
```
Structured client inputs can keep a role while uploading a local file:
```ts theme={"theme":"kanagawa-dragon"}
inputs: [
{
type: "image",
as: "source",
source: { type: "file", file },
},
];
```
## Upload with REST
Multipart form field name: `images` (repeated) or `images[]`.
```bash theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/upload \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-F "images=@./reference-1.png" \
-F "images=@./reference-2.jpg"
```
Success (`200`):
```json theme={"theme":"kanagawa-dragon"}
{
"data": {
"urls": [
"https://cdn.example.com/inputs/img_....png",
"https://cdn.example.com/inputs/img_....jpg"
]
}
}
```
Use the returned URLs in generate:
```bash theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Restyle this photo as a cinematic still",
"model": "xai/grok-imagine-image",
"inputs": [
"https://cdn.example.com/inputs/img_....png"
]
}'
```
Creating a task does not return images immediately. Wait in the SDK, poll task endpoints, or use webhooks — see [Async and polling](/guides/async-and-polling).
## Upload limits
| Constraint | Limit |
| ------------------------- | --------------------------------------------------------- |
| Formats | JPEG, PNG, WebP (`image/jpeg`, `image/png`, `image/webp`) |
| Minimum file size | 1 KB (1024 bytes) |
| Maximum file size | 10 MB per file |
| Maximum files per request | 10 |
| Maximum request body | 100 MB |
Validation failures return HTTP `400` with `code: "VALIDATION_ERROR"`. Examples:
| Condition | Message |
| --------------------------- | ----------------------------------------------- |
| No files | `At least one image is required` |
| More than 10 files | `Cannot upload more than 10 images` |
| Unsupported MIME type | `Only JPEG, PNG, and WEBP images are supported` |
| File smaller than 1 KB | `Image must be at least 1024 bytes` |
| File larger than 10 MB | `Image cannot exceed 10485760 bytes` |
| Bytes are not a valid image | `Invalid image file` |
Request body over 100 MB returns HTTP `413`:
```json theme={"theme":"kanagawa-dragon"}
{
"code": "VALIDATION_ERROR",
"message": "Upload body is too large"
}
```
## Set input roles (`as`)
Most models treat inputs as generic references. Some need roles. Set optional `as` on each structured input:
| `as` | Typical use |
| ----------- | ---------------------------------------------------------------------------- |
| `auto` | Default when omitted. Let Mynth resolve the role (try-on, source/reference). |
| `person` | Subject for virtual try-on |
| `garment` | Clothing for virtual try-on |
| `pose` | Pose reference (must be explicit when the model supports it) |
| `source` | Primary image to edit (for example Luma UNI) |
| `reference` | Style or composition guidance |
```ts theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Product hero on marble, studio lighting",
model: "luma/uni-1",
inputs: [
{
type: "image",
as: "source",
source: { type: "url", url: "https://example.com/product.png" },
},
{
type: "image",
as: "reference",
source: { type: "url", url: "https://example.com/style.png" },
},
],
});
```
For role-based models such as Luma UNI, if you omit `as`, Mynth assigns the first undeclared input as `source` and the rest as `reference`. For try-on models, undeclared visual roles can be classified by the worker when the model allows it; `pose` must be declared when you use it.
## Per-model input rules
Support is model-specific:
* whether inputs are allowed at all
* maximum count (and per-role min/max)
* which roles are accepted
The generate request schema allows up to **20** `inputs` entries. Individual models enforce lower caps (for example 1, 3, 10, or 16). If the model does not support inputs, or the roles/counts do not match its contract, the request fails validation (`VALIDATION_ERROR`), for example:
```json theme={"theme":"kanagawa-dragon"}
{
"code": "VALIDATION_ERROR",
"message": "This model does not support inputs"
}
```
Check the **Inputs** section on each [model page](/models/bytedance-seedream-pro) for exact limits and examples.
## How inputs fit generation
1. Obtain public HTTP(S) URLs for each input (upload local files, or use URLs you already host).
2. Send them in `inputs` on `POST /image/generate` (URL strings or structured objects).
3. Mynth validates inputs against the selected model's contract, then runs image-to-image (or role-based) generation.
4. Successful outputs are billed with any model-specific per-input charge.
Upload only hosts input files on the Mynth CDN path (`/inputs/...`). It does not start generation, create a task, or reserve balance.
# Use Content Rating
Source: https://docs.mynth.io/guides/use-content-rating
Classify generated images with default sfw/nsfw or custom levels during image generation.
Use the `rating` option on `POST /image/generate` when you want each successful image to include a content classification. Rating is optional and omitted by default.
For images that already exist (including ones not generated by Mynth), use [Rate Image Content](/guides/rate-images) instead (`POST /image/rate`).
## Pricing
Generation-time rating is included with image generation. Mynth does not charge an extra fee for `rating` on generate requests.
Standalone rating via `/image/rate` is billed separately — see [Rate Image Content](/guides/rate-images).
## Enable default rating
The simplest form is `rating: true`, which uses the built-in `sfw` / `nsfw` scale:
```ts theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Fantasy character concept art",
model: "google/gemini-3.1-flash-image",
rating: true,
});
const image = task.getImages()[0];
console.log(image?.rating?.level); // "sfw" | "nsfw"
```
You can also be explicit with `mode: "nsfw_sfw"` — same scale, same result:
```ts theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Fantasy character concept art",
model: "google/gemini-3.1-flash-image",
rating: { mode: "nsfw_sfw" },
});
```
### Default levels
| Level | Meaning |
| ------ | ---------------------------------------------------------------------------------------------------------- |
| `sfw` | Safe for work. No nudity, violence, or other explicit content. Non-erotic lingerie and bikini are allowed. |
| `nsfw` | Not safe for work. Contains nudity, violence, or other explicit content. |
Rating labels describe detected content. They do not override the [Mynth Terms of Service](https://mynth.io/legal/terms) or permit otherwise prohibited generation.
## Read the rating on the result
When rating is requested, each successful image includes a `rating` object.
Success:
```json theme={"theme":"kanagawa-dragon"}
{
"status": "success",
"id": "img_...",
"url": "https://...",
"mynth_url": "https://...",
"size": "1024x1024",
"rating": {
"status": "success",
"level": "sfw"
}
}
```
If classification fails, the image is still returned and `rating` is:
```json theme={"theme":"kanagawa-dragon"}
{
"status": "failed",
"error": { "code": "RATING_FAILED" }
}
```
Error codes: `FETCH_FAILED`, `RATING_FAILED`, `UNKNOWN_ERROR`.
```ts theme={"theme":"kanagawa-dragon"}
for (const image of task.getImages()) {
if (image.rating?.status === "success") {
console.log(image.id, image.rating.level);
} else if (image.rating?.status === "failed") {
console.error(image.id, image.rating.error.code);
}
}
```
## Use custom rating levels
Provide `mode: "custom"` with your own levels to replace the default scale:
```ts theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Movie poster concept",
model: "google/gemini-3.1-flash-image",
rating: {
mode: "custom",
levels: [
{ value: "safe", description: "Safe for all audiences" },
{ value: "sensitive", description: "Contains mature or suggestive content" },
{ value: "explicit", description: "Explicit adult content" },
] as const,
},
});
console.log(task.getImages()[0]?.rating?.level); // "safe" | "sensitive" | "explicit"
```
Constraints (validated on the request):
| Constraint | Limit |
| -------------------- | ------------------- |
| Number of levels | 2 to 7 |
| `value` length | 1 to 24 characters |
| `description` length | 1 to 150 characters |
`value` is the string returned in `rating.level`. `description` is what the rating model uses to choose a level.
### Choosing effective levels
Content rating is performed by a vision language model. Results for borderline images may vary between requests.
This feature is for high-level, coarse classification — not fine-grained tagging. Broad, clearly separated categories work best:
* `sfw` / `nsfw`
* `safe` / `suggestive` / `explicit`
* `safe-for-children` / `safe-for-adults` / `nsfw`
* `blood` / `no-blood`
Scales that rely on subtle visual distinctions — for example `subtle-nudity` vs `artistic-nudity` vs `explicit-nudity` — are outside the intended scope and may produce inconsistent results. Test thoroughly before relying on custom levels in production.
## REST example
```bash theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Fantasy character concept art",
"model": "google/gemini-3.1-flash-image",
"rating": true
}'
```
Creating a task does not return images immediately. Wait in the SDK, poll task endpoints, or use webhooks — see [Async and polling](/guides/async-and-polling). When the generate task completes, each successful image may include `rating` as shown above.
## How rating fits generation
1. Mynth generates and uploads each image to the Mynth CDN.
2. If `rating` was set, Mynth classifies the image from the CDN URL.
3. The result attaches `rating` with `status: "success"` and `level`, or `status: "failed"` and `error`.
Rating runs once per successfully generated image in the same `image.generate` task. It is not a separate `image.rate` task and does not emit `task.image.rate.*` webhooks. Completed generate webhooks include per-image `rating` when rating was requested.
## Rate existing images instead
To classify an arbitrary image URL, use `POST /image/rate` or `mynth.image.rate()`. That path creates an async `image.rate` task and is billed separately.
See [Rate Image Content](/guides/rate-images).
# Use Destinations
Source: https://docs.mynth.io/guides/use-destinations
Deliver generated images to your own storage (S3, Cloudflare R2, or Bunny Storage).
Use the `destination` option on `POST /image/generate` when you want each successful image uploaded to storage you control. By default, Mynth only stores images on the Mynth CDN — no destination is required.
Skip destinations when the Mynth CDN URL (`mynth_url`) is enough, or when you re-upload from that URL yourself.
Destinations are for **output** delivery. To send **input** images into generation, see [Upload Input Images](/guides/upload-input-images).
## Pricing
Destination delivery is included with image generation. Mynth does not charge an extra fee for uploading to your destination.
You still pay generation cost per successful image. Your storage provider may bill for storage and egress separately.
## Create a destination
Create destinations in the [destinations dashboard](https://mynth.io/dashboard/destinations). That is the primary path for most teams.
1. Open the destinations dashboard.
2. Create a destination with a slug (`name`), provider credentials, and path config.
3. Optionally run a test upload from the dashboard to verify credentials.
The slug is immutable after creation. It must match `/^[a-z0-9-]+$/` (1–64 characters): lowercase letters, digits, and dashes only.
Supported providers:
| Provider `id` | Storage | Secret fields | Notable options |
| ------------- | ---------------------------- | ------------------------------------ | ----------------------------------------------------------------------------------------- |
| `s3` | Amazon S3 (or S3-compatible) | `access_key_id`, `secret_access_key` | `bucket`, `region`, optional `endpoint`, `force_path_style` |
| `r2` | Cloudflare R2 | `access_key_id`, `secret_access_key` | `account_id`, `bucket`, optional `jurisdiction` (`default`, `eu`, `fedramp`) |
| `bunny` | Bunny Storage | `password` | `storage_zone`, optional `region` (`de`, `uk`, `ny`, `la`, `sg`, `se`, `br`, `jh`, `syd`) |
Management API routes (`/destinations`) require OAuth login, not API keys. Use the dashboard, or create via REST after OAuth (see below).
## Pass a destination on generate
Reference the destination by its slug:
```ts theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Product photo of a ceramic mug on marble",
model: "google/gemini-3.1-flash-image",
destination: "my-bucket",
});
const image = task.getImages()[0];
console.log(image?.url); // destination public URL when url_template is set
console.log(image?.mynth_url); // always the Mynth CDN URL
console.log(image?.destination); // { status: "success", name: "my-bucket" }
```
Set a client-wide default with the SDK constructor or `MYNTH_DESTINATION`:
```ts theme={"theme":"kanagawa-dragon"}
const mynth = new Mynth({
destination: "my-bucket", // or omit and set MYNTH_DESTINATION
});
// Per-request destination overrides the client default
await mynth.image.generate({
prompt: "Product photo of a ceramic mug on marble",
model: "google/gemini-3.1-flash-image",
destination: "staging-bucket",
});
```
If the slug does not exist for your account, generate validation fails before the task is created.
## Read delivery fields on the result
When a destination is requested, each successful image includes delivery fields.
Success with `url_template` configured:
```json theme={"theme":"kanagawa-dragon"}
{
"status": "success",
"id": "img_...",
"url": "https://cdn.my-domain.com/images/img_....webp",
"mynth_url": "https://...",
"size": "1024x1024",
"destination": {
"status": "success",
"name": "my-bucket"
}
}
```
| Field | Meaning |
| ------------- | ---------------------------------------------------------------------------------------------------------- |
| `url` | Public URL built from `url_template`, or `null` when no `url_template` is set or destination upload failed |
| `mynth_url` | Always the Mynth CDN URL for a successful image |
| `destination` | Per-image delivery status for the requested destination |
Without `url_template`, a successful destination upload still stores the object, but `url` is `null`. Read `mynth_url` (or build the public URL yourself from the resolved path).
`task.urls` in the SDK only includes non-null `url` values. Prefer `task.getImages()` and read `url` / `mynth_url` / `destination` when you use destinations.
```ts theme={"theme":"kanagawa-dragon"}
for (const image of task.getImages()) {
if (image.destination?.status === "success") {
console.log(image.id, image.url ?? image.mynth_url);
} else if (image.destination?.status === "failed") {
console.error(image.id, image.destination.error.code, image.mynth_url);
}
}
```
## Handle delivery failure
Destination upload runs after the image is generated. **Delivery failure does not fail generation.**
If destination upload fails:
* The image result still has `status: "success"`
* `mynth_url` still points at the Mynth CDN
* `url` is `null`
* `destination` is:
```json theme={"theme":"kanagawa-dragon"}
{
"status": "failed",
"name": "my-bucket",
"error": {
"code": "DESTINATION_UPLOAD_FAILED",
"message": "Failed to upload to destination"
}
}
```
Error codes:
| Code | When |
| --------------------------- | -------------------------------------------------------------------------- |
| `DESTINATION_INIT_FAILED` | Destination could not be loaded (missing config, secret, or provider init) |
| `DESTINATION_UPLOAD_FAILED` | Provider upload failed |
| `DESTINATION_FAILED` | Other delivery error |
Optional error fields: `message`, `provider_response`.
Always check `destination.status` per image when you depend on your own storage.
## Configure path and URL templates
When you create or update a destination, set:
| Config field | Required | Purpose |
| --------------- | -------- | -------------------------------------------------------------------- |
| `path_template` | Yes | Object key/path in your bucket or storage zone (max 2048 characters) |
| `url_template` | No | Public URL for the result `url` field; must include `{path}` |
Mynth resolves `path_template`, uploads the file to that path, then builds `url` from `url_template` by substituting `{path}`. Double slashes in the resulting URL (except after `https:`) are collapsed to a single slash.
### Path template tokens
| Token | Resolves to |
| --------------------- | -------------------------------------------------------- |
| `{id}` | Mynth image id (for example `img_...`) |
| `{YYYY}` | Upload year (from the worker clock) |
| `{MM}` | Month, zero-padded (`01`–`12`) |
| `{DD}` | Day of month, zero-padded |
| `{uuid}` / `{uuidv4}` | Random UUID v4 |
| `{uuidv7}` | UUID v7 |
| `{ulid}` | ULID |
| `{meta.key}` | String value of `metadata.key` from the generate request |
Rules:
* The delivered format extension is always appended (`.webp`, `.png`, or `.jpg`). Do not put the extension in `path_template`.
* `{meta.key}` only substitutes **string** metadata values. Missing or non-string values become the literal text `undefined`.
* Metadata keys in templates may use letters, digits, and underscores only: `{meta.userId}`, not `{meta.user-id}`.
Example:
```text theme={"theme":"kanagawa-dragon"}
path_template: /images/{YYYY}/{MM}/{meta.campaign}/{id}
url_template: https://cdn.my-domain.com/{path}
```
With `metadata: { "campaign": "spring" }`, a delivered format of `webp`, and image id `img_abc`, the object path becomes:
```text theme={"theme":"kanagawa-dragon"}
/images/2026/07/spring/img_abc.webp
```
and `url` becomes:
```text theme={"theme":"kanagawa-dragon"}
https://cdn.my-domain.com/images/2026/07/spring/img_abc.webp
```
Use [Use Metadata](/guides/use-metadata) when path templates need per-request string values via `{meta.key}`.
## REST example
Generate with a destination (API key auth):
```bash theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Product photo of a ceramic mug on marble",
"model": "google/gemini-3.1-flash-image",
"destination": "my-bucket"
}'
```
Creating a task does not return images immediately. Wait in the SDK, poll task endpoints, or use webhooks — see [Async and polling](/guides/async-and-polling). When the generate task completes, each successful image may include `destination` as shown above.
### Create a destination via API (OAuth)
Management routes require OAuth, not an API key:
```bash theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/destinations \
-X POST \
-H "Authorization: Bearer " \
-H "Content-Type: application/json" \
-d '{
"name": "my-bucket",
"provider": {
"id": "s3",
"bucket": "my-bucket",
"region": "us-east-1"
},
"secret": {
"access_key_id": "...",
"secret_access_key": "..."
},
"config": {
"path_template": "/images/{id}",
"url_template": "https://cdn.my-domain.com/{path}"
}
}'
```
Other management endpoints (OAuth):
| Method | Path | Purpose |
| -------- | ------------------------ | ------------------------------------------------------------------------- |
| `GET` | `/destinations` | List destinations |
| `GET` | `/destinations/:id` | Get one by id (`dst_...`) |
| `PUT` | `/destinations/:id` | Update `provider`, `config`, and optionally `secret` (slug cannot change) |
| `DELETE` | `/destinations/:id` | Delete |
| `POST` | `/destinations/:id/test` | Upload a test file; body `{ "path": "test/upload.txt" }` |
## How destinations fit generation
1. Mynth generates the image in the requested `output.format`, or the model's native format when none was requested.
2. Mynth uploads the image to the Mynth CDN and, if `destination` was set, to your storage in parallel.
3. The result sets `mynth_url` to the CDN URL.
4. If destination upload succeeded, `destination.status` is `"success"` and `url` is the `url_template` result (or `null` without `url_template`).
5. If destination upload failed, the image remains successful: `url` is `null`, `mynth_url` is still set, and `destination` reports the error.
Delivery runs once per successfully generated image in the same `image.generate` task. Completed generate webhooks include per-image `destination` when a destination was requested.
## Related guides
* [Generate Images](/guides/generate-images) — full generate request options
* [Use Metadata](/guides/use-metadata) — request metadata and `{meta.key}` path tokens
* [Upload Input Images](/guides/upload-input-images) — inputs for generation, not output storage
* [Use Webhooks](/guides/use-webhooks) — receive completed results with destination fields
# Use Metadata
Source: https://docs.mynth.io/guides/use-metadata
Attach your own JSON context to image generation tasks and read it back from results and webhooks.
Use the `metadata` option on `POST /image/generate` when you need to carry application identifiers through the task lifecycle. Metadata is optional and omitted by default.
Metadata is only available on image generation (`image.generate`). Content rating and alt text requests do not accept `metadata`.
For the full generate request field list, see [Image Generation Request](/reference/image-generation-request). To receive completed tasks without polling, see [Use Webhooks](/guides/use-webhooks).
## Pricing
Metadata is free. Mynth does not charge for attaching or returning `metadata`.
## Attach metadata
Pass a JSON object on the generate request:
```ts theme={"theme":"kanagawa-dragon"}
const result = await mynth.image.generate({
prompt: "Packaging concept for a botanical tea brand",
model: "google/gemini-3.1-flash-image",
metadata: {
requestId: "req_123",
userId: "usr_123",
campaign: "spring-launch",
},
});
console.log(result.getMetadata());
// { requestId: "req_123", userId: "usr_123", campaign: "spring-launch" }
```
Mynth stores the object on the task as `request.metadata` and returns it unchanged. Nested objects and arrays are allowed as values.
## Read metadata back
Metadata is echoed in these places:
| Surface | Where to read it |
| ---------------------------- | -------------------------- |
| SDK completed result | `result.getMetadata()` |
| Full task (`GET /tasks/:id`) | `data.request.metadata` |
| Webhooks | `payload.request.metadata` |
`GET /tasks/:id/result` does not include `request`, so it does not return metadata. Use the full task endpoint, the SDK, or webhooks when you need it.
Webhook example (fields abbreviated):
```json theme={"theme":"kanagawa-dragon"}
{
"event": "task.image.generate.completed",
"task": { "id": "tsk_..." },
"request": {
"prompt": "Packaging concept for a botanical tea brand",
"model": "google/gemini-3.1-flash-image",
"metadata": {
"requestId": "req_123",
"userId": "usr_123",
"campaign": "spring-launch"
}
},
"result": {
"model": "google/gemini-3.1-flash-image",
"images": []
}
}
```
Failed generate webhooks still include `request`, so metadata is available on both `task.image.generate.completed` and `task.image.generate.failed`.
## Constraints
| Constraint | Limit |
| ------------ | ------------------------------------------------------------- |
| Type | JSON object (not a string, number, or array at the top level) |
| Maximum size | 2 KB (`2048` bytes of `JSON.stringify` UTF-8) |
If the payload is too large, the API rejects the request with a validation error:
```json theme={"theme":"kanagawa-dragon"}
{
"code": "VALIDATION_ERROR",
"message": "Metadata cannot exceed 2048 bytes (current size: 2100 bytes)"
}
```
## REST example
```bash theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Packaging concept for a botanical tea brand",
"model": "google/gemini-3.1-flash-image",
"metadata": {
"requestId": "req_123",
"userId": "usr_123",
"campaign": "spring-launch"
}
}'
```
Creating a task does not return images immediately. Wait in the SDK, poll task endpoints, or use webhooks — see [Async and polling](/guides/async-and-polling). After completion, read metadata from the full task object or the webhook `request`.
## How metadata fits generation
1. You send `metadata` on the generate request.
2. Mynth stores it on the task as part of `request`.
3. Generation runs as usual. Metadata does not change model selection, billing, or image output.
4. Completed and failed deliveries include the same `request.metadata` you sent.
Common uses:
* Map Mynth tasks back to your jobs, users, orders, or database rows
* Correlate webhook deliveries without an extra lookup
* Pass string keys used by destination path templates as `{meta.key}` (string values only)
For a full-stack mapping pattern with Convex, see [Convex full-stack image generation](/guides/convex-full-stack-image-generation#option-2-put-convex-image-ids-into-mynth-metadata).
# Use Webhooks
Source: https://docs.mynth.io/guides/use-webhooks
Receive task lifecycle events on your backend with dashboard-managed or request-level webhooks.
Use webhooks when a finished task should trigger backend work — persist results, update records, moderate, or fan out to other systems. Mynth POSTs a JSON payload to your endpoint when a task completes or fails.
For live browser progress, use [Async and polling](/guides/async-and-polling) or [Browser Polling](/tutorials/browser-polling) instead. You can combine both: poll for the UI and still receive webhooks for durable server-side handling.
Event names, headers, and full payload shapes are listed in the [Webhooks reference](/reference/webhooks).
## Register a dashboard webhook
Dashboard-managed webhooks are the default production path. They are reusable across tasks and signed with HMAC-SHA256.
1. Open the [webhooks dashboard](https://mynth.io/dashboard/webhooks).
2. Create a webhook with your HTTPS endpoint and the events you care about.
3. Save the signing secret when it is shown — you need it to verify deliveries.
Once enabled, matching tasks send webhooks automatically. You do not need a `webhook` field on each generate request.
```ts theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Packaging concept for a botanical tea brand",
model: "google/gemini-3.1-flash-image",
});
// Task is accepted; your endpoint receives the result when it finishes
console.log(task.id);
```
## Handle a delivery
Every delivery is an HTTP `POST` with `Content-Type: application/json`.
| Header | Present on | Meaning |
| ------------------- | ------------------------------- | ----------------------------------------------------------------- |
| `X-Mynth-Event` | All deliveries | Specific event name (for example `task.image.generate.completed`) |
| `X-Mynth-Signature` | Dashboard-managed webhooks only | HMAC-SHA256 signature in `t=...,v1=...` format |
| `Content-Type` | All deliveries | `application/json` |
Respond with a `2xx` status as soon as you accept the payload. Treat deliveries as at-least-once: make handlers idempotent using `task.id`.
### Completed generate task
```json theme={"theme":"kanagawa-dragon"}
{
"event": "task.image.generate.completed",
"task": {
"id": "tsk_01KE7XWWEQ4MCGWKBQKJ1G47RP"
},
"request": {
"prompt": "Packaging concept for a botanical tea brand",
"model": "google/gemini-3.1-flash-image"
},
"result": {
"model": "google/gemini-3.1-flash-image",
"images": [
{
"status": "success",
"id": "img_123",
"url": "https://...",
"mynth_url": "https://...",
"size": "1024x1024"
}
]
}
}
```
### Failed generate task
Failed tasks include `event`, `task`, `request`, and `errors`. They do not include `result`.
```json theme={"theme":"kanagawa-dragon"}
{
"event": "task.image.generate.failed",
"task": {
"id": "tsk_01KE7XWWEQ4MCGWKBQKJ1G47RP"
},
"request": {
"prompt": "Packaging concept for a botanical tea brand",
"model": "google/gemini-3.1-flash-image"
},
"errors": [
{
"code": "RESTRICTED_CONTENT",
"message": "The request was blocked by content moderation."
}
]
}
```
Branch on `errors[0].code`. Treat client-side failures as terminal; retry only when the code is transient:
```ts theme={"theme":"kanagawa-dragon"}
const code = payload.errors[0]?.code;
if (code === "RESTRICTED_CONTENT" || code === "INVALID_PROMPT") {
// Terminal — fix the prompt or content before submitting again
await markFailed(payload.task.id, code);
} else if (code === "RATE_LIMITED" || code === "TIMEOUT" || code === "PROVIDER_ERROR") {
// Transient — safe to resubmit the same request
await enqueueRetry(payload.request);
} else {
await markFailed(payload.task.id, code ?? "UNKNOWN_ERROR");
}
```
See [Task error codes](/reference/errors-and-limits#task-error-codes) for the full list.
`request` is the task request as stored by Mynth (including `metadata` when you set it). See [Use Metadata](/guides/use-metadata).
For rate and alt payloads, see the [Webhooks reference](/reference/webhooks).
## Verify webhook signatures
Dashboard-managed deliveries include `X-Mynth-Signature`. Verify it before trusting the body.
Header format:
```text theme={"theme":"kanagawa-dragon"}
t={timestamp},v1={signature}
```
Signed message:
```text theme={"theme":"kanagawa-dragon"}
{timestamp}.{raw_request_body}
```
Use HMAC-SHA256 with your webhook secret. Always verify against the raw request body — not a parsed and re-serialized object.
```ts theme={"theme":"kanagawa-dragon"}
import { createHmac, timingSafeEqual } from "crypto";
function verifyWebhookSignature(signatureHeader: string, rawBody: string, secret: string): boolean {
const parts = Object.fromEntries(signatureHeader.split(",").map((part) => part.split("=", 2)));
const timestamp = parts["t"];
const expected = parts["v1"];
if (!timestamp || !expected) return false;
const computed = createHmac("sha256", secret).update(`${timestamp}.${rawBody}`).digest("hex");
const expectedBuf = Buffer.from(expected, "utf8");
const computedBuf = Buffer.from(computed, "utf8");
if (expectedBuf.length !== computedBuf.length) return false;
return timingSafeEqual(expectedBuf, computedBuf);
}
```
Get the secret from the [webhooks dashboard](https://mynth.io/dashboard/webhooks) when you create the webhook.
For Convex, use `@mynthio/sdk/convex` — see [Convex integration](/sdk/integrations/convex).
## Attach request-level custom webhooks
On `image.generate` only, you can add up to 5 extra endpoints per task with `webhook.custom`. These are useful for task-specific or temporary URLs.
```ts theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Packaging concept for a botanical tea brand",
model: "google/gemini-3.1-flash-image",
webhook: {
custom: [{ url: "https://example.com/api/mynth-webhook?token=abc123" }],
},
});
```
Custom endpoints are **not signed**. Put your own verification token in the path or query string (as above), or use another shared secret your backend checks.
To skip dashboard-managed webhooks for one task while still sending custom endpoints:
```ts theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Packaging concept for a botanical tea brand",
model: "google/gemini-3.1-flash-image",
webhook: {
dashboard: false,
custom: [{ url: "https://example.com/api/mynth-webhook?token=abc123" }],
},
});
```
| Constraint | Limit |
| ---------------------------------- | ----------------------------------------- |
| Custom endpoints per generate task | 1 to 5 |
| Custom endpoint shape | `{ url: string }` |
| Signature on custom endpoints | None — add your own token or secret check |
| `webhook` on rate / alt requests | Not supported; use dashboard webhooks |
## Choose events
Mynth delivers these concrete events:
| Event | When it fires |
| ------------------------------- | -------------------------------- |
| `task.image.generate.completed` | Image generation task succeeded |
| `task.image.generate.failed` | Image generation task failed |
| `task.image.rate.completed` | Standalone rating task succeeded |
| `task.image.rate.failed` | Standalone rating task failed |
| `task.image.alt.completed` | Alt text task succeeded |
| `task.image.alt.failed` | Alt text task failed |
When you subscribe in the dashboard, you can also use broader filters:
| Subscription | Matches |
| ---------------- | ----------------------------- |
| `task.completed` | Any `*.completed` event above |
| `task.failed` | Any `*.failed` event above |
| `all` | Every event |
The `X-Mynth-Event` header and `payload.event` always use the specific event name (for example `task.image.generate.completed`), even if the webhook was subscribed with `task.completed` or `all`.
Generation-time content rating (`rating` on generate) does **not** emit `task.image.rate.*`. Rating is attached to the generate result; see [Use Content Rating](/guides/use-content-rating).
## Delivery retries
Mynth retries failed deliveries (non-2xx or network errors) with exponential backoff and jitter, up to 12 attempts.
For dashboard-managed webhooks, consecutive failures are tracked. After 30 consecutive failed delivery attempts, Mynth disables that webhook. Fix the endpoint, then re-enable it in the dashboard.
Custom request-level endpoints are not auto-disabled; retries still apply for that job.
## REST example
```bash theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Packaging concept for a botanical tea brand",
"model": "google/gemini-3.1-flash-image",
"webhook": {
"custom": [
{ "url": "https://example.com/api/mynth-webhook?token=abc123" }
]
}
}'
```
If you already have a dashboard webhook subscribed to generate events, omit `webhook` and rely on that registration.
## When to use webhooks vs polling
| Approach | Best for |
| -------- | ------------------------------------------------------- |
| Webhooks | Backend workflows, durable pipelines, cross-system sync |
| Polling | Browser previews, live progress, short user sessions |
| Both | UI waits on poll; server persists via webhook |
## Next steps
* Payload reference: [Webhooks](/reference/webhooks)
* Polling and task endpoints: [Async and polling](/guides/async-and-polling)
* Convex helper: [Convex integration](/sdk/integrations/convex)
* Full Convex walkthrough: [Convex full-stack image generation](/guides/convex-full-stack-image-generation)
# Mynth Documentation
Source: https://docs.mynth.io/index
Build image generation workflows with the Mynth API, SDK, webhooks, and browser-safe task polling.
Mynth is an image generation platform for developers. You send a prompt and optional controls, Mynth creates an async task, and you receive results through polling, webhooks, or both.
The documentation is organized for external teams integrating Mynth into production products. It focuses on how to make requests, retrieve results, and design safe client and server flows.
Generate your first image with the JavaScript SDK.
Use the SDK or the REST API to create image tasks.
Deliver completed task results to your backend automatically.
Rate existing images for \$0.0002 per image.
Generate short alt text for existing images.
Build an async flow that is safe to use from the browser.
## What you can build
* Text-to-image generation with automatic model and size selection
* Async pipelines that return immediately and finish in the background
* Parallel multi-model or multi-prompt generation with ordinary client-side concurrency
* Client-side status polling without exposing your API key
* Server-side integrations that receive signed webhook events
* Structured prompts, input images, content rating, alt text, and metadata-driven workflows
## Start with the right path
Use this documentation based on the kind of problem you need to solve:
* New integration: start with [Quickstart](/quickstart)
* Need async UI flows: read [Browser Polling](/tutorials/browser-polling)
* Need content rating: read [Rate Image Content](/guides/rate-images)
* Need image alt text: read [Generate Image Alt Text](/guides/generate-alt-text)
* Need webhook delivery: read [Use webhooks](/guides/use-webhooks)
* Need request details: read [Image generation request reference](/reference/image-generation-request)
* Need SDK behavior: read [JS/TS SDK overview](/sdk/js-ts/overview)
## Models
* Browse the live model catalog at [mynth.io/models](https://mynth.io/models)
* In the SDK, use `AVAILABLE_MODELS` when you need runtime model metadata
* See [Types and Models](/sdk/js-ts/types-and-models) for capability checking
# Qwen Image 2.0
Source: https://docs.mynth.io/models/alibaba-qwen-image-2-0
Use Qwen Image 2.0 with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
alibaba/qwen-image-2.0
```
See pricing & more on [mynth.io](https://mynth.io/models/alibaba%2Fqwen-image-2.0).
## Capabilities
| | |
| ------------------------- | ------------------------------ |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | Up to 1 image (image-to-image) |
| **Native auto size** | No |
| **Magic prompt** | Supported |
| **Native enhance prompt** | Yes |
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "alibaba/qwen-image-2.0",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "alibaba/qwen-image-2.0",
"size": "landscape",
"count": 1
}'
```
## Use inputs
Pass up to **1** input image for image-to-image. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Restyle this photo as a cinematic still",
model: "alibaba/qwen-image-2.0",
inputs: ["https://example.com/input-image.jpg"],
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Restyle this photo as a cinematic still",
"model": "alibaba/qwen-image-2.0",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/input-image.jpg" }
}
],
"size": "landscape"
}'
```
# Qwen Image 2.0 Pro
Source: https://docs.mynth.io/models/alibaba-qwen-image-2-0-pro
Use Qwen Image 2.0 Pro with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
alibaba/qwen-image-2.0-pro
```
See pricing & more on [mynth.io](https://mynth.io/models/alibaba%2Fqwen-image-2.0-pro).
## Capabilities
| | |
| ------------------------- | ------------------------------ |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | Up to 1 image (image-to-image) |
| **Native auto size** | No |
| **Magic prompt** | Supported |
| **Native enhance prompt** | Yes |
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "alibaba/qwen-image-2.0-pro",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "alibaba/qwen-image-2.0-pro",
"size": "landscape",
"count": 1
}'
```
## Use inputs
Pass up to **1** input image for image-to-image. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Restyle this photo as a cinematic still",
model: "alibaba/qwen-image-2.0-pro",
inputs: ["https://example.com/input-image.jpg"],
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Restyle this photo as a cinematic still",
"model": "alibaba/qwen-image-2.0-pro",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/input-image.jpg" }
}
],
"size": "landscape"
}'
```
# Qwen Image 3.0
Source: https://docs.mynth.io/models/alibaba-qwen-image-3-0
Use Qwen Image 3.0 with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
alibaba/qwen-image-3.0
```
See pricing & more on [mynth.io](https://mynth.io/models/alibaba%2Fqwen-image-3.0).
## Capabilities
| | |
| ------------------------- | ------------------------------- |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | Up to 3 images (image-to-image) |
| **Native auto size** | No |
| **Magic prompt** | Supported |
| **Native enhance prompt** | Yes |
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "A bilingual travel poster with precise typography and layered paper textures",
model: "alibaba/qwen-image-3.0",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A bilingual travel poster with precise typography and layered paper textures",
"model": "alibaba/qwen-image-3.0",
"size": "landscape",
"count": 1
}'
```
## Use inputs
Pass up to **3** input images for image-to-image. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Combine these references into a cinematic product campaign",
model: "alibaba/qwen-image-3.0",
inputs: [
"https://example.com/product.jpg",
"https://example.com/style.jpg",
"https://example.com/composition.jpg",
],
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Combine these references into a cinematic product campaign",
"model": "alibaba/qwen-image-3.0",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/product.jpg" }
},
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/style.jpg" }
},
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/composition.jpg" }
}
],
"size": "landscape"
}'
```
# Qwen Image 3.0 Pro
Source: https://docs.mynth.io/models/alibaba-qwen-image-3-0-pro
Use Qwen Image 3.0 Pro with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
alibaba/qwen-image-3.0-pro
```
See pricing & more on [mynth.io](https://mynth.io/models/alibaba%2Fqwen-image-3.0-pro).
## Capabilities
| | |
| ------------------------- | ------------------------------- |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | Up to 3 images (image-to-image) |
| **Native auto size** | No |
| **Magic prompt** | Supported |
| **Native enhance prompt** | Yes |
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "A premium bilingual campaign poster with precise typography and realistic materials",
model: "alibaba/qwen-image-3.0-pro",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A premium bilingual campaign poster with precise typography and realistic materials",
"model": "alibaba/qwen-image-3.0-pro",
"size": "landscape",
"count": 1
}'
```
## Use inputs
Pass up to **3** input images for image-to-image. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Combine these references into a polished editorial campaign",
model: "alibaba/qwen-image-3.0-pro",
inputs: [
"https://example.com/subject.jpg",
"https://example.com/style.jpg",
"https://example.com/composition.jpg",
],
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Combine these references into a polished editorial campaign",
"model": "alibaba/qwen-image-3.0-pro",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/subject.jpg" }
},
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/style.jpg" }
},
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/composition.jpg" }
}
],
"size": "landscape"
}'
```
# FLUX.1 Dev
Source: https://docs.mynth.io/models/black-forest-labs-flux-1-dev
Use FLUX.1 Dev with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
black-forest-labs/flux.1-dev
```
See pricing & more on [mynth.io](https://mynth.io/models/black-forest-labs%2Fflux.1-dev).
## Capabilities
| | |
| -------------------- | ------------- |
| **Modes** | Text-to-image |
| **Inputs** | None |
| **Native auto size** | No |
| **Magic prompt** | Supported |
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "black-forest-labs/flux.1-dev",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "black-forest-labs/flux.1-dev",
"size": "landscape",
"count": 1
}'
```
# FLUX.1 Schnell
Source: https://docs.mynth.io/models/black-forest-labs-flux-1-schnell
Use FLUX.1 Schnell with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
black-forest-labs/flux-1-schnell
```
See pricing & more on [mynth.io](https://mynth.io/models/black-forest-labs%2Fflux-1-schnell).
## Capabilities
| | |
| -------------------- | ------------- |
| **Modes** | Text-to-image |
| **Inputs** | None |
| **Native auto size** | No |
| **Magic prompt** | Supported |
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "black-forest-labs/flux-1-schnell",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "black-forest-labs/flux-1-schnell",
"size": "landscape",
"count": 1
}'
```
# FLUX.2 Dev
Source: https://docs.mynth.io/models/black-forest-labs-flux-2-dev
Use FLUX.2 Dev with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
black-forest-labs/flux.2-dev
```
See pricing & more on [mynth.io](https://mynth.io/models/black-forest-labs%2Fflux.2-dev).
## Capabilities
| | |
| -------------------- | ------------------------------- |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | Up to 3 images (image-to-image) |
| **Native auto size** | No |
| **Magic prompt** | Supported |
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "black-forest-labs/flux.2-dev",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "black-forest-labs/flux.2-dev",
"size": "landscape",
"count": 1
}'
```
## Use inputs
Pass up to **3** input images for image-to-image. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Restyle this photo as a cinematic still",
model: "black-forest-labs/flux.2-dev",
inputs: ["https://example.com/input-image.jpg"],
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Restyle this photo as a cinematic still",
"model": "black-forest-labs/flux.2-dev",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/input-image.jpg" }
}
],
"size": "landscape"
}'
```
# FLUX.2 Flex
Source: https://docs.mynth.io/models/black-forest-labs-flux-2-flex
Use FLUX.2 Flex with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
black-forest-labs/flux.2-flex
```
See pricing & more on [mynth.io](https://mynth.io/models/black-forest-labs%2Fflux.2-flex).
## Capabilities
| | |
| -------------------- | ------------------------------- |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | Up to 3 images (image-to-image) |
| **Native auto size** | No |
| **Magic prompt** | Supported |
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "black-forest-labs/flux.2-flex",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "black-forest-labs/flux.2-flex",
"size": "landscape",
"count": 1
}'
```
## Use inputs
Pass up to **3** input images for image-to-image. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Restyle this photo as a cinematic still",
model: "black-forest-labs/flux.2-flex",
inputs: ["https://example.com/input-image.jpg"],
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Restyle this photo as a cinematic still",
"model": "black-forest-labs/flux.2-flex",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/input-image.jpg" }
}
],
"size": "landscape"
}'
```
# FLUX.2 Klein
Source: https://docs.mynth.io/models/black-forest-labs-flux-2-klein-4b
Use FLUX.2 Klein with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
black-forest-labs/flux.2-klein-4b
```
See pricing & more on [mynth.io](https://mynth.io/models/black-forest-labs%2Fflux.2-klein-4b).
## Capabilities
| | |
| -------------------- | ------------------------------- |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | Up to 4 images (image-to-image) |
| **Native auto size** | No |
| **Magic prompt** | Supported |
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "black-forest-labs/flux.2-klein-4b",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "black-forest-labs/flux.2-klein-4b",
"size": "landscape",
"count": 1
}'
```
## Use inputs
Pass up to **4** input images for image-to-image. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Restyle this photo as a cinematic still",
model: "black-forest-labs/flux.2-klein-4b",
inputs: ["https://example.com/input-image.jpg"],
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Restyle this photo as a cinematic still",
"model": "black-forest-labs/flux.2-klein-4b",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/input-image.jpg" }
}
],
"size": "landscape"
}'
```
# FLUX.2 Max
Source: https://docs.mynth.io/models/black-forest-labs-flux-2-max
Use FLUX.2 Max with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
black-forest-labs/flux.2-max
```
See pricing & more on [mynth.io](https://mynth.io/models/black-forest-labs%2Fflux.2-max).
## Capabilities
| | |
| -------------------- | ------------------------------- |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | Up to 3 images (image-to-image) |
| **Native auto size** | No |
| **Magic prompt** | Supported |
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "black-forest-labs/flux.2-max",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "black-forest-labs/flux.2-max",
"size": "landscape",
"count": 1
}'
```
## Use inputs
Pass up to **3** input images for image-to-image. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Restyle this photo as a cinematic still",
model: "black-forest-labs/flux.2-max",
inputs: ["https://example.com/input-image.jpg"],
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Restyle this photo as a cinematic still",
"model": "black-forest-labs/flux.2-max",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/input-image.jpg" }
}
],
"size": "landscape"
}'
```
# FLUX.2 Pro
Source: https://docs.mynth.io/models/black-forest-labs-flux-2-pro
Use FLUX.2 Pro with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
black-forest-labs/flux.2-pro
```
See pricing & more on [mynth.io](https://mynth.io/models/black-forest-labs%2Fflux.2-pro).
## Capabilities
| | |
| -------------------- | ------------------------------- |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | Up to 3 images (image-to-image) |
| **Native auto size** | No |
| **Magic prompt** | Supported |
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "black-forest-labs/flux.2-pro",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "black-forest-labs/flux.2-pro",
"size": "landscape",
"count": 1
}'
```
## Use inputs
Pass up to **3** input images for image-to-image. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Restyle this photo as a cinematic still",
model: "black-forest-labs/flux.2-pro",
inputs: ["https://example.com/input-image.jpg"],
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Restyle this photo as a cinematic still",
"model": "black-forest-labs/flux.2-pro",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/input-image.jpg" }
}
],
"size": "landscape"
}'
```
# FLUX Virtual Try-On
Source: https://docs.mynth.io/models/black-forest-labs-flux-virtual-try-on
Use FLUX Virtual Try-On with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
black-forest-labs/flux-virtual-try-on
```
See pricing & more on [mynth.io](https://mynth.io/models/black-forest-labs%2Fflux-virtual-try-on).
## Capabilities
| | |
| -------------------- | -------------------- |
| **Modes** | Image-to-image |
| **Inputs** | 1 person + 1 garment |
| **Native auto size** | Yes |
| **Magic prompt** | Supported |
Requires exactly one `person` image and one `garment` image. You can set `as: "auto"` and Mynth
will classify them, or declare roles explicitly.
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "A person wearing a red jacket",
model: "black-forest-labs/flux-virtual-try-on",
inputs: [
{
type: "image",
as: "person",
source: { type: "url", url: "https://example.com/person.jpg" },
},
{
type: "image",
as: "garment",
source: { type: "url", url: "https://example.com/jacket.jpg" },
},
],
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A person wearing a red jacket",
"model": "black-forest-labs/flux-virtual-try-on",
"inputs": [
{
"type": "image",
"as": "person",
"source": { "type": "url", "url": "https://example.com/person.jpg" }
},
{
"type": "image",
"as": "garment",
"source": { "type": "url", "url": "https://example.com/jacket.jpg" }
}
]
}'
```
## Auto size
This model supports **native auto size**. Output size is derived from the person image.
```ts theme={"theme":"kanagawa-dragon"}
size: "auto";
// or
size: {
type: "auto";
}
```
See [Control size](/guides/control-size).
# FIBO Edit 1.5
Source: https://docs.mynth.io/models/bria-fibo-edit-1-5
Use Bria FIBO Edit 1.5 with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
bria/fibo-edit-1.5
```
See pricing & more on [mynth.io](https://mynth.io/models/bria%2Ffibo-edit-1.5).
## Capabilities
| | |
| -------------------- | -------------------- |
| **Modes** | Image-to-image |
| **Inputs** | 1–4 reference images |
| **Native auto size** | Yes |
| **Magic prompt** | Supported |
FIBO Edit 1.5 follows natural-language edit instructions against one to four references. Use it for object and character composites, virtual try-on, background replacement, and style transfer. Trained on licensed data.
## Edit images
Pass between **1 and 4** input images. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Uncross her arms and place the serum bottle in her right hand, label toward the camera",
model: "bria/fibo-edit-1.5",
inputs: ["https://example.com/portrait.jpg", "https://example.com/product.png"],
size: "auto",
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Uncross her arms and place the serum bottle in her right hand, label toward the camera",
"model": "bria/fibo-edit-1.5",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/portrait.jpg" }
},
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/product.png" }
}
],
"size": "auto"
}'
```
## Auto size
This model supports **native auto size**. Left unset, output keeps the first reference image's ratio.
```ts theme={"theme":"kanagawa-dragon"}
size: "auto";
```
See [Control size](/guides/control-size).
# FIBO Generate 1.5
Source: https://docs.mynth.io/models/bria-fibo-generate-1-5
Use Bria FIBO Generate 1.5 with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
bria/fibo-generate-1.5
```
See pricing & more on [mynth.io](https://mynth.io/models/bria%2Ffibo-generate-1.5).
## Capabilities
| | |
| -------------------- | ------------- |
| **Modes** | Text-to-image |
| **Inputs** | None |
| **Native auto size** | No |
| **Magic prompt** | Supported |
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: 'Editorial travel poster titled "NIGHT MARKET", precise bilingual typography',
model: "bria/fibo-generate-1.5",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Editorial travel poster titled \"NIGHT MARKET\", precise bilingual typography",
"model": "bria/fibo-generate-1.5",
"size": "landscape",
"count": 1
}'
```
# Seedream 5.0 Lite
Source: https://docs.mynth.io/models/bytedance-seedream-5-0-lite
Use Seedream 5.0 Lite with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
bytedance/seedream-5.0-lite
```
See pricing & more on [mynth.io](https://mynth.io/models/bytedance%2Fseedream-5.0-lite).
## Capabilities
| | |
| -------------------- | -------------------------------- |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | Up to 10 images (image-to-image) |
| **Native auto size** | No |
| **Magic prompt** | Supported |
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Editorial product photograph of a ceramic coffee set on a sunlit marble counter",
model: "bytedance/seedream-5.0-lite",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Editorial product photograph of a ceramic coffee set on a sunlit marble counter",
"model": "bytedance/seedream-5.0-lite",
"size": "landscape",
"count": 1
}'
```
## Use inputs
Pass up to **10** input images for image-to-image. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Restyle this photo as a cinematic still",
model: "bytedance/seedream-5.0-lite",
inputs: ["https://example.com/input-image.jpg"],
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Restyle this photo as a cinematic still",
"model": "bytedance/seedream-5.0-lite",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/input-image.jpg" }
}
],
"size": "landscape"
}'
```
# Seedream Pro
Source: https://docs.mynth.io/models/bytedance-seedream-pro
Use Seedream Pro with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
bytedance/seedream-pro
```
Currently runs **Seedream 5.0 Pro** under the hood. The `bytedance/seedream-pro` ID always tracks the latest Seedream Pro version available through Mynth. Pricing may be adjusted if a newer version is more expensive to serve.
See pricing & more on [mynth.io](https://mynth.io/models/bytedance%2Fseedream-pro).
## Capabilities
| | |
| -------------------- | -------------------------------- |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | Up to 10 images (image-to-image) |
| **Native auto size** | No |
| **Magic prompt** | Improved (model-tuned) |
Magic prompt for this model is **model-tuned** for better results. Set `magic_prompt: true` to use
it.
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Editorial product photograph of a ceramic coffee set on a sunlit marble counter",
model: "bytedance/seedream-pro",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Editorial product photograph of a ceramic coffee set on a sunlit marble counter",
"model": "bytedance/seedream-pro",
"size": "landscape",
"count": 1
}'
```
## Use inputs
Pass up to **10** input images for image-to-image. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Restyle this photo as a cinematic still",
model: "bytedance/seedream-pro",
inputs: ["https://example.com/input-image.jpg"],
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Restyle this photo as a cinematic still",
"model": "bytedance/seedream-pro",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/input-image.jpg" }
}
],
"size": "landscape"
}'
```
## Magic prompt
Set `magic_prompt: true` to let Mynth rewrite your prompt before generation. This model has **improved, model-tuned** magic prompts.
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Editorial product photograph of a ceramic coffee set on a sunlit marble counter",
model: "bytedance/seedream-pro",
magic_prompt: true,
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Editorial product photograph of a ceramic coffee set on a sunlit marble counter",
"model": "bytedance/seedream-pro",
"magic_prompt": true,
"size": "landscape"
}'
```
See [Control prompts](/guides/control-prompts).
# Anima
Source: https://docs.mynth.io/models/circlestone-labs-anima
Use Anima with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
circlestone-labs/anima
```
See pricing & more on [mynth.io](https://mynth.io/models/circlestone-labs%2Fanima).
## Capabilities
| | |
| -------------------- | ------------------------------ |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | Up to 1 image (image-to-image) |
| **Native auto size** | Image-to-image only |
| **Magic prompt** | Supported |
Anima is CircleStone Labs' 2B anime model. Text-to-image generates tag-driven illustrations at native 1K. Image-to-image restyles a single source image. Danbooru-style tags work best.
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt:
"masterpiece, best quality, 1girl, solo, long silver hair, blue eyes, white summer dress, standing in a sunflower field",
model: "circlestone-labs/anima",
size: "portrait",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "masterpiece, best quality, 1girl, solo, long silver hair, blue eyes, white summer dress, standing in a sunflower field",
"model": "circlestone-labs/anima",
"size": "portrait",
"count": 1
}'
```
## Use inputs
Pass **1** input image for image-to-image. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "masterpiece, best quality, restyle as a school uniform in afternoon sunlight",
model: "circlestone-labs/anima",
inputs: ["https://example.com/input-image.jpg"],
size: "auto",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "masterpiece, best quality, restyle as a school uniform in afternoon sunlight",
"model": "circlestone-labs/anima",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/input-image.jpg" }
}
],
"size": "auto"
}'
```
## Auto size
Image-to-image supports **native auto size**. Left unset, output keeps the source image's ratio.
```ts theme={"theme":"kanagawa-dragon"}
size: "auto";
```
See [Control size](/guides/control-size).
# Gemini 3.1 Flash Image
Source: https://docs.mynth.io/models/google-gemini-3-1-flash-image
Use Gemini 3.1 Flash Image with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
google/gemini-3.1-flash-image
```
See pricing & more on [mynth.io](https://mynth.io/models/google%2Fgemini-3.1-flash-image).
## Capabilities
| | |
| ------------------------- | -------------------------------- |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | Up to 14 images (image-to-image) |
| **Native auto size** | No |
| **Magic prompt** | Supported |
| **4K** | Yes |
| **Native enhance prompt** | Yes |
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "google/gemini-3.1-flash-image",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "google/gemini-3.1-flash-image",
"size": "landscape",
"count": 1
}'
```
## Use inputs
Pass up to **14** input images for image-to-image. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Restyle this photo as a cinematic still",
model: "google/gemini-3.1-flash-image",
inputs: ["https://example.com/input-image.jpg"],
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Restyle this photo as a cinematic still",
"model": "google/gemini-3.1-flash-image",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/input-image.jpg" }
}
],
"size": "landscape"
}'
```
# Gemini 3.1 Flash-Lite Image
Source: https://docs.mynth.io/models/google-gemini-3-1-flash-lite-image
Use Gemini 3.1 Flash-Lite Image with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
google/gemini-3.1-flash-lite-image
```
See pricing & more on [mynth.io](https://mynth.io/models/google%2Fgemini-3.1-flash-lite-image).
## Capabilities
| | |
| ------------------------- | -------------------------------- |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | Up to 14 images (image-to-image) |
| **Native auto size** | Yes (image-to-image) |
| **Magic prompt** | Supported |
| **Native enhance prompt** | Yes |
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "google/gemini-3.1-flash-lite-image",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "google/gemini-3.1-flash-lite-image",
"size": "landscape",
"count": 1
}'
```
## Use inputs
Pass up to **14** input images for image-to-image. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Restyle this photo as a cinematic still",
model: "google/gemini-3.1-flash-lite-image",
inputs: ["https://example.com/input-image.jpg"],
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Restyle this photo as a cinematic still",
"model": "google/gemini-3.1-flash-lite-image",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/input-image.jpg" }
}
],
"size": "landscape"
}'
```
## Auto size
This model supports **native auto size** in image-to-image mode.
```ts theme={"theme":"kanagawa-dragon"}
size: "auto";
// or
size: {
type: "auto";
}
```
See [Control size](/guides/control-size).
# Gemini 3 Pro Image Preview
Source: https://docs.mynth.io/models/google-gemini-3-pro-image-preview
Use Gemini 3 Pro Image Preview with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
google/gemini-3-pro-image-preview
```
See pricing & more on [mynth.io](https://mynth.io/models/google%2Fgemini-3-pro-image-preview).
## Capabilities
| | |
| ------------------------- | -------------------------------- |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | Up to 14 images (image-to-image) |
| **Native auto size** | Yes (image-to-image) |
| **Magic prompt** | Supported |
| **4K** | Yes |
| **Native enhance prompt** | Yes |
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "google/gemini-3-pro-image-preview",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "google/gemini-3-pro-image-preview",
"size": "landscape",
"count": 1
}'
```
## Use inputs
Pass up to **14** input images for image-to-image. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Restyle this photo as a cinematic still",
model: "google/gemini-3-pro-image-preview",
inputs: ["https://example.com/input-image.jpg"],
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Restyle this photo as a cinematic still",
"model": "google/gemini-3-pro-image-preview",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/input-image.jpg" }
}
],
"size": "landscape"
}'
```
## Auto size
This model supports **native auto size** in image-to-image mode.
```ts theme={"theme":"kanagawa-dragon"}
size: "auto";
// or
size: {
type: "auto";
}
```
See [Control size](/guides/control-size).
# Gemini Omni Flash 1.1
Source: https://docs.mynth.io/models/google-gemini-omni-flash-1-1
Use Gemini Omni Flash 1.1 with the Mynth REST API. Text-to-video, image-to-video, resolution, duration, and native audio.
```text Model ID theme={"theme":"kanagawa-dragon"}
google/gemini-omni-flash-1.1
```
See pricing & more on [mynth.io](https://mynth.io/models/google%2Fgemini-omni-flash-1.1).
## Capabilities
| | |
| -------------- | -------------------------------- |
| **Modes** | Text-to-video · Image-to-video |
| **Inputs** | First frame, optional last frame |
| **Resolution** | 720p · 1080p · 4k |
| **Duration** | 3–10 seconds |
| **Audio** | Native, always on |
Gemini Omni Flash 1.1 is Google's multimodal video model: prompt-driven clips with synced audio, plus first/last-frame control for image-to-video.
## Generate
```bash theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/video/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A cinematic wide shot of a lighthouse on a rocky cliff at dusk, waves crashing below, the beam sweeping across the dark sea",
"model": "google/gemini-omni-flash-1.1",
"resolution": "720p",
"duration": 8
}'
```
Omit `resolution` and `duration` to use the model defaults: 720p and 8 seconds. Native audio is always generated.
## Use inputs
Pass a starting frame for image-to-video. Add a last frame to interpolate between the two.
```bash theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/video/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "The dog turns its head and wags its tail in warm sunlight",
"model": "google/gemini-omni-flash-1.1",
"inputs": [
{
"type": "image",
"as": "first_frame",
"source": { "type": "url", "url": "https://example.com/first.jpg" }
}
],
"resolution": "720p",
"duration": 8
}'
```
# Ideogram Remove Background
Source: https://docs.mynth.io/models/ideogram-remove-background
Use Ideogram Remove Background with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
ideogram/remove-background
```
See pricing & more on [mynth.io](https://mynth.io/models/ideogram%2Fremove-background).
## Capabilities
| | |
| -------------------- | -------------- |
| **Modes** | Image-to-image |
| **Inputs** | 1 source image |
| **Native auto size** | Yes |
| **Magic prompt** | Supported |
Requires exactly one `source` image. Returns a transparent cutout.
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Remove the background",
model: "ideogram/remove-background",
inputs: [
{
type: "image",
as: "source",
source: { type: "url", url: "https://example.com/photo.jpg" },
},
],
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Remove the background",
"model": "ideogram/remove-background",
"inputs": [
{
"type": "image",
"as": "source",
"source": { "type": "url", "url": "https://example.com/photo.jpg" }
}
]
}'
```
## Auto size
This model supports **native auto size**. Output size matches the source image.
```ts theme={"theme":"kanagawa-dragon"}
size: "auto";
// or
size: {
type: "auto";
}
```
See [Control size](/guides/control-size).
# ImagineArt 1.5 Pro
Source: https://docs.mynth.io/models/imagineart-imagineart-1-5-pro
Use ImagineArt 1.5 Pro with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
imagineart/imagineart-1.5-pro
```
See pricing & more on [mynth.io](https://mynth.io/models/imagineart%2Fimagineart-1.5-pro).
## Capabilities
| | |
| -------------------- | ------------- |
| **Modes** | Text-to-image |
| **Inputs** | None |
| **Native auto size** | No |
| **Magic prompt** | Supported |
| **4K** | Yes |
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "imagineart/imagineart-1.5-pro",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "imagineart/imagineart-1.5-pro",
"size": "landscape",
"count": 1
}'
```
# ImagineArt 2.0
Source: https://docs.mynth.io/models/imagineart-imagineart-2-0
Use ImagineArt 2.0 with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
imagineart/imagineart-2.0
```
See pricing & more on [mynth.io](https://mynth.io/models/imagineart%2Fimagineart-2.0).
## Capabilities
| | |
| -------------------- | ------------------------------- |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | Up to 4 images (image-to-image) |
| **Native auto size** | Yes (image-to-image) |
| **Magic prompt** | Improved (model-tuned) |
Magic prompt for this model is **model-tuned** for better results. Set `magic_prompt: true` to use
it.
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "imagineart/imagineart-2.0",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "imagineart/imagineart-2.0",
"size": "landscape",
"count": 1
}'
```
## Use inputs
Pass up to **4** input images for image-to-image. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Restyle this photo as a cinematic still",
model: "imagineart/imagineart-2.0",
inputs: ["https://example.com/input-image.jpg"],
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Restyle this photo as a cinematic still",
"model": "imagineart/imagineart-2.0",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/input-image.jpg" }
}
],
"size": "landscape"
}'
```
## Auto size
This model supports **native auto size** in image-to-image mode.
```ts theme={"theme":"kanagawa-dragon"}
size: "auto";
// or
size: {
type: "auto";
}
```
See [Control size](/guides/control-size).
## Magic prompt
Set `magic_prompt: true` to let Mynth rewrite your prompt before generation. This model has **improved, model-tuned** magic prompts.
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "imagineart/imagineart-2.0",
magic_prompt: true,
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "imagineart/imagineart-2.0",
"magic_prompt": true,
"size": "landscape"
}'
```
See [Control prompts](/guides/control-prompts).
# Bismuth Illustrious Mix
Source: https://docs.mynth.io/models/john6666-bismuth-illustrious-mix
Use Bismuth Illustrious Mix with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
john6666/bismuth-illustrious-mix
```
See pricing & more on [mynth.io](https://mynth.io/models/john6666%2Fbismuth-illustrious-mix).
## Capabilities
| | |
| -------------------- | ---------------------- |
| **Modes** | Text-to-image |
| **Inputs** | None |
| **Native auto size** | No |
| **Magic prompt** | Improved (model-tuned) |
| **Negative prompt** | Yes |
Magic prompt for this model is **model-tuned** for better results. Set `magic_prompt: true` to use
it.
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "1girl, silver hair, blue eyes, soft lighting, anime style",
model: "john6666/bismuth-illustrious-mix",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "1girl, silver hair, blue eyes, soft lighting, anime style",
"model": "john6666/bismuth-illustrious-mix",
"size": "landscape",
"count": 1
}'
```
## Magic prompt
Set `magic_prompt: true` to let Mynth rewrite your prompt before generation. This model has **improved, model-tuned** magic prompts.
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "1girl, silver hair, blue eyes, soft lighting, anime style",
model: "john6666/bismuth-illustrious-mix",
magic_prompt: true,
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "1girl, silver hair, blue eyes, soft lighting, anime style",
"model": "john6666/bismuth-illustrious-mix",
"magic_prompt": true,
"size": "landscape"
}'
```
See [Control prompts](/guides/control-prompts).
# Kling IMAGE 3.0
Source: https://docs.mynth.io/models/klingai-kling-image-3-0
Use Kling IMAGE 3.0 with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
klingai/kling-image-3.0
```
See pricing & more on [mynth.io](https://mynth.io/models/klingai%2Fkling-image-3.0).
## Capabilities
| | |
| -------------------- | ------------------------------ |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | Up to 1 image (image-to-image) |
| **Native auto size** | No |
| **Magic prompt** | Supported |
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "klingai/kling-image-3.0",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "klingai/kling-image-3.0",
"size": "landscape",
"count": 1
}'
```
## Use inputs
Pass up to **1** input image for image-to-image. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Restyle this photo as a cinematic still",
model: "klingai/kling-image-3.0",
inputs: ["https://example.com/input-image.jpg"],
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Restyle this photo as a cinematic still",
"model": "klingai/kling-image-3.0",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/input-image.jpg" }
}
],
"size": "landscape"
}'
```
# Kling IMAGE O3
Source: https://docs.mynth.io/models/klingai-kling-image-o3
Use Kling IMAGE O3 with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
klingai/kling-image-o3
```
See pricing & more on [mynth.io](https://mynth.io/models/klingai%2Fkling-image-o3).
## Capabilities
| | |
| -------------------- | -------------------------------- |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | Up to 10 images (image-to-image) |
| **Native auto size** | No |
| **Magic prompt** | Supported |
| **4K** | Yes |
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "klingai/kling-image-o3",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "klingai/kling-image-o3",
"size": "landscape",
"count": 1
}'
```
## Use inputs
Pass up to **10** input images for image-to-image. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Restyle this photo as a cinematic still",
model: "klingai/kling-image-o3",
inputs: ["https://example.com/input-image.jpg"],
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Restyle this photo as a cinematic still",
"model": "klingai/kling-image-o3",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/input-image.jpg" }
}
],
"size": "landscape"
}'
```
# Krea 2 Large
Source: https://docs.mynth.io/models/krea-krea-2-large
Use Krea 2 Large with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
krea/krea-2-large
```
See pricing & more on [mynth.io](https://mynth.io/models/krea%2Fkrea-2-large).
## Capabilities
| | |
| -------------------- | -------------------------------- |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | Up to 10 images (image-to-image) |
| **Native auto size** | No |
| **Magic prompt** | Supported |
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "krea/krea-2-large",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "krea/krea-2-large",
"size": "landscape",
"count": 1
}'
```
## Use inputs
Pass up to **10** input images for image-to-image. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Restyle this photo as a cinematic still",
model: "krea/krea-2-large",
inputs: ["https://example.com/input-image.jpg"],
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Restyle this photo as a cinematic still",
"model": "krea/krea-2-large",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/input-image.jpg" }
}
],
"size": "landscape"
}'
```
# Krea 2 Medium
Source: https://docs.mynth.io/models/krea-krea-2-medium
Use Krea 2 Medium with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
krea/krea-2-medium
```
See pricing & more on [mynth.io](https://mynth.io/models/krea%2Fkrea-2-medium).
## Capabilities
| | |
| -------------------- | -------------------------------- |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | Up to 10 images (image-to-image) |
| **Native auto size** | No |
| **Magic prompt** | Supported |
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "krea/krea-2-medium",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "krea/krea-2-medium",
"size": "landscape",
"count": 1
}'
```
## Use inputs
Pass up to **10** input images for image-to-image. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Restyle this photo as a cinematic still",
model: "krea/krea-2-medium",
inputs: ["https://example.com/input-image.jpg"],
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Restyle this photo as a cinematic still",
"model": "krea/krea-2-medium",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/input-image.jpg" }
}
],
"size": "landscape"
}'
```
# Krea 2 Turbo
Source: https://docs.mynth.io/models/krea-krea-2-turbo
Use Krea 2 Turbo with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
krea/krea-2-turbo
```
See pricing & more on [mynth.io](https://mynth.io/models/krea%2Fkrea-2-turbo).
## Capabilities
| | |
| -------------------- | -------------------------------- |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | Up to 10 images (image-to-image) |
| **Native auto size** | No |
| **Magic prompt** | Supported |
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "krea/krea-2-turbo",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "krea/krea-2-turbo",
"size": "landscape",
"count": 1
}'
```
## Use inputs
Pass up to **10** input images for image-to-image. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Restyle this photo as a cinematic still",
model: "krea/krea-2-turbo",
inputs: ["https://example.com/input-image.jpg"],
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Restyle this photo as a cinematic still",
"model": "krea/krea-2-turbo",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/input-image.jpg" }
}
],
"size": "landscape"
}'
```
# Luma UNI-1
Source: https://docs.mynth.io/models/luma-uni-1
Use Luma UNI-1 with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
luma/uni-1
```
See pricing & more on [mynth.io](https://mynth.io/models/luma%2Funi-1).
## Capabilities
| | |
| -------------------- | ------------------------------ |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | source + reference roles |
| **Native auto size** | No |
| **Magic prompt** | Supported |
Text-to-image accepts up to 9 `reference` images (no source). Image-to-image requires exactly 1
`source` and up to 9 `reference` images (max 9 total).
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "luma/uni-1",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "luma/uni-1",
"size": "landscape",
"count": 1
}'
```
## Use inputs
Roles matter for this model:
* **Text-to-image:** up to 9 `reference` images (style / composition guidance)
* **Image-to-image:** exactly 1 `source` plus up to 9 `reference` images (max 9 total)
See [Upload input images](/guides/upload-input-images).
### Image-to-image (source + reference)
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Product hero shot on a marble pedestal, studio lighting",
model: "luma/uni-1",
inputs: [
{
type: "image",
as: "source",
source: { type: "url", url: "https://example.com/product.png" },
},
{
type: "image",
as: "reference",
source: { type: "url", url: "https://example.com/style-ref.png" },
},
],
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Product hero shot on a marble pedestal, studio lighting",
"model": "luma/uni-1",
"inputs": [
{
"type": "image",
"as": "source",
"source": { "type": "url", "url": "https://example.com/product.png" }
},
{
"type": "image",
"as": "reference",
"source": { "type": "url", "url": "https://example.com/style-ref.png" }
}
],
"size": "landscape"
}'
```
### Text-to-image with references
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "luma/uni-1",
inputs: [
{
type: "image",
as: "reference",
source: { type: "url", url: "https://example.com/moodboard.png" },
},
],
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "luma/uni-1",
"inputs": [
{
"type": "image",
"as": "reference",
"source": { "type": "url", "url": "https://example.com/moodboard.png" }
}
],
"size": "landscape"
}'
```
# Luma UNI-1 Max
Source: https://docs.mynth.io/models/luma-uni-1-max
Use Luma UNI-1 Max with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
luma/uni-1-max
```
See pricing & more on [mynth.io](https://mynth.io/models/luma%2Funi-1-max).
## Capabilities
| | |
| -------------------- | ------------------------------ |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | source + reference roles |
| **Native auto size** | No |
| **Magic prompt** | Supported |
Text-to-image accepts up to 9 `reference` images (no source). Image-to-image requires exactly 1
`source` and up to 9 `reference` images (max 9 total).
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "luma/uni-1-max",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "luma/uni-1-max",
"size": "landscape",
"count": 1
}'
```
## Use inputs
Roles matter for this model:
* **Text-to-image:** up to 9 `reference` images (style / composition guidance)
* **Image-to-image:** exactly 1 `source` plus up to 9 `reference` images (max 9 total)
See [Upload input images](/guides/upload-input-images).
### Image-to-image (source + reference)
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Product hero shot on a marble pedestal, studio lighting",
model: "luma/uni-1-max",
inputs: [
{
type: "image",
as: "source",
source: { type: "url", url: "https://example.com/product.png" },
},
{
type: "image",
as: "reference",
source: { type: "url", url: "https://example.com/style-ref.png" },
},
],
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Product hero shot on a marble pedestal, studio lighting",
"model": "luma/uni-1-max",
"inputs": [
{
"type": "image",
"as": "source",
"source": { "type": "url", "url": "https://example.com/product.png" }
},
{
"type": "image",
"as": "reference",
"source": { "type": "url", "url": "https://example.com/style-ref.png" }
}
],
"size": "landscape"
}'
```
### Text-to-image with references
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "luma/uni-1-max",
inputs: [
{
type: "image",
as: "reference",
source: { type: "url", url: "https://example.com/moodboard.png" },
},
],
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "luma/uni-1-max",
"inputs": [
{
"type": "image",
"as": "reference",
"source": { "type": "url", "url": "https://example.com/moodboard.png" }
}
],
"size": "landscape"
}'
```
# One obsession
Source: https://docs.mynth.io/models/maxfeifei8-one-obsession
Use One obsession with the Mynth SDK or REST API. Capabilities, negative prompts, and generation examples.
```text Model ID theme={"theme":"kanagawa-dragon"}
maxfeifei8/one-obsession
```
See pricing & more on [mynth.io](https://mynth.io/models/maxfeifei8%2Fone-obsession).
## Capabilities
| | |
| -------------------- | ------------- |
| **Modes** | Text-to-image |
| **Inputs** | None |
| **Native auto size** | No |
| **Magic prompt** | Supported |
| **Negative prompt** | Yes |
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "masterpiece, best quality, 1girl, silver hair, dramatic lighting, anime style",
negative_prompt: "worst quality, low quality, bad anatomy, text, watermark",
model: "maxfeifei8/one-obsession",
size: "portrait",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "masterpiece, best quality, 1girl, silver hair, dramatic lighting, anime style",
"negative_prompt": "worst quality, low quality, bad anatomy, text, watermark",
"model": "maxfeifei8/one-obsession",
"size": "portrait",
"count": 1
}'
```
# Muse Image
Source: https://docs.mynth.io/models/meta-muse-image
Use Meta Muse Image with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
meta/muse-image
```
See pricing & more on [mynth.io](https://mynth.io/models/meta%2Fmuse-image).
## Capabilities
| | |
| -------------------- | -------------------------------- |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | Up to 10 images (image-to-image) |
| **Native auto size** | Yes |
| **Magic prompt** | Supported |
Muse Image is strong at faithful instruction-following, in-image text, plots, QR codes, and multi-turn edits that change only what you ask.
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: 'Editorial travel poster titled "NIGHT MARKET", precise bilingual typography',
model: "meta/muse-image",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Editorial travel poster titled \"NIGHT MARKET\", precise bilingual typography",
"model": "meta/muse-image",
"size": "landscape",
"count": 1
}'
```
## Use inputs
Pass up to **10** input images for image-to-image. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Replace the background with a moonlit forest while preserving the subject",
model: "meta/muse-image",
inputs: ["https://example.com/input-image.jpg"],
size: "auto",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Replace the background with a moonlit forest while preserving the subject",
"model": "meta/muse-image",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/input-image.jpg" }
}
],
"size": "auto"
}'
```
## Auto size
This model supports **native auto size** for both generation and editing. When omitted, Muse chooses output dimensions from the request.
```ts theme={"theme":"kanagawa-dragon"}
size: "auto";
```
See [Control size](/guides/control-size).
# MAI Image 2.6
Source: https://docs.mynth.io/models/microsoft-mai-image-2.6
Use MAI Image 2.6 with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
microsoft/mai-image-2.6
```
See pricing & more on [mynth.io](https://mynth.io/models/microsoft%2Fmai-image-2.6).
## Capabilities
| | |
| -------------------- | ------------------------------- |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | Up to 5 images (image-to-image) |
| **Native auto size** | Yes |
| **Magic prompt** | Supported |
MAI Image 2.6 is Microsoft's precision image model. Use it for design-ready stills, readable in-image text, portraits, and multi-reference edits that keep people, products, and scenes consistent.
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "microsoft/mai-image-2.6",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "microsoft/mai-image-2.6",
"size": "landscape",
"count": 1
}'
```
## Use inputs
Pass up to **5** input images for image-to-image. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Restyle this photo as a cinematic still",
model: "microsoft/mai-image-2.6",
inputs: ["https://example.com/input-image.jpg"],
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Restyle this photo as a cinematic still",
"model": "microsoft/mai-image-2.6",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/input-image.jpg" }
}
],
"size": "landscape"
}'
```
# MAI Image 2.6 Flash
Source: https://docs.mynth.io/models/microsoft-mai-image-2.6-flash
Use MAI Image 2.6 Flash with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
microsoft/mai-image-2.6-flash
```
See pricing & more on [mynth.io](https://mynth.io/models/microsoft%2Fmai-image-2.6-flash).
## Capabilities
| | |
| -------------------- | ------------------------------- |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | Up to 5 images (image-to-image) |
| **Native auto size** | Yes |
| **Magic prompt** | Supported |
MAI Image 2.6 Flash is the faster, cheaper MAI Image 2.6 variant. Use it for latency-sensitive production, high-volume drafts, and the same five-image reference edits.
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "microsoft/mai-image-2.6-flash",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "microsoft/mai-image-2.6-flash",
"size": "landscape",
"count": 1
}'
```
## Use inputs
Pass up to **5** input images for image-to-image. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Restyle this photo as a cinematic still",
model: "microsoft/mai-image-2.6-flash",
inputs: ["https://example.com/input-image.jpg"],
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Restyle this photo as a cinematic still",
"model": "microsoft/mai-image-2.6-flash",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/input-image.jpg" }
}
],
"size": "landscape"
}'
```
# MiniMax H3
Source: https://docs.mynth.io/models/minimax-h3
Use MiniMax H3 with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
minimax/h3
```
See pricing & more on [mynth.io](https://mynth.io/models/minimax%2Fh3).
## Capabilities
| | |
| -------------------- | ------------------------------- |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | Up to 9 images (image-to-image) |
| **Native auto size** | Image-to-image only |
| **Magic prompt** | Supported |
MiniMax H3 is a cinema-grade still-image model. Text-to-image produces photorealistic 2K frames from a prompt. Image-to-image re-renders a subject from up to nine references into a new scene, outfit, or style while keeping identity.
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt:
"Cinematic portrait of a young man in a navy wool coat at a foggy Lisbon tram stop at dawn, 50mm lens, shallow depth of field",
model: "minimax/h3",
size: "portrait",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Cinematic portrait of a young man in a navy wool coat at a foggy Lisbon tram stop at dawn, 50mm lens, shallow depth of field",
"model": "minimax/h3",
"size": "portrait",
"count": 1
}'
```
## Use inputs
Pass up to **9** input images for image-to-image. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "The same person from the first image, now wearing a red leather jacket in a neon-lit Tokyo alley at night",
model: "minimax/h3",
inputs: ["https://example.com/input-image.jpg"],
size: "auto",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "The same person from the first image, now wearing a red leather jacket in a neon-lit Tokyo alley at night",
"model": "minimax/h3",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/input-image.jpg" }
}
],
"size": "auto"
}'
```
## Auto size
Image-to-image supports **native auto size**. Left unset, output keeps the first reference image's ratio.
```ts theme={"theme":"kanagawa-dragon"}
size: "auto";
```
See [Control size](/guides/control-size).
# GPT Image 2
Source: https://docs.mynth.io/models/openai-gpt-image-2
Use GPT Image 2 with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
openai/gpt-image-2
```
See pricing & more on [mynth.io](https://mynth.io/models/openai%2Fgpt-image-2).
## Capabilities
| | |
| -------------------- | -------------------------------- |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | Up to 16 images (image-to-image) |
| **Native auto size** | No |
| **Magic prompt** | Supported |
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "openai/gpt-image-2",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "openai/gpt-image-2",
"size": "landscape",
"count": 1
}'
```
## Use inputs
Pass up to **16** input images for image-to-image. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Restyle this photo as a cinematic still",
model: "openai/gpt-image-2",
inputs: ["https://example.com/input-image.jpg"],
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Restyle this photo as a cinematic still",
"model": "openai/gpt-image-2",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/input-image.jpg" }
}
],
"size": "landscape"
}'
```
# GPT Image 2.5 Flare
Source: https://docs.mynth.io/models/openai-gpt-image-2.5-flare
Use GPT Image 2.5 Flare with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
openai/gpt-image-2.5-flare
```
See pricing & more on [mynth.io](https://mynth.io/models/openai%2Fgpt-image-2.5-flare).
## Capabilities
| | |
| -------------------- | -------------------------------- |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | Up to 16 images (image-to-image) |
| **Native auto size** | Yes (image-to-image) |
| **Magic prompt** | Supported |
GPT Image 2.5 Flare is OpenAI's fast everyday image model. Use it for product shots, social content, readable layouts, and high-volume reference edits.
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "openai/gpt-image-2.5-flare",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "openai/gpt-image-2.5-flare",
"size": "landscape",
"count": 1
}'
```
## Use inputs
Pass up to **16** input images for image-to-image. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Restyle this photo as a cinematic still",
model: "openai/gpt-image-2.5-flare",
inputs: ["https://example.com/input-image.jpg"],
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Restyle this photo as a cinematic still",
"model": "openai/gpt-image-2.5-flare",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/input-image.jpg" }
}
],
"size": "landscape"
}'
```
# GPT Image 2.5 Sunburst
Source: https://docs.mynth.io/models/openai-gpt-image-2.5-sunburst
Use GPT Image 2.5 Sunburst with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
openai/gpt-image-2.5-sunburst
```
See pricing & more on [mynth.io](https://mynth.io/models/openai%2Fgpt-image-2.5-sunburst).
## Capabilities
| | |
| -------------------- | -------------------------------- |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | Up to 16 images (image-to-image) |
| **Native auto size** | Yes (image-to-image) |
| **Magic prompt** | Supported |
GPT Image 2.5 Sunburst is OpenAI's precision image model. Use it for campaign creative, polished product imagery, and edits that must keep subject and composition.
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "openai/gpt-image-2.5-sunburst",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "openai/gpt-image-2.5-sunburst",
"size": "landscape",
"count": 1
}'
```
## Use inputs
Pass up to **16** input images for image-to-image. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Restyle this photo as a cinematic still",
model: "openai/gpt-image-2.5-sunburst",
inputs: ["https://example.com/input-image.jpg"],
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Restyle this photo as a cinematic still",
"model": "openai/gpt-image-2.5-sunburst",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/input-image.jpg" }
}
],
"size": "landscape"
}'
```
# P-Image Try-On
Source: https://docs.mynth.io/models/prunaai-p-image-try-on
Use P-Image Try-On with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
prunaai/p-image-try-on
```
See pricing & more on [mynth.io](https://mynth.io/models/prunaai%2Fp-image-try-on).
## Capabilities
| | |
| -------------------- | ---------------------------------------- |
| **Modes** | Image-to-image |
| **Inputs** | 1 person + 1–11 garments + optional pose |
| **Native auto size** | Yes |
| **Magic prompt** | Supported |
Requires 1 `person` image and 1–11 `garment` images (max 13 total). Optional `pose` must be
declared explicitly (`as: "pose"`). `person` and `garment` can use `as: "auto"`.
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "A person wearing a red jacket",
model: "prunaai/p-image-try-on",
inputs: [
{
type: "image",
as: "person",
source: { type: "url", url: "https://example.com/person.jpg" },
},
{
type: "image",
as: "garment",
source: { type: "url", url: "https://example.com/jacket.jpg" },
},
],
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A person wearing a red jacket",
"model": "prunaai/p-image-try-on",
"inputs": [
{
"type": "image",
"as": "person",
"source": { "type": "url", "url": "https://example.com/person.jpg" }
},
{
"type": "image",
"as": "garment",
"source": { "type": "url", "url": "https://example.com/jacket.jpg" }
}
]
}'
```
## Optional pose input
Declare pose explicitly — it is not auto-classified:
```ts theme={"theme":"kanagawa-dragon"}
inputs: [
{
type: "image",
as: "person",
source: { type: "url", url: "https://example.com/person.jpg" },
},
{
type: "image",
as: "garment",
source: { type: "url", url: "https://example.com/jacket.jpg" },
},
{
type: "image",
as: "pose",
source: { type: "url", url: "https://example.com/pose.jpg" },
},
],
```
## Auto size
This model supports **native auto size**. Output size is derived from the person image.
```ts theme={"theme":"kanagawa-dragon"}
size: "auto";
// or
size: {
type: "auto";
}
```
See [Control size](/guides/control-size).
# Pony Diffusion V6 XL
Source: https://docs.mynth.io/models/purplesmartai-pony-diffusion-v6-xl
Use Pony Diffusion V6 XL with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
purplesmartai/pony-diffusion-v6-xl
```
See pricing & more on [mynth.io](https://mynth.io/models/purplesmartai%2Fpony-diffusion-v6-xl).
## Capabilities
| | |
| -------------------- | ---------------------- |
| **Modes** | Text-to-image |
| **Inputs** | None |
| **Native auto size** | No |
| **Magic prompt** | Improved (model-tuned) |
| **Negative prompt** | Yes |
Magic prompt for this model is **model-tuned** for better results. Set `magic_prompt: true` to use
it.
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "masterpiece, best quality, 1girl, silver hair, blue eyes, soft lighting",
model: "purplesmartai/pony-diffusion-v6-xl",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "masterpiece, best quality, 1girl, silver hair, blue eyes, soft lighting",
"model": "purplesmartai/pony-diffusion-v6-xl",
"size": "landscape",
"count": 1
}'
```
## Magic prompt
Set `magic_prompt: true` to let Mynth rewrite your prompt before generation. This model has **improved, model-tuned** magic prompts.
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "masterpiece, best quality, 1girl, silver hair, blue eyes, soft lighting",
model: "purplesmartai/pony-diffusion-v6-xl",
magic_prompt: true,
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "masterpiece, best quality, 1girl, silver hair, blue eyes, soft lighting",
"model": "purplesmartai/pony-diffusion-v6-xl",
"magic_prompt": true,
"size": "landscape"
}'
```
See [Control prompts](/guides/control-prompts).
# Recraft V4
Source: https://docs.mynth.io/models/recraft-recraft-v4
Use Recraft V4 with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
recraft/recraft-v4
```
See pricing & more on [mynth.io](https://mynth.io/models/recraft%2Frecraft-v4).
## Capabilities
| | |
| -------------------- | ------------- |
| **Modes** | Text-to-image |
| **Inputs** | None |
| **Native auto size** | No |
| **Magic prompt** | Supported |
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "recraft/recraft-v4",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "recraft/recraft-v4",
"size": "landscape",
"count": 1
}'
```
# Recraft V4 Pro
Source: https://docs.mynth.io/models/recraft-recraft-v4-pro
Use Recraft V4 Pro with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
recraft/recraft-v4-pro
```
See pricing & more on [mynth.io](https://mynth.io/models/recraft%2Frecraft-v4-pro).
## Capabilities
| | |
| -------------------- | ------------- |
| **Modes** | Text-to-image |
| **Inputs** | None |
| **Native auto size** | No |
| **Magic prompt** | Supported |
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "recraft/recraft-v4-pro",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "recraft/recraft-v4-pro",
"size": "landscape",
"count": 1
}'
```
# Reve
Source: https://docs.mynth.io/models/reve-reve
Use the latest Reve image model with the Mynth SDK or REST API for generation and single-image editing.
```text Model ID theme={"theme":"kanagawa-dragon"}
reve/reve
```
Currently runs **Reve 2.1** under the hood. The `reve/reve` ID always tracks the latest Reve version available through Mynth. Pricing may be adjusted if a newer version is more expensive to serve.
See pricing & more on [mynth.io](https://mynth.io/models/reve%2Freve).
## Capabilities
| | |
| -------------------- | ------------------------------ |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | Exactly 1 image for editing |
| **Native auto size** | Yes |
| **Magic prompt** | Supported |
Reve produces native high-resolution output and is especially strong at layout-driven images, in-image text, posters, packaging, infographics, and precise natural-language edits.
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: 'Editorial poster for a design conference titled "FORM / FUNCTION"',
model: "reve/reve",
size: "portrait",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Editorial poster for a design conference titled \"FORM / FUNCTION\"",
"model": "reve/reve",
"size": "portrait",
"count": 1
}'
```
## Edit an image
Pass exactly **one** input image for image-to-image editing. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Replace the background with a moonlit forest while preserving the subject",
model: "reve/reve",
inputs: ["https://example.com/input-image.jpg"],
size: "auto",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Replace the background with a moonlit forest while preserving the subject",
"model": "reve/reve",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/input-image.jpg" }
}
],
"size": "auto"
}'
```
## Auto size
This model supports **native auto size** for both generation and editing.
```ts theme={"theme":"kanagawa-dragon"}
size: "auto";
```
See [Control size](/guides/control-size).
# Reve Remix
Source: https://docs.mynth.io/models/reve-reve-remix
Use the latest Reve Remix model with the Mynth SDK or REST API for multi-reference image composition.
```text Model ID theme={"theme":"kanagawa-dragon"}
reve/reve-remix
```
Currently runs **Reve 2.1 Remix** under the hood. The `reve/reve-remix` ID always tracks the latest Reve Remix version available through Mynth. Pricing may be adjusted if a newer version is more expensive to serve.
See pricing & more on [mynth.io](https://mynth.io/models/reve%2Freve-remix).
## Capabilities
| | |
| -------------------- | -------------------- |
| **Modes** | Image-to-image |
| **Inputs** | 1–8 reference images |
| **Native auto size** | Yes |
| **Magic prompt** | Supported |
Reve Remix creates a new composition from one or more references. Use it for subject blending, style transfer, product and campaign concepts, and layouts that combine elements from several images.
## Remix images
Pass between **1 and 8** input images. In prompts that assign a specific role to each image, refer to them by zero-based frame tags such as `0` and `1`.
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt:
"Place the product from 0 into the studio scene from 1, preserving its branding",
model: "reve/reve-remix",
inputs: ["https://example.com/product.png", "https://example.com/studio-reference.jpg"],
size: "landscape",
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Place the product from 0 into the studio scene from 1, preserving its branding",
"model": "reve/reve-remix",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/product.png" }
},
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/studio-reference.jpg" }
}
],
"size": "landscape"
}'
```
## Auto size
This model supports **native auto size**.
```ts theme={"theme":"kanagawa-dragon"}
size: "auto";
```
See [Control size](/guides/control-size).
# Riverflow 2.0 Pro
Source: https://docs.mynth.io/models/sourceful-riverflow-2-0-pro
Use Riverflow 2.0 Pro with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
sourceful/riverflow-2.0-pro
```
See pricing & more on [mynth.io](https://mynth.io/models/sourceful%2Friverflow-2.0-pro).
## Capabilities
| | |
| ------------------------- | -------------------------------- |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | Up to 10 images (image-to-image) |
| **Native auto size** | No |
| **Magic prompt** | Supported |
| **4K** | Yes |
| **Native enhance prompt** | Yes |
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "sourceful/riverflow-2.0-pro",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "sourceful/riverflow-2.0-pro",
"size": "landscape",
"count": 1
}'
```
## Use inputs
Pass up to **10** input images for image-to-image. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Restyle this photo as a cinematic still",
model: "sourceful/riverflow-2.0-pro",
inputs: ["https://example.com/input-image.jpg"],
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Restyle this photo as a cinematic still",
"model": "sourceful/riverflow-2.0-pro",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/input-image.jpg" }
}
],
"size": "landscape"
}'
```
# Z-Image
Source: https://docs.mynth.io/models/tongyi-mai-z-image
Use Z-Image with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
tongyi-mai/z-image
```
See pricing & more on [mynth.io](https://mynth.io/models/tongyi-mai%2Fz-image).
## Capabilities
| | |
| -------------------- | ------------------------------ |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | Up to 1 image (image-to-image) |
| **Native auto size** | No |
| **Magic prompt** | Supported |
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "tongyi-mai/z-image",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "tongyi-mai/z-image",
"size": "landscape",
"count": 1
}'
```
## Use inputs
Pass up to **1** input image for image-to-image. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Restyle this photo as a cinematic still",
model: "tongyi-mai/z-image",
inputs: ["https://example.com/input-image.jpg"],
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Restyle this photo as a cinematic still",
"model": "tongyi-mai/z-image",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/input-image.jpg" }
}
],
"size": "landscape"
}'
```
# Z-Image Turbo
Source: https://docs.mynth.io/models/tongyi-mai-z-image-turbo
Use Z-Image Turbo with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
tongyi-mai/z-image-turbo
```
See pricing & more on [mynth.io](https://mynth.io/models/tongyi-mai%2Fz-image-turbo).
## Capabilities
| | |
| -------------------- | ---------------------- |
| **Modes** | Text-to-image |
| **Inputs** | None |
| **Native auto size** | No |
| **Magic prompt** | Improved (model-tuned) |
Magic prompt for this model is **model-tuned** for better results. Set `magic_prompt: true` to use
it.
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "tongyi-mai/z-image-turbo",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "tongyi-mai/z-image-turbo",
"size": "landscape",
"count": 1
}'
```
## Magic prompt
Set `magic_prompt: true` to let Mynth rewrite your prompt before generation. This model has **improved, model-tuned** magic prompts.
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "tongyi-mai/z-image-turbo",
magic_prompt: true,
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "tongyi-mai/z-image-turbo",
"magic_prompt": true,
"size": "landscape"
}'
```
See [Control prompts](/guides/control-prompts).
# Wan 2.6
Source: https://docs.mynth.io/models/wan-wan2-6-image
Use Wan 2.6 with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
wan/wan2.6-image
```
See pricing & more on [mynth.io](https://mynth.io/models/wan%2Fwan2.6-image).
## Capabilities
| | |
| -------------------- | ------------- |
| **Modes** | Text-to-image |
| **Inputs** | None |
| **Native auto size** | No |
| **Magic prompt** | Supported |
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "wan/wan2.6-image",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "wan/wan2.6-image",
"size": "landscape",
"count": 1
}'
```
# Wan 2.7 Image
Source: https://docs.mynth.io/models/wan-wan2-7-image
Use Wan 2.7 Image with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
wan/wan2.7-image
```
See pricing & more on [mynth.io](https://mynth.io/models/wan%2Fwan2.7-image).
## Capabilities
| | |
| -------------------- | ------------------------------- |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | Up to 9 images (image-to-image) |
| **Native auto size** | No |
| **Magic prompt** | Supported |
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "wan/wan2.7-image",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "wan/wan2.7-image",
"size": "landscape",
"count": 1
}'
```
## Use inputs
Pass up to **9** input images for image-to-image. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Restyle this photo as a cinematic still",
model: "wan/wan2.7-image",
inputs: ["https://example.com/input-image.jpg"],
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Restyle this photo as a cinematic still",
"model": "wan/wan2.7-image",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/input-image.jpg" }
}
],
"size": "landscape"
}'
```
# Wan 2.7 Image Pro
Source: https://docs.mynth.io/models/wan-wan2-7-image-pro
Use Wan 2.7 Image Pro with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
wan/wan2.7-image-pro
```
See pricing & more on [mynth.io](https://mynth.io/models/wan%2Fwan2.7-image-pro).
## Capabilities
| | |
| -------------------- | ------------------------------- |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | Up to 9 images (image-to-image) |
| **Native auto size** | No |
| **Magic prompt** | Supported |
| **4K** | Yes |
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "wan/wan2.7-image-pro",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "wan/wan2.7-image-pro",
"size": "landscape",
"count": 1
}'
```
## Use inputs
Pass up to **9** input images for image-to-image. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Restyle this photo as a cinematic still",
model: "wan/wan2.7-image-pro",
inputs: ["https://example.com/input-image.jpg"],
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Restyle this photo as a cinematic still",
"model": "wan/wan2.7-image-pro",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/input-image.jpg" }
}
],
"size": "landscape"
}'
```
# Grok Imagine Image
Source: https://docs.mynth.io/models/xai-grok-imagine-image
Use Grok Imagine Image with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
xai/grok-imagine-image
```
See pricing & more on [mynth.io](https://mynth.io/models/xai%2Fgrok-imagine-image).
## Capabilities
| | |
| -------------------- | ------------------------------- |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | Up to 3 images (image-to-image) |
| **Native auto size** | Yes (image-to-image) |
| **Magic prompt** | Supported |
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "xai/grok-imagine-image",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "xai/grok-imagine-image",
"size": "landscape",
"count": 1
}'
```
## Use inputs
Pass up to **3** input images for image-to-image. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Restyle this photo as a cinematic still",
model: "xai/grok-imagine-image",
inputs: ["https://example.com/input-image.jpg"],
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Restyle this photo as a cinematic still",
"model": "xai/grok-imagine-image",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/input-image.jpg" }
}
],
"size": "landscape"
}'
```
## Auto size
This model supports **native auto size** in image-to-image mode (preserves the input image aspect ratio).
```ts theme={"theme":"kanagawa-dragon"}
size: "auto";
// or
size: {
type: "auto";
}
```
See [Control size](/guides/control-size).
# Grok Imagine Image 2.0
Source: https://docs.mynth.io/models/xai-grok-imagine-image-2-0
Use Grok Imagine Image 2.0 with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
xai/grok-imagine-image-2.0
```
See pricing & more on [mynth.io](https://mynth.io/models/xai%2Fgrok-imagine-image-2.0).
## Capabilities
| | |
| -------------------- | ------------------------------- |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | Up to 3 images (image-to-image) |
| **Native auto size** | Yes (image-to-image) |
| **Magic prompt** | Supported |
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "xai/grok-imagine-image-2.0",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "xai/grok-imagine-image-2.0",
"size": "landscape",
"count": 1
}'
```
## Use inputs
Pass up to **3** input images for image-to-image. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Restyle this photo as a cinematic still",
model: "xai/grok-imagine-image-2.0",
inputs: ["https://example.com/input-image.jpg"],
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Restyle this photo as a cinematic still",
"model": "xai/grok-imagine-image-2.0",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/input-image.jpg" }
}
],
"size": "landscape"
}'
```
## Auto size
This model supports **native auto size** in image-to-image mode (preserves the input image aspect ratio).
```ts theme={"theme":"kanagawa-dragon"}
size: "auto";
// or
size: {
type: "auto";
}
```
See [Control size](/guides/control-size).
# Grok Imagine Image Quality
Source: https://docs.mynth.io/models/xai-grok-imagine-image-quality
Use Grok Imagine Image Quality with the Mynth SDK or REST API. Capabilities, inputs, auto size, and magic prompt.
```text Model ID theme={"theme":"kanagawa-dragon"}
xai/grok-imagine-image-quality
```
See pricing & more on [mynth.io](https://mynth.io/models/xai%2Fgrok-imagine-image-quality).
## Capabilities
| | |
| -------------------- | ------------------------------- |
| **Modes** | Text-to-image · Image-to-image |
| **Inputs** | Up to 3 images (image-to-image) |
| **Native auto size** | Yes (image-to-image) |
| **Magic prompt** | Supported |
## Generate
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Architectural photograph of a brutalist library at golden hour",
model: "xai/grok-imagine-image-quality",
size: "landscape",
count: 1,
});
console.log(task.urls);
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Architectural photograph of a brutalist library at golden hour",
"model": "xai/grok-imagine-image-quality",
"size": "landscape",
"count": 1
}'
```
## Use inputs
Pass up to **3** input images for image-to-image. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```ts Mynth SDK theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generate({
prompt: "Restyle this photo as a cinematic still",
model: "xai/grok-imagine-image-quality",
inputs: ["https://example.com/input-image.jpg"],
size: "landscape",
});
```
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/image/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Restyle this photo as a cinematic still",
"model": "xai/grok-imagine-image-quality",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/input-image.jpg" }
}
],
"size": "landscape"
}'
```
## Auto size
This model supports **native auto size** in image-to-image mode (preserves the input image aspect ratio).
```ts theme={"theme":"kanagawa-dragon"}
size: "auto";
// or
size: {
type: "auto";
}
```
See [Control size](/guides/control-size).
# Grok Imagine Video 1.5
Source: https://docs.mynth.io/models/xai-grok-imagine-video-1.5
Use Grok Imagine Video 1.5 with the Mynth REST API. Text-to-video, image-to-video, duration, and resolution.
```text Model ID theme={"theme":"kanagawa-dragon"}
xai/grok-imagine-video-1.5
```
See pricing & more on [mynth.io](https://mynth.io/models/xai%2Fgrok-imagine-video-1.5).
## Capabilities
| | |
| -------------- | -------------------------------------- |
| **Modes** | Text-to-video · Image-to-video |
| **Inputs** | 1 first-frame image (image-to-video) |
| **Resolution** | 480p · 720p · 1080p (default 480p) |
| **Duration** | 1–15 seconds (default 8) |
| **Audio** | Native generated audio (on by default) |
## Generate
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/video/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A paper lantern drifts across a still canal at dusk",
"model": "xai/grok-imagine-video-1.5",
"resolution": "720p",
"duration": 8
}'
```
## Use a first frame
Pass **1** input image for image-to-video. The image becomes the opening frame. URLs or uploaded files both work. See [Upload input images](/guides/upload-input-images).
```bash REST API theme={"theme":"kanagawa-dragon"}
curl https://api.mynth.io/video/generate \
-X POST \
-H "Authorization: Bearer $MYNTH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Slow push-in as the lantern sways in a night breeze",
"model": "xai/grok-imagine-video-1.5",
"inputs": [
{
"type": "image",
"source": { "type": "url", "url": "https://example.com/input-image.jpg" }
}
],
"resolution": "720p",
"duration": 8
}'
```
# Quickstart
Source: https://docs.mynth.io/quickstart
Generate your first image with Mynth and understand the result you get back.
This quickstart gets you from zero to a completed image task using the official JavaScript and TypeScript SDK.
Create a key in the [Mynth dashboard](https://mynth.io/dashboard/keys).
If you work with multiple environments, create separate keys and set a spending limit for each one.
```bash Bun theme={"theme":"kanagawa-dragon"}
bun add @mynthio/sdk
```
```bash PNPM theme={"theme":"kanagawa-dragon"}
pnpm add @mynthio/sdk
```
```bash NPM theme={"theme":"kanagawa-dragon"}
npm install @mynthio/sdk
```
`bash export MYNTH_API_KEY=mak_your_key_here `
```ts theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const task = await mynth.image.generate({
prompt: "Editorial product photo of a ceramic mug on a linen tablecloth",
model: "google/gemini-3.1-flash-image",
});
console.log(task.urls);
```
By default, `generate()` waits for completion. The returned `task` is already a completed task object, so `task.urls` contains the successful image URLs immediately.
```ts theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generateAsync({
prompt: "A floating garden at sunrise",
model: "google/gemini-3.1-flash-image",
});
console.log(task.id);
console.log(task.access.publicAccessToken);
```
`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.
## What to read next
Learn when to use sync, async, polling, and browser-safe access tokens.
Send results to your backend automatically.
See every request field that Mynth accepts.
Understand `Task`, `TaskAsync`, and polling behavior in detail.
# Authentication
Source: https://docs.mynth.io/reference/authentication
Authenticate Mynth API requests with API keys and understand Public Access Tokens.
## API keys
Create API keys in the [dashboard](https://mynth.io/dashboard/keys). Raw keys use the `mak_` prefix and are shown only once at creation time.
Send them as Bearer tokens:
```http theme={"theme":"kanagawa-dragon"}
Authorization: Bearer mak_...
```
API keys authenticate these endpoints:
* `POST /image/generate`
* `POST /image/upload`
* `POST /image/rate`
* `GET /tasks/:id`
`GET /tasks/:id/status` and `GET /tasks/:id/result` also accept API keys, but are typically called with a [Public Access Token](#public-access-tokens).
## Spending limits
Each API key supports an optional spending limit, enforced when a task is created. The estimated cost is reserved against the limit before generation begins and rolled back if the task fails to enqueue.
The dashboard supports these periods:
* `day`
* `week`
* `month`
Use them to isolate environments, tenants, or workflows.
## Public Access Tokens
A task-scoped Public Access Token (PAT) is a short-lived JWT with the `pat_` prefix. Mynth returns one in the generate response when `access.pat.enabled` is `true` (the default):
```json theme={"theme":"kanagawa-dragon"}
{
"data": {
"taskId": "tsk_01KE7XWWEQ4MCGWKBQKJ1G47RP",
"access": {
"publicAccessToken": "pat_eyJhbGciOi..."
}
}
}
```
PATs are valid for one hour and scoped to a single task. Use them for:
* `GET /tasks/:id/status`
* `GET /tasks/:id/result`
Do not use them for task creation or as a general replacement for your API key.
## Concurrency
Mynth does not impose API concurrency limits. If your application needs to create several tasks at once, you can issue requests in parallel and manage the coordination on your side.
## Owner-only task access
`GET /tasks/:id` is owner-only. It requires the original account's API key and returns the full task object.
# Errors and Limits
Source: https://docs.mynth.io/reference/errors-and-limits
Practical limits, validation boundaries, and the main failure cases to account for.
## Practical limits
### Image generation
* `count` maximum: `20`
* prompt length maximum: `8192` characters
* negative prompt length maximum: `8192` characters
* `inputs` maximum per request: `20`
* `input` shortcut maximum length: `2048` characters
* custom webhook endpoints per request: `5`
* `destination` name maximum length: `64` characters
* `metadata` maximum size: `2 KB`
### Content rating
* URLs per request maximum: `10`
* custom levels minimum: `2`
* custom levels maximum: `7`
* custom level `value` max length: `24`
* custom level `description` max length: `150`
### Alt text
* URLs per request maximum: `10`
* alt text maximum length: `160` characters
### Uploads
* maximum files per request: `10`
* maximum file size: `10 MB`
* minimum file size: `1 KB`
* maximum request body size: `100 MB`
* accepted formats: JPEG, PNG, WEBP
## Concurrency
Mynth does not enforce API concurrency limits. If you want to create many independent tasks, you can send requests in parallel.
## Error response shape
Every API error returns a JSON body with a machine-readable `code` and a human-readable `message`:
```json theme={"theme":"kanagawa-dragon"}
{
"code": "VALIDATION_ERROR",
"message": "Count cannot exceed 20 images per request"
}
```
Codes are stable and `SCREAMING_SNAKE_CASE`. `message` is informational and may change; do not parse it.
## Common failure cases
### Unauthorized
HTTP `401` with `code: "UNAUTHORIZED"`.
You used:
* a missing or invalid API key
* a Public Access Token on an owner-only endpoint
* a task token for the wrong task
```json theme={"theme":"kanagawa-dragon"}
{
"code": "UNAUTHORIZED",
"message": "Invalid API key"
}
```
### Validation errors
HTTP `400` with `code: "VALIDATION_ERROR"`.
The request shape does not match what Mynth expects, or the selected model does not support a requested capability such as input images.
```json theme={"theme":"kanagawa-dragon"}
{
"code": "VALIDATION_ERROR",
"message": "The selected model does not support input images."
}
```
### Insufficient balance
HTTP `422` with `code: "INSUFFICIENT_BALANCE"`.
Task creation reserves cost before generation begins. Requests fail when the account does not have enough available balance.
```json theme={"theme":"kanagawa-dragon"}
{
"code": "INSUFFICIENT_BALANCE",
"message": "Insufficient balance."
}
```
### Spending limit exceeded
HTTP `429` with `code: "SPENDING_LIMIT_EXCEEDED"`.
The reserved cost would push the API key's spending limit past its configured cap for the current period. See [Authentication](/reference/authentication#spending-limits).
```json theme={"theme":"kanagawa-dragon"}
{
"code": "SPENDING_LIMIT_EXCEEDED",
"message": "Spending limit exceeded"
}
```
### Upload too large
HTTP `413` with `code: "VALIDATION_ERROR"`.
The upload request body exceeds the maximum size.
```json theme={"theme":"kanagawa-dragon"}
{
"code": "VALIDATION_ERROR",
"message": "Upload body is too large"
}
```
### Not found
HTTP `404` with `code: "TASK_NOT_FOUND"`.
The task ID does not exist, or you do not have access to it.
```json theme={"theme":"kanagawa-dragon"}
{
"code": "TASK_NOT_FOUND"
}
```
### Task failed
The task was accepted but did not complete successfully. This is not an HTTP error. Polling eventually returns `status: "failed"` with an `errors` array, and webhook delivery emits the matching `*.failed` event with the same `errors` array (for example `task.image.generate.failed`).
See [Task error codes](#task-error-codes).
## Task error codes
Failed tasks expose an `errors` array of `{ code, message? }` objects. The same array appears on:
* `GET /tasks/:id` when `status` is `failed`
* every `*.failed` webhook payload
`code` is stable `SCREAMING_SNAKE_CASE` and safe to branch on. `message` is optional, human-readable, and must not be parsed. The array is always present and non-empty on failed tasks.
Per-image failures inside a *completed* generate result use the same `{ code, message? }` shape on `result.images[].error` — same codes, scoped to that image.
| Code | Meaning | What to do |
| -------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------------ |
| `INVALID_INPUT` | One or more image inputs could not be processed | Ensure input URLs are valid and publicly accessible, then resubmit |
| `INVALID_PROMPT` | The prompt is empty or outside the allowed length | Fix the prompt; do not retry the same request |
| `RESTRICTED_CONTENT` | The request was blocked by content moderation | Change the prompt or inputs; do not retry the same request |
| `CAPABILITY_NOT_SUPPORTED` | The request uses options the selected model does not support | Adjust options or choose a different model |
| `RATE_LIMITED` | Upstream rate limit hit | Wait briefly, then retry |
| `TIMEOUT` | The provider did not respond in time | Retry the request |
| `TASK_EXPIRED` | The task stayed pending too long and was marked failed | Do not retry the same task; submit a new request if needed |
| `PROVIDER_ERROR` | The provider failed to process the request | Retry the request |
| `ENQUEUE_FAILED` | The task could not be queued for processing | Retry the request |
| `FETCH_FAILED` | The source image URL could not be fetched (rate / alt tasks) | Confirm the URL is reachable and returns an image, then resubmit |
| `RATING_FAILED` | Content rating could not be completed | Retry; if it persists, try a different image URL |
| `ALT_GENERATION_FAILED` | Alt text generation could not be completed | Retry; if it persists, try a different image URL |
| `UNKNOWN_ERROR` | An unclassified failure | Retry once; contact support if it repeats |
## SDK-specific errors
The JavaScript SDK can also throw:
* `MynthAPIError` - wraps all API errors with the HTTP `status` and the error `code`
* `TaskAsyncTimeoutError` - `wait()` polled for 30 minutes without completion
* `TaskAsyncUnauthorizedError` - the Public Access Token was rejected
* `TaskAsyncFetchError` - a network fetch failed during polling
* `TaskAsyncTaskFetchError` - the task detail fetch failed
* `TaskAsyncTaskFailedError` - the task completed with `status: "failed"`
Catch `MynthAPIError` to inspect the underlying API error:
```ts theme={"theme":"kanagawa-dragon"}
import { MynthAPIError } from "@mynthio/sdk";
try {
const task = await mynth.image.generate({ prompt: "..." });
} catch (error) {
if (error instanceof MynthAPIError) {
console.error(error.status); // HTTP status code
console.error(error.code); // API error code, e.g. "VALIDATION_ERROR"
}
}
```
# Image Alt Request
Source: https://docs.mynth.io/reference/image-alt-request
Reference for the request body and response shape of POST /image/alt.
Endpoint:
```text theme={"theme":"kanagawa-dragon"}
POST https://api.mynth.io/image/alt
```
Authentication: API key or OAuth access token required. Public Access Tokens are not accepted.
The endpoint is **async only**. It creates an `image.alt` task and returns `201` with a `taskId`. Poll task endpoints or use webhooks to get the alt text result.
## Request body
```json theme={"theme":"kanagawa-dragon"}
{
"url": "https://example.com/photo-1.webp"
}
```
## Fields
| Field | Type | Default | Notes |
| ----- | -------- | ---------- | ---------------------------------------------------- |
| `url` | `string` | *required* | Image URL to generate alt text for. Must be http(s). |
## Response body
### `201` — task created
```json theme={"theme":"kanagawa-dragon"}
{
"data": {
"taskId": "tsk_01KE7XWWEQ4MCGWKBQKJ1G47RP",
"estimatedCost": "0.0004"
}
}
```
| Field | Type | Notes |
| -------------------- | -------- | -------------------------------------------------------------------- |
| `data.taskId` | `string` | Task ID. Poll `/tasks/:id` or use webhooks for the result. |
| `data.estimatedCost` | `string` | Estimated cost in USD reserved for this task. Failed tasks are free. |
When the task completes, `GET /tasks/:id` (or the webhook payload) includes:
```json theme={"theme":"kanagawa-dragon"}
{
"result": {
"url": "https://example.com/photo-1.webp",
"alt": "A ceramic mug on a wooden table beside a window."
}
}
```
| Field | Type | Notes |
| ----- | -------- | ------------------- |
| `url` | `string` | The submitted URL. |
| `alt` | `string` | Generated alt text. |
If generation fails, the task status is `failed` with `errors: [{ code, message? }]`. Common codes: `FETCH_FAILED`, `ALT_GENERATION_FAILED`, `UNKNOWN_ERROR`. See [Task error codes](/reference/errors-and-limits#task-error-codes).
## Limits
| Constraint | Value |
| ---------------- | ------------------- |
| URLs per request | 1 |
| Alt text length | 1 to 160 characters |
## Pricing
Each request is priced at **\$0.0004**. That amount is reserved from your account balance before processing begins. You are charged only when the task completes successfully — failed tasks release the reserve. If your balance is insufficient, the request returns `422 INSUFFICIENT_BALANCE`.
## Error responses
| Status | Body | Cause |
| ------ | ----------------------------------- | ------------------------------------------------- |
| `400` | `{ success: false, errors: [...] }` | Request body fails schema validation. |
| `401` | `{ code: "UNAUTHORIZED", ... }` | Missing or invalid API key or OAuth access token. |
| `422` | `{ code: "INSUFFICIENT_BALANCE" }` | Account balance is too low to reserve the cost. |
See [Errors and Limits](/reference/errors-and-limits) for the full error reference.
# Image Generation Request
Source: https://docs.mynth.io/reference/image-generation-request
Reference for the request body accepted by POST /image/generate.
Endpoint:
```text theme={"theme":"kanagawa-dragon"}
POST https://api.mynth.io/image/generate
```
## Request body
```json theme={"theme":"kanagawa-dragon"}
{
"prompt": "Modern poster design for a jazz festival",
"negative_prompt": "watermark, blurry text",
"magic_prompt": true,
"model": "google/gemini-3.1-flash-image",
"size": {
"type": "aspect_ratio",
"aspectRatio": "4:5",
"scale": "4k"
},
"count": 2,
"inputs": [
{
"type": "image",
"source": {
"type": "url",
"url": "https://example.com/reference.png"
}
}
],
"output": {
"format": "webp"
},
"webhook": {
"dashboard": false,
"custom": [
{
"url": "https://example.com/api/mynth-webhook?token=abc123"
}
]
},
"rating": {
"mode": "nsfw_sfw"
},
"metadata": {
"requestId": "req_123"
},
"access": {
"pat": {
"enabled": true
}
}
}
```
## Fields
| Field | Type | Default | Notes |
| ----------------- | ------------------ | ---------- | ------------------------------------------------------------------------------------------------- |
| `prompt` | `string` | *required* | Positive prompt, 1–8192 characters. |
| `negative_prompt` | `string` | — | Optional negative prompt, 1–8192 characters. |
| `magic_prompt` | `true` | — | Set to `true` to enable Mynth-side prompt enhancement. |
| `model` | `string` | `"auto"` | A model ID or `"auto"`. Set a specific model in production. |
| `size` | `string` or object | `"auto"` | Presets, structured aspect ratios, or `"auto"`. |
| `count` | `number` | `1` | Minimum `1`, maximum `20`. |
| `inputs` | `array` | `[]` | String URLs or structured image input objects. Maximum 20. |
| `output` | `object` | — | Optional `format` (`png`, `jpg`, `webp`). Omitted → the model's native format. |
| `webhook` | `object` | — | `dashboard` (`false`) and `custom` (array of `{ url }`). |
| `rating` | `true` or object | — | `true`, `{ "mode": "nsfw_sfw" }`, or `{ "mode": "custom", "levels": [...] }`. |
| `destination` | `string` | — | Name of a configured destination to deliver generated images to. |
| `metadata` | `object` | — | Arbitrary JSON, maximum 2 KB. Returned with the task and webhook payloads. |
| `access` | `object` | — | `pat.enabled` (boolean, default `true`). Controls whether a task-scoped access token is returned. |
### Object details
**`inputs` entry:**
```json theme={"theme":"kanagawa-dragon"}
{
"type": "image",
"source": {
"type": "url",
"url": "https://example.com/reference.png"
}
}
```
String URLs are a shorthand for image inputs. Structured entries use `type` and `source`.
**`webhook` object:**
```json theme={"theme":"kanagawa-dragon"}
{
"dashboard": false,
"custom": [{ "url": "https://example.com/hook" }]
}
```
Set `dashboard: false` to skip dashboard-managed webhooks for this task. Maximum 5 custom endpoints. Custom endpoints are not signed. See [Use Webhooks](/guides/use-webhooks).
**`output` object:**
```json theme={"theme":"kanagawa-dragon"}
{
"format": "webp"
}
```
`format` is best effort. A model that cannot deliver the requested format delivers its own instead.
**`access` object:**
```json theme={"theme":"kanagawa-dragon"}
{
"pat": { "enabled": true }
}
```
Returns a `publicAccessToken` for browser-safe polling. See [Browser Polling](/tutorials/browser-polling).
## Prompt enhancement
Set `magic_prompt: true` to opt into Mynth-side prompt enhancement. When enabled, the enhanced prompt is returned in `result.magic_prompt` (with `positive` and optional `negative`).
## Size presets
* `square`
* `portrait`
* `landscape`
* `portrait_tall`
* `landscape_wide`
* `1:1`
* `2:3`
* `3:2`
* `3:4`
* `4:3`
* `4:5`
* `5:4`
* `9:16`
* `16:9`
* `21:9`
* `2:1`
* `1:2`
* `1:1_4k`
* `2:3_4k`
* `3:2_4k`
* `3:4_4k`
* `4:3_4k`
* `4:5_4k`
* `5:4_4k`
* `9:16_4k`
* `16:9_4k`
* `21:9_4k`
* `2:1_4k`
* `1:2_4k`
## Structured size objects
### Aspect ratio
```json theme={"theme":"kanagawa-dragon"}
{ "type": "aspect_ratio", "aspectRatio": "16:9" }
```
Supported aspect ratios:
* `1:1`
* `2:3`
* `3:2`
* `3:4`
* `4:3`
* `4:5`
* `5:4`
* `9:16`
* `16:9`
* `21:9`
* `2:1`
* `1:2`
Optional `scale` values:
* `base` (default)
* `4k`
When `scale: "4k"` is requested, models with dedicated 4K pricing are billed at their 4K rate.
For each successful output image, input images are billed as `perImage + perInput * inputs.length`.
### Auto
```json theme={"theme":"kanagawa-dragon"}
{ "type": "auto" }
```
Mynth picks the size automatically. When the model can size natively, that path
is used; otherwise Mynth resolves a size for you. This is not configurable.
# Image Rate Request
Source: https://docs.mynth.io/reference/image-rate-request
Reference for the request body and response shape of POST /image/rate.
Endpoint:
```text theme={"theme":"kanagawa-dragon"}
POST https://api.mynth.io/image/rate
```
Authentication: API key or OAuth access token required. Public Access Tokens are not accepted.
The endpoint is **async only**. It creates an `image.rate` task and returns `201` with a `taskId`. Poll task endpoints or use webhooks to get the rating result.
## Request body
```json theme={"theme":"kanagawa-dragon"}
{
"url": "https://example.com/photo-1.webp",
"mode": "custom",
"levels": [
{ "value": "safe", "description": "Safe for all audiences" },
{ "value": "sensitive", "description": "Contains mature or suggestive content" },
{ "value": "explicit", "description": "Explicit adult content" }
]
}
```
Minimal request (default `nsfw_sfw` scale):
```json theme={"theme":"kanagawa-dragon"}
{
"url": "https://example.com/photo-1.webp"
}
```
## Fields
| Field | Type | Default | Notes |
| -------- | -------- | ---------- | ----------------------------------------------------------- |
| `url` | `string` | *required* | Image URL to rate. Must be an `http` or `https` URL. |
| `mode` | `string` | `nsfw_sfw` | `nsfw_sfw` for the built-in scale, or `custom`. |
| `levels` | `array` | — | Required when `mode` is `custom`. Defines the rating scale. |
### `levels` items
Each item in the `levels` array must have:
| Field | Type | Constraints | Notes |
| ------------- | -------- | ---------------- | ----------------------------------------------------------- |
| `value` | `string` | 1–24 characters | The string returned in the result for images at this level. |
| `description` | `string` | 1–150 characters | Natural-language description used by the rating model. |
Constraints for the `levels` array:
* Minimum `2` items
* Maximum `7` items
**How the rating model uses levels**
The `description` of each level is passed directly to a vision language model (LLM), which selects the best match for the image. Because LLM inference is non-deterministic, results for borderline images may occasionally vary between requests.
This endpoint is optimised for speed and accuracy at a high level of abstraction. Broad, clearly separated scales such as `safe` / `suggestive` / `explicit` or `safe-for-children` / `safe-for-adults` / `nsfw` perform reliably. Scales that depend on subtle visual distinctions — for example distinguishing between artistic and explicit nudity — are outside the intended scope and may produce inconsistent results. Test thoroughly before using such scales in production.
## Response body
### `201` — task created
```json theme={"theme":"kanagawa-dragon"}
{
"data": {
"taskId": "tsk_01KE7XWWEQ4MCGWKBQKJ1G47RP",
"estimatedCost": "0.0002"
}
}
```
| Field | Type | Notes |
| -------------------- | -------- | -------------------------------------------------------------------- |
| `data.taskId` | `string` | Task ID. Poll `/tasks/:id` or use webhooks for the result. |
| `data.estimatedCost` | `string` | Estimated cost in USD reserved for this task. Failed tasks are free. |
When the task completes, `GET /tasks/:id` (or the webhook payload) includes:
```json theme={"theme":"kanagawa-dragon"}
{
"result": {
"url": "https://example.com/photo-1.webp",
"level": "sfw"
}
}
```
| Field | Type | Notes |
| ------- | -------- | ------------------------------------------------ |
| `url` | `string` | The submitted image URL. |
| `level` | `string` | The assigned rating value from the active scale. |
When using the default scale, `level` is one of `sfw` or `nsfw`.
When using custom levels, `level` is the `value` of the chosen level.
If rating fails, the task status is `failed` with `errors: [{ code, message? }]`. Common codes: `FETCH_FAILED`, `RATING_FAILED`, `UNKNOWN_ERROR`. See [Task error codes](/reference/errors-and-limits#task-error-codes).
## Limits
| Constraint | Value |
| ------------------- | ---------------- |
| URLs per request | 1 |
| Custom levels | 2–7 |
| Level `value` | 1–24 characters |
| Level `description` | 1–150 characters |
## Pricing
Each request is priced at **\$0.0002**. That amount is reserved from your account balance before processing begins. You are charged only when the task completes successfully — failed tasks release the reserve. If your balance is insufficient, the request returns `422 INSUFFICIENT_BALANCE`.
## Error responses
| Status | Body | Cause |
| ------ | ----------------------------------- | ------------------------------------------------- |
| `400` | `{ success: false, errors: [...] }` | Request body fails schema validation. |
| `401` | `{ code: "UNAUTHORIZED", ... }` | Missing or invalid API key or OAuth access token. |
| `422` | `{ code: "INSUFFICIENT_BALANCE" }` | Account balance is too low to reserve the cost. |
See [Errors and Limits](/reference/errors-and-limits) for the full error reference.
# OpenAPI Reference
Source: https://docs.mynth.io/reference/openapi
Use the live OpenAPI document for endpoint schemas and interactive API exploration.
Mynth publishes a live OpenAPI document at:
* [api.mynth.io/openapi.json](https://api.mynth.io/openapi.json)
Use it when you need:
* endpoint schema details
* response models
* interactive request exploration
* generated clients in other languages
The document declares three bearer security schemes, all sent as `Authorization: Bearer `:
* `apiKeyAuth` - a Mynth API key (`mak_...`)
* `oauthAuth` - a dashboard OAuth access token (JWT)
* `publicAccessTokenAuth` - a task-scoped Public Access Token (`pat_...`)
See [Authentication](/reference/authentication) for when to use each.
This documentation site focuses on workflow design and practical integration guidance. The OpenAPI reference remains the authoritative machine-readable API contract.
# Tasks
Source: https://docs.mynth.io/reference/tasks
Reference for task endpoints, statuses, and result retrieval.
Mynth tasks represent asynchronous work. Image generation, content rating, and alt text requests all create tasks.
Task types:
* `image.generate`
* `image.rate`
* `image.alt`
## Status values
* `pending`
* `completed`
* `failed`
## Endpoints
### `GET /tasks/:id`
Returns the full task object.
Authentication:
* requires your Mynth API key
* owner-only
* Public Access Tokens do not work here
### `GET /tasks/:id/status`
Returns only:
```json theme={"theme":"kanagawa-dragon"}
{
"data": {
"status": "pending"
}
}
```
Authentication:
* API key, or
* task-scoped Public Access Token
### `GET /tasks/:id/result`
Returns:
```json theme={"theme":"kanagawa-dragon"}
{
"data": {
"id": "tsk_01KE7XWWEQ4MCGWKBQKJ1G47RP",
"status": "completed",
"type": "image.generate",
"result": {
"model": "google/gemini-3.1-flash-image",
"images": [
{
"status": "success",
"id": "img_123",
"url": "https://...",
"mynth_url": "https://...",
"size": "1024x1024"
}
]
}
}
}
```
Authentication:
* API key, or
* task-scoped Public Access Token
## Full task shape
`GET /tasks/:id` returns the complete task object:
```json theme={"theme":"kanagawa-dragon"}
{
"data": {
"id": "tsk_01KE7XWWEQ4MCGWKBQKJ1G47RP",
"status": "completed",
"type": "image.generate",
"cost": "0.01250000",
"createdAt": "2025-01-15T10:30:00.000Z",
"updatedAt": "2025-01-15T10:30:12.000Z",
"request": {
"prompt": "Editorial product photo of a ceramic mug",
"model": "google/gemini-3.1-flash-image",
"size": "landscape",
"count": 1
},
"result": {
"model": "google/gemini-3.1-flash-image",
"images": [
{
"status": "success",
"id": "img_123",
"url": "https://...",
"mynth_url": "https://...",
"size": "1536x1024"
}
]
}
}
}
```
Fields:
* `request` contains the original task parameters as submitted.
* `result` contains task-specific output. It is `null` for `pending` tasks and for failed tasks that did not produce a result.
* For `image.generate`, `result` contains the resolved `model`, `images`, and optional `magic_prompt`.
* For `image.rate`, `result` is `{ url, level }` when completed.
* For `image.alt`, `result` is `{ url, alt }` when completed.
* `result.magic_prompt` is present when `magic_prompt: true` was applied, containing the enhanced `positive` and optional `negative` prompt.
* `cost` is the total task cost as a decimal string.
* When `size: "auto"` is used, the selected dimensions are reflected in each image's `size` field (`{width}x{height}`).
* `errors` is present on `failed` tasks as an array of `{ code, message? }`. See [Task error codes](/reference/errors-and-limits#task-error-codes).
## Result image states
Each image result is either:
* `success`
* `failed`
A successful image includes `id`, `url` (nullable when delivered only to a destination), `mynth_url`, and `size` (`{width}x{height}`). A failed image includes `error.code`.
If you want only successful image URLs in the SDK, use `task.urls` or `task.getImages()`.
# Webhooks
Source: https://docs.mynth.io/reference/webhooks
Reference for webhook events, headers, signature format, and payloads.
## Delivery model
Mynth supports:
* dashboard-managed webhooks
* task-level custom webhook endpoints
Dashboard-managed webhooks are signed. Task-level custom endpoints are not signed.
## Headers
Signed deliveries include:
| Header | Meaning |
| ------------------- | ---------------------------------------------- |
| `X-Mynth-Event` | The event name |
| `X-Mynth-Signature` | HMAC-SHA256 signature in `t=...,v1=...` format |
## Events
Payloads sent by the worker are image-task payloads:
* `task.image.generate.completed`
* `task.image.generate.failed`
* `task.image.rate.completed`
* `task.image.rate.failed`
* `task.image.alt.completed`
* `task.image.alt.failed`
Dashboard event subscriptions also support hierarchical matching through:
* `task.completed`
* `task.failed`
* `all`
For example, a `task.image.generate.completed` delivery can satisfy a webhook subscribed to `task.completed`.
## Signature verification
The signature is calculated from:
```text theme={"theme":"kanagawa-dragon"}
{timestamp}.{raw_request_body}
```
using the webhook secret and HMAC-SHA256.
The `X-Mynth-Signature` header format is:
```text theme={"theme":"kanagawa-dragon"}
t={timestamp},v1={signature}
```
Parse the timestamp and signature from the header, then recompute the HMAC over `{timestamp}.{raw_request_body}` using your webhook secret. Compare the result to the `v1` value.
See [Use Webhooks](/guides/use-webhooks#verify-webhook-signatures) for a complete code example.
## `task.image.generate.completed` payload
```json theme={"theme":"kanagawa-dragon"}
{
"event": "task.image.generate.completed",
"task": { "id": "tsk_123" },
"request": {
"prompt": "A campaign image for a summer travel brand"
},
"result": {
"model": "google/gemini-3.1-flash-image",
"images": [
{
"status": "success",
"id": "img_123",
"url": "https://...",
"mynth_url": "https://...",
"size": "1024x1024"
}
]
}
}
```
## `task.image.generate.failed` payload
Failed tasks do not include a `result` object because generation did not produce images. Failure detail is in `errors` instead.
```json theme={"theme":"kanagawa-dragon"}
{
"event": "task.image.generate.failed",
"task": { "id": "tsk_123" },
"request": {
"prompt": "A campaign image for a summer travel brand"
},
"errors": [
{
"code": "RESTRICTED_CONTENT",
"message": "The request was blocked by content moderation."
}
]
}
```
## `task.image.rate.completed` payload
```json theme={"theme":"kanagawa-dragon"}
{
"event": "task.image.rate.completed",
"task": { "id": "tsk_456" },
"request": {
"url": "https://example.com/image.png",
"mode": "nsfw_sfw"
},
"result": {
"url": "https://example.com/image.png",
"level": "sfw"
}
}
```
## `task.image.rate.failed` payload
```json theme={"theme":"kanagawa-dragon"}
{
"event": "task.image.rate.failed",
"task": { "id": "tsk_456" },
"request": {
"url": "https://example.com/image.png",
"mode": "nsfw_sfw"
},
"errors": [
{
"code": "FETCH_FAILED",
"message": "The image could not be fetched."
}
]
}
```
## `task.image.alt.completed` payload
```json theme={"theme":"kanagawa-dragon"}
{
"event": "task.image.alt.completed",
"task": { "id": "tsk_789" },
"request": {
"url": "https://example.com/image.png"
},
"result": {
"url": "https://example.com/image.png",
"alt": "A ceramic mug on a wooden table beside a window."
}
}
```
## `task.image.alt.failed` payload
```json theme={"theme":"kanagawa-dragon"}
{
"event": "task.image.alt.failed",
"task": { "id": "tsk_789" },
"request": {
"url": "https://example.com/image.png"
},
"errors": [
{
"code": "ALT_GENERATION_FAILED",
"message": "Alt text generation failed."
}
]
}
```
## `errors` on failed deliveries
Every `*.failed` delivery includes an `errors` array. The array is always non-empty.
Each entry is:
| Field | Required | Meaning |
| --------- | -------- | ------------------------------------------------------------ |
| `code` | Yes | Stable `SCREAMING_SNAKE_CASE` identifier — safe to branch on |
| `message` | No | Human-readable detail — informational only; do not parse |
This is the same `errors` array returned by `GET /tasks/:id` for failed tasks. See [Task error codes](/reference/errors-and-limits#task-error-codes) for the full code list.
# Integrations
Source: https://docs.mynth.io/sdk/integrations
Official integrations for Convex, TanStack Start, and TanStack AI.
Mynth provides integration packages for specific frameworks.
Verify webhook signatures and route events in Convex HTTP actions with `@mynthio/sdk/convex`.
Handle signed webhooks in TanStack Start server routes with `@mynthio/sdk/tanstack-start`.
Use Mynth as an image provider through TanStack AI's abstraction with
`@mynthio/tanstack-ai-adapter`.
## Choose the right path
* Use the [main SDK](/sdk/js-ts/overview) when Mynth is your primary integration surface.
* Use the Convex helper when you want verified webhook handling with less boilerplate.
* Use the TanStack Start helper for signed webhooks in Start server routes.
* Use the TanStack AI adapter when your app already speaks TanStack AI.
# Convex
Source: https://docs.mynth.io/sdk/integrations/convex
Verify webhook signatures and route events with @mynthio/sdk/convex.
`@mynthio/sdk/convex` provides `mynthWebhookAction()` for handling signed Mynth webhooks in Convex HTTP actions.
## Webhook helper
```ts theme={"theme":"kanagawa-dragon"}
import { mynthWebhookAction } from "@mynthio/sdk/convex";
export const mynthWebhook = mynthWebhookAction({
imageTaskCompleted: async (payload, { context }) => {
console.log(payload.task.id);
console.log(payload.result.images);
},
imageTaskFailed: async (payload) => {
console.error("Task failed", payload.task.id);
},
imageRateTaskCompleted: async (payload, { context }) => {
console.log(payload.result.url, payload.result.level);
},
imageRateTaskFailed: async (payload) => {
console.error("Rate task failed", payload.task.id);
},
imageAltTaskCompleted: async (payload, { context }) => {
console.log(payload.result.url, payload.result.alt);
},
imageAltTaskFailed: async (payload) => {
console.error("Alt text task failed", payload.task.id);
},
});
```
Each handler maps to a webhook event:
| Handler | Event |
| ------------------------ | ------------------------------- |
| `imageTaskCompleted` | `task.image.generate.completed` |
| `imageTaskFailed` | `task.image.generate.failed` |
| `imageRateTaskCompleted` | `task.image.rate.completed` |
| `imageRateTaskFailed` | `task.image.rate.failed` |
| `imageAltTaskCompleted` | `task.image.alt.completed` |
| `imageAltTaskFailed` | `task.image.alt.failed` |
The helper:
* verifies the `X-Mynth-Signature` header using HMAC-SHA256
* requires the `X-Mynth-Event` header, then routes on `payload.event`
* exposes Convex `context` (and the original `request`) for running queries and mutations
If you do not pass `webhookSecret` explicitly, the helper reads `MYNTH_WEBHOOK_SECRET` from the environment.
## Full walkthrough
For a complete Convex integration including schema, actions, webhooks, and reactive UI, see the [Convex full-stack guide](/guides/convex-full-stack-image-generation).
# TanStack AI
Source: https://docs.mynth.io/sdk/integrations/tanstack-ai
Generate images through TanStack AI's image abstraction with @mynthio/tanstack-ai-adapter.
The `@mynthio/tanstack-ai-adapter` package lets you use Mynth as an image provider through TanStack AI's `generateImage` API.
## Usage
```ts theme={"theme":"kanagawa-dragon"}
import { generateImage } from "@tanstack/ai";
import { mynthImage } from "@mynthio/tanstack-ai-adapter";
const result = await generateImage({
adapter: mynthImage("krea/krea-2-large"),
prompt: "Editorial product photo of a ceramic cup",
numberOfImages: 1,
size: "landscape",
});
```
## Image inputs (image-to-image)
Models that support image inputs accept TanStack AI's content-part prompts, so you can interleave instruction text with reference images. The adapter maps the image parts onto Mynth's `inputs`:
```ts theme={"theme":"kanagawa-dragon"}
const result = await generateImage({
adapter: mynthImage("black-forest-labs/flux-virtual-try-on"),
prompt: [
{ type: "text", content: "Dress the person in this garment" },
{
type: "image",
source: { type: "url", value: "https://example.com/person.jpg" },
metadata: { role: "character" },
},
{
type: "image",
source: { type: "url", value: "https://example.com/garment.jpg" },
},
],
});
```
Only models in `MYNTH_IMAGE_INPUT_MODELS` accept image parts; passing them to a text-only model is a compile-time error. For finer-grained input intents (`person`, `garment`, `pose`, `style`, …), pass `modelOptions.inputs` with an explicit `as`.
## When to use this adapter
Use it when your app already standardizes on TanStack AI's image abstraction and you want to add Mynth as a provider without changing your application code.
If Mynth is your primary integration surface, use the [main SDK](/sdk/js-ts/overview) directly for full control over async flows, polling, webhooks, and metadata.
# TanStack Start
Source: https://docs.mynth.io/sdk/integrations/tanstack-start
Verify and route Mynth webhooks in TanStack Start server routes.
`@mynthio/sdk/tanstack-start` provides `mynthWebhookHandler()` for handling signed Mynth webhooks in TanStack Start server routes.
```ts theme={"theme":"kanagawa-dragon"}
// src/routes/api/webhooks/mynth.ts
import { mynthWebhookHandler } from "@mynthio/sdk/tanstack-start";
import { createFileRoute } from "@tanstack/react-router";
export const Route = createFileRoute("/api/webhooks/mynth")({
server: {
handlers: {
POST: mynthWebhookHandler({
imageTaskCompleted: async (payload, { request, params, context }) => {
console.log("Completed task", payload.task.id);
console.log("Received at", request.url);
await saveImages(payload.task.id, payload.result.images);
},
imageTaskFailed: async (payload) => {
await markTaskFailed(payload.task.id, payload.errors);
},
}),
},
},
});
```
Set the signing secret shown when you create the webhook:
```env theme={"theme":"kanagawa-dragon"}
MYNTH_WEBHOOK_SECRET=wbs_...
```
The helper reads the raw request body, verifies `X-Mynth-Signature`, checks `X-Mynth-Event`, and calls the matching typed handler. Each handler also receives the original unread TanStack Start `request`, route `params`, and middleware `context`.
Keep the server route publicly reachable. Make callback side effects idempotent, and enqueue slow work before returning. Callback errors are propagated so Mynth can retry the delivery.
Pass `{ webhookSecret: "wbs_..." }` as the second argument when the application does not use `MYNTH_WEBHOOK_SECRET`. The helper accepts signed dashboard-managed webhooks; request-level custom webhooks are not signed.
# Client Configuration
Source: https://docs.mynth.io/sdk/js-ts/client
Configure the Mynth JavaScript and TypeScript client for production use.
The SDK exposes a single client class: `Mynth`.
## Basic setup
```ts theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const client = new Mynth();
```
If you omit `apiKey`, the SDK reads `MYNTH_API_KEY` from the environment.
## Explicit configuration
```ts theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const client = new Mynth({
apiKey: process.env.MYNTH_API_KEY,
baseUrl: "https://api.mynth.io",
destination: "my-store",
});
```
## Options
| Option | Type | Description |
| ------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `apiKey` | `string` | Your Mynth API key. Optional only when `MYNTH_API_KEY` is already set. |
| `baseUrl` | `string` | Override the default API base URL. Useful for proxies, tests, or custom deployments. |
| `destination` | `string` | Default destination slug to deliver generated images to. Optional only when `MYNTH_DESTINATION` is already set. Overridable per request via `request.destination`. |
## Authentication behavior
The client always sends Bearer authentication:
```http theme={"theme":"kanagawa-dragon"}
Authorization: Bearer mak_...
```
The SDK uses your API key for server-to-server requests. For browser-safe task polling, use the task's `publicAccessToken` instead of your API key.
The same client exposes image generation, rating, and alt text methods:
```ts theme={"theme":"kanagawa-dragon"}
await client.image.generate({ prompt: "A product photo" });
await client.image.rate({ url: "https://example.com/image.webp" });
await client.image.alt({ url: "https://example.com/image.webp" });
```
## When to override `baseUrl`
Override `baseUrl` only when you have a clear reason:
* an internal proxy
* a staging API
* tests that run against a mocked or isolated host
For standard production usage, keep the default `https://api.mynth.io`.
# JS/TS SDK Overview
Source: https://docs.mynth.io/sdk/js-ts/overview
Understand what the official Mynth SDK provides and when to use it.
The official SDK package is [`@mynthio/sdk`](https://www.npmjs.com/package/@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, rating, and alt text flows
* `ImageGenerationResult`, `ImageRateResult`, `ImageAltResult`, and `TaskAsync` abstractions
* built-in polling for async tasks
* exported runtime model metadata through `AVAILABLE_MODELS`
* webhook helpers for Convex, Next.js, and TanStack Start
## Installation
```bash Bun theme={"theme":"kanagawa-dragon"}
bun add @mynthio/sdk
```
```bash PNPM theme={"theme":"kanagawa-dragon"}
pnpm add @mynthio/sdk
```
```bash NPM theme={"theme":"kanagawa-dragon"}
npm install @mynthio/sdk
```
## Typical server-side use
`generate()` runs synchronously and resolves once the task is complete, returning an `ImageGenerationResult`:
```ts theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const result = await mynth.image.generate({
prompt: "A premium e-commerce hero image for a leather backpack",
model: "google/gemini-3.1-flash-image",
});
console.log(result.urls);
```
## Typical async use
`generateAsync()` starts generation and returns a `TaskAsync` immediately, so your server can respond fast and poll or wait later:
```ts theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generateAsync({
prompt: "A premium e-commerce hero image for a leather backpack",
model: "google/gemini-3.1-flash-image",
});
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
* first-class helpers for `mynth.image.generate`, `mynth.image.rate`, and `mynth.image.alt`
Use the raw API when you need another language or total transport-level control.
# Tasks and Polling
Source: https://docs.mynth.io/sdk/js-ts/tasks
Work with completed tasks, async tasks, helper methods, and SDK polling errors.
The SDK exposes completed result wrappers and an async task representation:
* `ImageGenerationResult` for completed work
* `ImageRateResult` for completed rating tasks
* `ImageAltResult` for completed alt text tasks
* `TaskAsync` for in-progress work
## `ImageGenerationResult`
`ImageGenerationResult` is returned from sync generation (`generate()`) and from `TaskAsync.wait()` on generation tasks.
Useful properties and helpers:
* `result.id`
* `result.status`
* `result.result`
* `result.urls`
* `result.getImages()`
* `result.getImages({ includeFailed: true })`
* `result.getMetadata()`
Example:
```ts theme={"theme":"kanagawa-dragon"}
const result = await mynth.image.generate({
prompt: "An orange bicycle leaning against a sunlit stone wall",
metadata: { requestId: "req_123" },
});
console.log(result.urls);
console.log(result.getMetadata());
```
## `ImageRateResult` and `ImageAltResult`
Single-image analysis results from `rate()` / `alt()` (or the matching `TaskAsync.wait()`):
```ts theme={"theme":"kanagawa-dragon"}
const rating = await mynth.image.rate({ url: "https://..." });
console.log(rating.level); // "sfw" | "nsfw"
console.log(rating.url);
console.log(rating.cost);
const altText = await mynth.image.alt({ url: "https://..." });
console.log(altText.alt);
console.log(altText.url);
```
## `TaskAsync`
`TaskAsync` is returned from:
```ts theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generateAsync(request);
const ratingTask = await mynth.image.rateAsync(request);
const altTask = await mynth.image.altAsync(request);
```
It provides:
* `task.id`
* `task.access.publicAccessToken`
* `task.wait()` — polls until completion and resolves to the matching result wrapper
## Browser-safe access token
`publicAccessToken` is a task-scoped JWT (prefixed with `pat_`) designed for client-side polling of:
* `GET /tasks/:id/status`
* `GET /tasks/:id/result`
Generation tasks include a Public Access Token by default. Rating and alt text tasks currently return `undefined` for `task.access.publicAccessToken`, so poll those from trusted server code with your API key.
Do not use a Public Access Token as a replacement for your server-side API key.
## Polling behavior
`wait()`:
* starts polling lazily — only when first called
* reuses the same promise if called multiple times
* polls every 2.5s for the first 12s, then slows to every 5s
* times out after 30 minutes
* retries transient fetch failures up to 7 times, resetting the count after any successful poll
## Error classes
The SDK exposes dedicated error classes:
* `MynthAPIError`
* `TaskAsyncTimeoutError`
* `TaskAsyncUnauthorizedError`
* `TaskAsyncFetchError`
* `TaskAsyncTaskFetchError`
* `TaskAsyncTaskFailedError`
Use them when you want differentiated handling for validation failures, unauthorized access, timeouts, and failed tasks.
See [Errors and Limits](/reference/errors-and-limits#sdk-specific-errors) for usage examples.
# Types and Models
Source: https://docs.mynth.io/sdk/js-ts/types-and-models
Use exported request types, task types, and runtime model metadata from the SDK.
The SDK exports request and result types through `MynthSDKTypes`.
## Import SDK types
```ts theme={"theme":"kanagawa-dragon"}
import type { MynthSDKTypes } from "@mynthio/sdk";
const request: MynthSDKTypes.ImageGenerationRequest = {
prompt: "Minimalist poster for a jazz festival",
model: "google/gemini-3.1-flash-image",
};
```
## Useful exported types
These types are members of the `MynthSDKTypes` namespace — access them as `MynthSDKTypes.` (they are not re-exported as top-level names):
* `MynthSDKTypes.ImageGenerationRequest`
* `MynthSDKTypes.ImageGenerationModel`
* `MynthSDKTypes.TaskData`
* `MynthSDKTypes.TaskStatus`
* `MynthSDKTypes.WebhookPayload`
The model metadata types are exported directly:
```ts theme={"theme":"kanagawa-dragon"}
import type { AvailableModel, ModelCapability } from "@mynthio/sdk";
```
## Runtime model metadata
The SDK also exports `AVAILABLE_MODELS`.
```ts theme={"theme":"kanagawa-dragon"}
import { AVAILABLE_MODELS } from "@mynthio/sdk";
const supportsInputs = AVAILABLE_MODELS.find(
(model) => model.id === "google/gemini-3.1-flash-image",
)?.capabilities.includes("inputs");
```
Capability strings (`ModelCapability`) include:
* `inputs`
* `mynth_magic_prompt`
* `negative_prompt`
* `4k`
* `native_enhance_prompt`
## Where to browse models
For human-facing model discovery, use [mynth.io/models](https://mynth.io/models). For application logic, use `AVAILABLE_MODELS` and set the model explicitly in production flows.
# Browser Polling
Source: https://docs.mynth.io/tutorials/browser-polling
Start image generation on your server and poll task status and results safely from the browser.
In this tutorial you will build an async image flow where:
1. Your server creates a Mynth task with your API key.
2. Mynth returns a task ID and a short-lived Public Access Token (PAT).
3. The browser polls task status and results with that PAT — never with your API key.
By the end you will have a complete create → poll → render path you can drop into an interactive app.
## Why this pattern
Task creation (`POST /image/generate`) requires a Mynth API key. Put that call on the server.
`GET /tasks/:id/status` and `GET /tasks/:id/result` also accept a task-scoped PAT. That is what the browser uses for live progress without a polling proxy.
CORS is open on those two endpoints so browser `fetch` works from your frontend origin. Other API routes are not open for arbitrary browser origins.
## Step 1. Create the task on your server
Keep the SDK and API key server-side only:
```ts theme={"theme":"kanagawa-dragon"}
import Mynth from "@mynthio/sdk";
const mynth = new Mynth({
apiKey: process.env.MYNTH_API_KEY,
});
export async function createGeneration() {
const task = await mynth.image.generateAsync({
prompt: "A clean landing page hero illustration for a fintech startup",
model: "google/gemini-3.1-flash-image",
});
return {
taskId: task.id,
publicAccessToken: task.access.publicAccessToken,
};
}
```
`generateAsync()` returns a `TaskAsync` immediately. Generation tasks include a PAT by default (`task.access.publicAccessToken`).
Disable it when you only poll from the server with your API key:
```ts theme={"theme":"kanagawa-dragon"}
const task = await mynth.image.generateAsync({
prompt: "A clean landing page hero illustration for a fintech startup",
model: "google/gemini-3.1-flash-image",
access: { pat: { enabled: false } },
});
```
About the PAT:
* JWT string with a `pat_` prefix
* Scoped to this single task ID
* Valid for one hour (generation PATs)
* Usable only on `GET /tasks/:id/status` and `GET /tasks/:id/result`
Rating and alt text tasks currently do not return a PAT. Poll those from trusted server code with your API key.
## Step 2. Return only safe data to the browser
Your app's API response should include:
* `taskId`
* `publicAccessToken`
Do **not** return `MYNTH_API_KEY`, the full task object from `GET /tasks/:id`, or other owner-only fields.
Example response:
```json theme={"theme":"kanagawa-dragon"}
{
"taskId": "tsk_01KE7XWWEQ4MCGWKBQKJ1G47RP",
"publicAccessToken": "pat_eyJhbGciOi..."
}
```
## Step 3. Poll status from the browser
Use raw `fetch` with the PAT as a Bearer token. Do not call the SDK from the browser with your API key, and do not rely on `task.wait()` in client code — `wait()` is for server-side use with the SDK client.
```ts theme={"theme":"kanagawa-dragon"}
type TaskStatus = "pending" | "completed" | "failed";
async function getTaskStatus(taskId: string, publicAccessToken: string): Promise {
const response = await fetch(`https://api.mynth.io/tasks/${taskId}/status`, {
headers: {
Authorization: `Bearer ${publicAccessToken}`,
},
});
if (response.status === 401 || response.status === 403) {
throw new Error("Public access token is invalid or expired");
}
if (!response.ok) {
throw new Error(`Status request failed: ${response.status}`);
}
const body = (await response.json()) as {
data: { status: TaskStatus };
};
return body.data.status;
}
```
Status response:
```json theme={"theme":"kanagawa-dragon"}
{
"data": {
"status": "pending"
}
}
```
Possible values: `pending`, `completed`, `failed`.
## Step 4. Poll until terminal, then fetch results
A simple client loop:
```ts theme={"theme":"kanagawa-dragon"}
const POLL_MS = 2500;
const TIMEOUT_MS = 30 * 60 * 1000;
async function waitForTask(taskId: string, publicAccessToken: string) {
const startedAt = Date.now();
while (Date.now() - startedAt < TIMEOUT_MS) {
const status = await getTaskStatus(taskId, publicAccessToken);
if (status === "completed") {
return getTaskResult(taskId, publicAccessToken);
}
if (status === "failed") {
throw new Error(`Task ${taskId} failed`);
}
await new Promise((resolve) => setTimeout(resolve, POLL_MS));
}
throw new Error(`Timed out waiting for task ${taskId}`);
}
async function getTaskResult(taskId: string, publicAccessToken: string) {
const response = await fetch(`https://api.mynth.io/tasks/${taskId}/result`, {
headers: {
Authorization: `Bearer ${publicAccessToken}`,
},
});
if (response.status === 401 || response.status === 403) {
throw new Error("Public access token is invalid or expired");
}
if (!response.ok) {
throw new Error(`Result request failed: ${response.status}`);
}
const body = (await response.json()) as {
data: {
id: string;
type: "image.generate";
status: "pending" | "completed" | "failed";
result: {
model: string;
images: Array<
| {
status: "success";
id: string;
url: string | null;
mynth_url: string;
size: string;
}
| {
status: "failed";
error: { code: string; message?: string };
}
>;
} | null;
};
};
return body.data;
}
```
Successful `image.generate` result shape:
```json theme={"theme":"kanagawa-dragon"}
{
"data": {
"id": "tsk_01KE7XWWEQ4MCGWKBQKJ1G47RP",
"type": "image.generate",
"status": "completed",
"result": {
"model": "google/gemini-3.1-flash-image",
"images": [
{
"status": "success",
"id": "img_123",
"url": "https://...",
"mynth_url": "https://...",
"size": "1024x1024"
}
]
}
}
}
```
Handle both task-level and per-image failure:
```ts theme={"theme":"kanagawa-dragon"}
const task = await waitForTask(taskId, publicAccessToken);
if (task.status !== "completed" || !task.result) {
throw new Error("Task did not complete successfully");
}
const urls: string[] = [];
for (const image of task.result.images) {
if (image.status === "success") {
// Prefer mynth_url when you need a stable CDN URL
urls.push(image.mynth_url);
} else {
console.error(image.error.code, image.error.message);
}
}
```
Notes:
* A completed task can still include individual `status: "failed"` images.
* `url` can be `null` when delivery is destination-only; `mynth_url` is still present on success.
* `GET /tasks/:id/result` does not include the owner-only `errors` array. For full task diagnostics, call `GET /tasks/:id` from the server with your API key.
## Step 5. Map states in the UI
| Status | UI |
| ------------- | ------------------------------------------------------------ |
| `pending` | Loading / progress |
| `completed` | Fetch result and render successful images |
| `failed` | Show failure and offer retry (create a new task server-side) |
| network / 401 | Retry a few times, or refresh the flow if the PAT expired |
Suggested client behavior:
* Poll every \~2.5s while the user is waiting (same order of magnitude as the SDK's fast phase).
* Stop on `completed` or `failed`.
* Cap wait time (for example 30 minutes).
* Treat 401/403 as an expired or invalid PAT — start a new generation from the server rather than reusing the token.
## What the PAT cannot do
A Public Access Token is not a substitute for your API key. It cannot:
* Create tasks
* Access other task IDs
* Call `GET /tasks/:id` (full owner-only task details)
For deeper polling options, intervals used by `TaskAsync.wait()`, and owner-only endpoints, read [Async and polling](/guides/async-and-polling) and [SDK tasks](/sdk/js-ts/tasks).
## When to use webhooks instead
Polling fits:
* interactive product flows
* browser previews
* short-lived user sessions
Webhooks fit:
* backend processing after generation
* durable pipelines
* systems that should not keep a browser tab open
See [Use webhooks](/guides/use-webhooks) when the result should trigger server-side work.