> Markdown copy of https://makernice.com/docs/ for AI tools. The HTML page is the canonical version.

API Reference[Download OpenAPI](https://makernice.com/openapi.json)[Get an API key](https://makernice.com/console/keys/)

# Makernice API docs: quickstart

[Makernice Team](https://makernice.com/about/) · Updated November 17, 2026

Best for

Developers who call video and image generation from their own code over REST: quote, create, then poll or receive a webhook.

Not for

The Makernice API is not for making videos or images without writing code; for that, use the console's Create section, which has the same models, prices and balance.

Generate a video with one API key and three requests: get a quote, create the generation, then poll until it's ready.

### 1\. Create an API key

In the console, open **Developers → API Keys** and create a key. Send it as a Bearer token on every request. Generations are charged to your wallet; you can cap each key with a spend limit.

### 2\. Get a quote

POSThttps://api.makernice.com/v1/generations/quote

curl

```
curl https://api.makernice.com/v1/generations/quote \
  -H "Authorization: Bearer $MAKERNICE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"seedance-2.5","mode":"t2v","prompt":"A slow dolly shot through a greenhouse","duration":5,"resolution":"720p"}'

# → (illustrative values) { "id": "qt_…", "amount": "500000", "expires_at": "…", "facts": { "quantity": 5, … } }
```

Amounts are in US dollars, in millionths of a dollar (micro-USD): `1,000,000` = $1.00. A quote locks the price for 12 minutes.

### 3\. Create the generation

POSThttps://api.makernice.com/v1/generations

curl

```
curl https://api.makernice.com/v1/generations \
  -H "Authorization: Bearer $MAKERNICE_API_KEY" \
  -H "Idempotency-Key: 7c1e9a2b-order-1842" \
  -H "Content-Type: application/json" \
  -d '{"quote_id":"qt_…","input":{"model":"seedance-2.5","mode":"t2v","prompt":"A slow dolly shot through a greenhouse","duration":5,"resolution":"720p"}}'

# → 202 { "id": "gen_…", "status": "queued", "billing": "held", … }
```

The amount is held from your balance. If the generation fails or you cancel it while queued, the hold is released in full. Retrying with the same `Idempotency-Key` returns the same generation instead of charging twice.

### 4\. Poll until it's ready

GEThttps://api.makernice.com/v1/generations/{id}

curl

```
curl https://api.makernice.com/v1/generations/gen_… \
  -H "Authorization: Bearer $MAKERNICE_API_KEY"

# status: queued → generating → moderating → succeeded | failed | canceled
# when succeeded: outputs[0].url → GET it with your key to receive a 302 to the file
```

### 5\. Download the file

curl

```
curl -L -o video.mp4 https://api.makernice.com/v1/generations/gen_…/outputs/0 \
  -H "Authorization: Bearer $MAKERNICE_API_KEY"
```

### Python: quote, create and poll

Set `MAKERNICE_API_KEY`, then run:

Python (requests)

```
import os
import time
import uuid
from decimal import Decimal

import requests

API = "https://api.makernice.com/v1"
ORIGIN = "https://api.makernice.com"
HEADERS = {"Authorization": f"Bearer {os.environ['MAKERNICE_API_KEY']}"}
TIMEOUT_SECONDS = 30
POLL_INTERVAL_SECONDS = 5
MAX_WAIT_SECONDS = 30 * 60
FINAL = {"succeeded", "failed", "canceled"}

def call(method, path, headers=None, **kwargs):
    # Waits out 429 (rate_limited, concurrency_limit_reached) using Retry-After; raises on any other error.
    for _ in range(5):
        r = requests.request(method, API + path, headers={**HEADERS, **(headers or {})}, timeout=TIMEOUT_SECONDS, **kwargs)
        if r.status_code == 429:
            time.sleep(int(r.headers.get("Retry-After", "5")))
            continue
        if not r.ok:
            raise RuntimeError(f"{method} {path} -> {r.status_code}: {r.text}")
        return r.json()
    raise RuntimeError(f"{method} {path}: still rate limited")

job = {
    "model": "seedance-2.5",
    "mode": "t2v",
    "prompt": "A slow dolly shot through a greenhouse",
    "duration": 5,
    "resolution": "720p",
}

# 1. Quote: the exact amount, locked for 12 minutes
quote = call("POST", "/generations/quote", json=job)
usd = Decimal(quote["amount"]).scaleb(-6)  # micro-USD integer string -> dollars, no float rounding
print(f"Quoted ${usd} (price list v{quote['price_version']}), valid until {quote['expires_at']}")

# 2. Create: same input + quote_id. A retry with the same Idempotency-Key returns the same generation
idempotency_key = str(uuid.uuid4())
gen = call("POST", "/generations", json={"quote_id": quote["id"], "input": job}, headers={"Idempotency-Key": idempotency_key})

# 3. Poll: queued -> generating -> moderating -> succeeded | failed | canceled (checking: keep polling)
deadline = time.monotonic() + MAX_WAIT_SECONDS
while gen["status"] not in FINAL:
    if time.monotonic() > deadline:
        raise SystemExit(f"{gen['id']} is still {gen['status']}; poll it again later")
    time.sleep(POLL_INTERVAL_SECONDS)
    gen = call("GET", f"/generations/{gen['id']}")

if gen["status"] != "succeeded":
    # billing is "released": the hold went back to your balance
    raise SystemExit(f"{gen['status']}, billing {gen['billing']}: {gen['error']}")

# 4. Download: outputs[].url is relative to the API origin and redirects (302) to the file
output = gen["outputs"][0]
if output["state"] == "blocked":
    raise SystemExit("Output blocked by moderation (the run is charged); contact support for a manual review")
r = requests.get(ORIGIN + output["url"], headers=HEADERS, timeout=120)  # requests drops Authorization on the redirect
r.raise_for_status()
with open("output.mp4", "wb") as f:
    f.write(r.content)
print(f"Saved output.mp4, charged ${Decimal(gen['amount']).scaleb(-6)}")
```

### Node.js: quote, create and poll

Node.js 18 or later, no packages needed. Save it as `quickstart.mjs`, set `MAKERNICE_API_KEY`, then run `node quickstart.mjs`:

Node.js (fetch)

```
// Node.js 18+ (built-in fetch, no packages). Save as quickstart.mjs and run: node quickstart.mjs
import { randomUUID } from "node:crypto";
import { writeFile } from "node:fs/promises";

const API = "https://api.makernice.com/v1";
const ORIGIN = "https://api.makernice.com";
const HEADERS = { Authorization: `Bearer ${process.env.MAKERNICE_API_KEY}` };
const TIMEOUT_MS = 30_000;
const POLL_INTERVAL_MS = 5_000;
const MAX_WAIT_MS = 30 * 60 * 1000;
const FINAL = new Set(["succeeded", "failed", "canceled"]);

const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
// micro-USD integer string -> dollars, no float rounding
const usd = (micro) => `${BigInt(micro) / 1_000_000n}.${(BigInt(micro) % 1_000_000n).toString().padStart(6, "0")}`;

class Stop extends Error {}

async function call(method, path, { body, headers } = {}) {
  // Waits out 429 (rate_limited, concurrency_limit_reached) using Retry-After; throws on any other error.
  for (let attempt = 0; attempt < 5; attempt++) {
    const r = await fetch(API + path, { signal: AbortSignal.timeout(TIMEOUT_MS),
      method,
      headers: { ...HEADERS, ...(body ? { "Content-Type": "application/json" } : {}), ...headers },
      body: body ? JSON.stringify(body) : undefined,
    });
    if (r.status === 429) {
      await sleep(Number(r.headers.get("Retry-After") ?? "5") * 1000);
      continue;
    }
    if (!r.ok) throw new Stop(`${method} ${path} -> ${r.status}: ${await r.text()}`);
    return r.json();
  }
  throw new Stop(`${method} ${path}: still rate limited`);
}

async function main() {
  const job = {
    "model": "seedance-2.5",
    "mode": "t2v",
    "prompt": "A slow dolly shot through a greenhouse",
    "duration": 5,
    "resolution": "720p",
  };

  // 1. Quote: the exact amount, locked for 12 minutes
  const quote = await call("POST", "/generations/quote", { body: job });
  console.log(`Quoted $${usd(quote.amount)} (price list v${quote.price_version}), valid until ${quote.expires_at}`);

  // 2. Create: same input + quote_id. A retry with the same Idempotency-Key returns the same generation
  const idempotencyKey = randomUUID();
  let gen = await call("POST", "/generations", { body: { quote_id: quote.id, input: job }, headers: { "Idempotency-Key": idempotencyKey } });

  // 3. Poll: queued -> generating -> moderating -> succeeded | failed | canceled (checking: keep polling)
  const deadline = Date.now() + MAX_WAIT_MS;
  while (!FINAL.has(gen.status)) {
    if (Date.now() > deadline) throw new Stop(`${gen.id} is still ${gen.status}; poll it again later`);
    await sleep(POLL_INTERVAL_MS);
    gen = await call("GET", `/generations/${gen.id}`);
  }

  if (gen.status !== "succeeded") {
    // billing is "released": the hold went back to your balance
    throw new Stop(`${gen.status}, billing ${gen.billing}: ${JSON.stringify(gen.error)}`);
  }

  // 4. Download: outputs[].url is relative to the API origin and answers 302 with a signed file URL.
  //    Follow it yourself so your API key is never sent to the file host.
  const [output] = gen.outputs;
  if (output.state === "blocked") throw new Stop("Output blocked by moderation (the run is charged); contact support for a manual review");
  const hop = await fetch(ORIGIN + output.url, { headers: HEADERS, redirect: "manual", signal: AbortSignal.timeout(TIMEOUT_MS) });
  const location = hop.headers.get("Location");
  if (hop.status < 300 || hop.status > 399 || !location) throw new Stop(`GET ${output.url} -> ${hop.status}`);
  const file = await fetch(new URL(location, ORIGIN + output.url), { signal: AbortSignal.timeout(120_000) });
  if (!file.ok) throw new Stop(`download -> ${file.status}`);
  await writeFile("output.mp4", Buffer.from(await file.arrayBuffer()));
  console.log(`Saved output.mp4, charged $${usd(gen.amount)}`);
}

main().catch((err) => {
  console.error(err instanceof Stop ? err.message : err);
  process.exit(1);
});
```

To run several generations at once, start them in parallel (for example with a thread pool, asyncio with an async HTTP client, or `Promise.all`). Each account has 2 generations in progress at once by default; past that, the API returns `429 concurrency_limit_reached` with `Retry-After`, which `call()` in both examples waits out. Contact support to raise the limit.

## Authentication

Every request needs an API key in the `Authorization` header, except `GET /v1/models` and `GET /v1/pricing`. Keys look like `mn-` followed by 48 letters and digits.

curl

```
curl https://api.makernice.com/v1/generations \
  -H "Authorization: Bearer $MAKERNICE_API_KEY"
```

-   The full key is shown only once, when you create it. We store only a fingerprint, so a lost key can't be recovered: create a new one and delete the old one.
-   A missing, malformed, unknown, disabled, expired or deleted key always gets the same `401 invalid_api_key` response. Disabling or deleting a key takes effect on the next request.
-   Call the API from your server. It doesn't accept cross-origin browser requests (no CORS); never put a key in front-end code.
-   Every key in an account sees the same generations: any key can get, list and cancel all of the account's generations, including the ones created in the console.
-   All keys in an account draw on the same prepaid balance. Today one Makernice account has one login; teams share one balance through multiple API keys.
-   The API Keys page shows each key's total spend, and the Usage page breaks API spend down by key and model.
-   In the console you can give a key an expiry date and a spend limit. A key's spend is the charged plus the currently held amount of the generations it created; a create request that would go over the limit gets `402 key_spend_limit_reached`. Failed and canceled generations don't count.

## Pricing & billing

-   Billing is in US dollars. All amounts are integer strings of micro-USD (millionths of a dollar): `1,000,000` = $1.00. Parse them as integers or decimals, not floating-point numbers.
-   Videos are priced per second (the quantity is the requested duration; for a template with a reference video clip it includes the clip's seconds), images per request (one image per generation). Price = unit price × quantity.
-   A quote locks the price for 12 minutes (`expires_at`). The generation is charged the quoted amount, even if prices change in the meantime.

`GET /v1/pricing` lists the unit prices of the current price version. It needs no API key and may be cached for up to 60 seconds. `official_unit_price`, when present, is the official list price of the same combination for comparison only; you are always billed `unit_price`. Image edits on Seedream 5.5, MiniMax H3-Image and Seedream 5.0 Pro are priced per reference image: those rows also carry `per_reference_price`. On Seedream 5.0 Pro the row also carries `free_references`, the number of reference images already included in `unit_price`. The quote is `unit_price` + (the number of `reference_images` − `free_references`) × `per_reference_price`; a row without `free_references` includes none.

GEThttps://api.makernice.com/v1/pricing

Example response (illustrative values)

```
{
  "price_version": 3,
  "data": [
    { "model": "seedance-2.5", "mode": "t2v", "resolution": "720p", "unit": "second", "unit_price": "100000", "unit_price_usd": "0.10", "official_unit_price": "120000" }
  ]
}
```

### Are failed generations charged?

No. The hold is released in full — you're never charged for a failed generation. Note: if a finished output is blocked by output moderation for a policy violation, the run is still charged. You can contact support for a manual review.

When you create a generation we hold the quoted amount. The hold is converted to a charge when the run completes; failed generations and timeouts release it in full, and so does canceling while it's queued. A released hold is not a refund. The money never left your balance.

| What happened | billing | Charged? |
| --- | --- | --- |
| The generation succeeds | `charged` | Yes, the quoted amount |
| The generation fails (`error.code` `generation_failed`, `upstream_unavailable` or `invalid_request`) | `released` | No  |
| It runs past its maximum runtime (`error.code: timeout`) | `released` | No  |
| You cancel it while it's `queued` | `released` | No  |
| The prompt is blocked when you create it (`422 content_rejected`, `reason: prompt`) | —   | No; no generation is created and nothing is held |
| An input image or the model provider's safety policy rejects it (`content_rejected`, `reason` `input_image` or `model`) | `released` | No  |
| The finished output is blocked by output moderation (output `state: blocked`) | `charged` | Yes; contact support for a manual review |
| The result is being confirmed (`status: checking`) | `held` | Only if it's confirmed to have succeeded |

[Billing examples](https://makernice.com/pricing/failed-generations/)

## Get a quote

Send the generation input; the response tells you exactly what the generation will cost. Each quote can be used for one generation.

POSThttps://api.makernice.com/v1/generations/quote

| Field | Type | Description |
| --- | --- | --- |
| `model` | string | Required. A model id from `GET /v1/models`. |
| `mode` | string | Required. `t2v`, `i2v`, `flf`, `r2v`, `t2i` or `i2i`; each model lists the modes it supports. |
| `prompt` | string | Required. 1–4,000 characters by default; some models allow fewer (see `maxPromptChars` in `GET /v1/models`). |
| `duration` | integer | Video only. Seconds, within the model's range; defaults to the model's default. |
| `resolution` | string | One of the model's `resolutions`; defaults to `defaultResolution`. Not allowed when the model lists none. |
| `aspect_ratio` | string | One of the mode's `aspectRatios`. |
| `image_url` | string | First frame. Required for `i2v` and `flf`. |
| `last_image_url` | string | Last frame. Required for `flf`. |
| `reference_images` | string\[\] | Required for `r2v` and `i2i`; at most the mode's `maxReferences`. |
| `seed` | integer | Optional. 0–2,147,483,647. The same seed with the same settings gives closer results. |
| `generate_audio` | boolean | Optional. Whether the video gets a soundtrack. Supported on every video model, on by default. When omitted and the prompt clearly asks for no sound (such as no audio or silent video), it is treated as false. When false, Wan generates silently; other models have the audio track removed after generation, without re-encoding the picture. The price stays the same. |
| `prompt_expansion` | string | Optional. `off`, `balanced` or `quality`: how much the model may rewrite your prompt. |
| `negative_prompt` | string | Optional. Up to 2,000 characters describing what to avoid. |
| `watermark` | boolean | Optional. Adds the provider's AI-generated watermark. |
| `draft` | boolean | Optional. Seedance 2.5 only, 480p only: `true` makes a draft you can later turn into a 1080p final. See [Draft mode](https://makernice.com/docs/#draft-mode). |
| `background` | string | Optional. Seedream 5.5 only: `auto` (default), `transparent` (PNG with no background) or `opaque`. |

The last seven fields are optional extras. Each model supports only some of them: `GET /v1/models` lists the ones available for every mode and resolution in `prices[].options`, with allowed values and defaults. A field no model route can apply returns `400 invalid_request`; changing an optional field needs a new quote, like any other field. `watermark` is currently accepted on Wan 3.0, Wan 3.0 Prime, Seedream 5.0, Seedream 5.0 Pro, MiniMax H3 and Happy Horse 1.1. If you omit it, Makernice does not send a watermark parameter and the model provider's default applies.

Images are public `https` URLs (up to 2,048 characters). Fields that the mode doesn't use, and unknown fields, are rejected with `400 invalid_request`; for input fields, `error.details` lists each problem as `{ path, message }` (other `invalid_request` errors may have a different `details` shape or none). A combination without a price returns `422 price_unavailable`.

Each image must be a publicly reachable `https` URL that serves a still JPEG, PNG or WebP image (animated WebP and GIF are not supported), at most 10 MB, directly at that URL: redirects are not followed. We fetch each image once and keep a copy; content moderation and the model both use that copy. If an image can't be used, the generation fails with `invalid_request`, `error.input` names the image, and the hold is released.

### What image sizes does each model accept?

Each model has its own pixel and aspect-ratio limits, set by the model provider and listed below. An image outside these limits fails with `invalid_request`, and the hold is released. For Kling 3.0, Kling 4.0 and Seedream 5.0, use JPEG or PNG. The same table is also on its own page: [Image input limits by model](https://makernice.com/docs/image-limits/).

| Model | Image size | Formats |
| --- | --- | --- |
| Seedance 2.5 | 300–6000 px per side, aspect ratio 2:5–5:2 | JPEG / PNG / WebP |
| Seedance 2.0 | 300–6000 px per side, aspect ratio 2:5–5:2 | JPEG / PNG / WebP |
| Seedance 2.0 Fast | 300–6000 px per side, aspect ratio 2:5–5:2 | JPEG / PNG / WebP |
| Seedance 2.5 Flash | 300–6000 px per side, aspect ratio 2:5–5:2 | JPEG / PNG / WebP |
| MiniMax H3 | 256–5760 px per side, aspect ratio 2:5–5:2 | JPEG / PNG / WebP |
| MiniMax H3 Max | 256–5760 px per side, aspect ratio 2:5–5:2 | JPEG / PNG / WebP |
| MiniMax H3 Max Turbo | 256–5760 px per side, aspect ratio 2:5–5:2 | JPEG / PNG / WebP |
| Wan 3.0 | 240–8000 px per side, aspect ratio 1:8–8:1, PNG without transparency | JPEG / PNG / WebP |
| Wan 3.0 Prime | 240–8000 px per side, aspect ratio 1:8–8:1, PNG without transparency | JPEG / PNG / WebP |
| Kling 3.0 Pro | at least 300 px per side, aspect ratio 2:5–5:2 | JPEG / PNG |
| Kling 3.0 Standard | at least 300 px per side, aspect ratio 2:5–5:2 | JPEG / PNG |
| Kling 4.0 | at least 300 px per side, aspect ratio 2:5–5:2 | JPEG / PNG |
| Happy Horse 1.1 | First and last frames: at least 300 px per side, aspect ratio 2:5–5:2; Reference images: at least 400 px per side, aspect ratio 2:5–5:2 | JPEG / PNG / WebP |
| Seedream 5.0 Pro | at least 15 px per side, up to 36 MP in total, aspect ratio 1:16–16:1 | JPEG / PNG / WebP |
| Seedream 5.0 | at least 15 px per side, up to 36 MP in total, aspect ratio 1:3–3:1 | JPEG / PNG |
| Seedream 5.5 | at least 15 px per side, up to 36 MP in total, aspect ratio 1:16–16:1 | JPEG / PNG / WebP |
| Qwen3 Image | up to 8000 px per side, aspect ratio 1:10–10:1 | JPEG / PNG / WebP |
| Qwen3 Pro Image | up to 8000 px per side, aspect ratio 1:10–10:1 | JPEG / PNG / WebP |
| MiniMax H3-Image | 128–8192 px per side, aspect ratio 1:4–4:1 | JPEG / PNG / WebP |

curl

```
curl https://api.makernice.com/v1/generations/quote \
  -H "Authorization: Bearer $MAKERNICE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"seedance-2.5","mode":"t2v","prompt":"A slow dolly shot through a greenhouse","duration":5,"resolution":"720p"}'
```

Example response (illustrative values)

```
{
  "id": "qt_6f1c…",
  "amount": "500000",
  "price_version": 3,
  "expires_at": "2026-10-09T09:24:41.000Z",
  "facts": { "model": "seedance-2.5", "mode": "t2v", "resolution": "720p", "variant": "default", "unit": "second", "quantity": 5 }
}
```

### How long does a quote lock the price?

Every quote locks its price for 12 minutes, and a generation is always charged exactly what it was quoted.

| Field or case | What it means |
| --- | --- |
| `expires_at` | 12 minutes after the quote was created. Create the generation before then. |
| `amount` | Unit price × `facts.quantity` (seconds for video, 1 for an image), in micro-USD. It's held when you create the generation and charged if it succeeds. |
| `price_version` | The price list the quote was taken from. If a new price list is published before you create the generation, you still pay the quoted amount. |
| After 12 minutes | Creating with the quote returns `410 quote_expired`. Nothing was held; get a new quote. |
| Changed model, mode, resolution or duration | `422 quote_mismatch`. Changing only the prompt keeps the quote. |
| Used the quote already | `409 quote_already_used`. Each quote is good for one generation. |

### Draft mode (Seedance 2.5)

With Seedance 2.5 you can make a 480p draft first, then turn the one you like into a 1080p final with the same settings.

-   Draft: add `draft: true` to a normal quote and create input. Drafts are Seedance 2.5 only and must be 480p (otherwise `400 draft_requires_480p`); a draft costs the same as a regular 480p generation.
-   Final: the quote and create `input` carry only `model` and `from_draft` (the `gen_` id of a succeeded draft); any other field returns `400 invalid_request`. The output is always 1080p, and every other setting (prompt, mode, duration, aspect ratio, images, seed and the other optional fields) comes from the draft and can't be changed.
-   Price: the final is charged at the 1080p price, and its quote shows the exact amount. The draft and the final are billed separately; the draft's charge isn't deducted from the final.
-   Window: a draft can be finalized for 3 days. The exact deadline is the draft's `draft.expires_at`; after it, quoting or creating the final returns `410 draft_expired`.
-   One final per draft: while a final is in progress or after it succeeds, another one returns `409 draft_already_finalized`, and the draft's `draft.final_id` holds the final's id. If a final fails, the hold is released in full and you can quote the final again.
-   In `GET /v1/models`, `prices[].options` lists `draft` on every resolution row of Seedance 2.5, but only 480p accepts it.
-   MCP supports draft mode too: `estimate_cost` and `generate` take the same input as above (add `draft: true` for a draft; send only `model` and `from_draft` for the final), and `check_job` returns the same `draft` field.

Quote a draft; once it has succeeded, quote its final and create the final with that quote:

curl

```
curl https://api.makernice.com/v1/generations/quote \
  -H "Authorization: Bearer $MAKERNICE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"seedance-2.5","mode":"t2v","prompt":"A slow dolly shot through a greenhouse","duration":5,"resolution":"480p","draft":true}'
```

curl

```
curl https://api.makernice.com/v1/generations/quote \
  -H "Authorization: Bearer $MAKERNICE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"seedance-2.5","from_draft":"gen_3b9e…"}'
```

curl

```
curl https://api.makernice.com/v1/generations \
  -H "Authorization: Bearer $MAKERNICE_API_KEY" \
  -H "Idempotency-Key: 7c1e9a2b-final-1843" \
  -H "Content-Type: application/json" \
  -d '{"quote_id":"qt_9d2a…","input":{"model":"seedance-2.5","from_draft":"gen_3b9e…"}}'
```

## Create a generation

Create the generation with the quote and the same input. The `Idempotency-Key` header is required (see [Idempotency](https://makernice.com/docs/#idempotency)).

POSThttps://api.makernice.com/v1/generations

curl

```
curl https://api.makernice.com/v1/generations \
  -H "Authorization: Bearer $MAKERNICE_API_KEY" \
  -H "Idempotency-Key: 7c1e9a2b-order-1842" \
  -H "Content-Type: application/json" \
  -d '{"quote_id":"qt_6f1c…","input":{"model":"seedance-2.5","mode":"t2v","prompt":"A slow dolly shot through a greenhouse","duration":5,"resolution":"720p"}}'
```

-   Responds `202` with the generation (`status: queued`, `billing: held`). A retry with the same Idempotency-Key responds `200` with the original generation.
-   You may change the prompt, but changing anything that affects the price (model, mode, resolution, duration) returns `422 quote_mismatch`.
-   A used quote returns `409 quote_already_used`, an expired one `410 quote_expired`, and one that isn't in your account `404 quote_not_found`.
-   Not enough balance returns `402 insufficient_balance`; going over the key's spend limit returns `402 key_spend_limit_reached`.
-   Optional top-level `callback_url` (https, up to 2048 characters, no credentials in the URL, not a private or reserved address): when the generation finishes, we POST it there. It takes priority over your account's webhook address. See [Webhooks](https://makernice.com/docs/#webhooks).

## Check status

Poll the generation until it reaches a final status. Polling every few seconds is fine; see the read limit in Rate limits. A video generation can take a few minutes, longer for long or high-resolution clips. If a run goes past its maximum runtime, it fails and the hold is released in full.

GEThttps://api.makernice.com/v1/generations/{id}

| Status | Meaning |
| --- | --- |
| `queued` | Waiting to start. Can still be canceled. |
| `generating` | The model is working on it. |
| `moderating` | Generation finished and the amount is charged; the outputs are in a safety check, and `outputs` stays empty until it completes. Keep polling. |
| `succeeded` | Done. The amount is charged and `outputs` are ready. |
| `failed` | Didn't finish. The hold is released; `error` has a code and a message. |
| `canceled` | Canceled while queued. The hold is released. |
| `checking` | We're confirming the result. The amount stays held until it's resolved. |

`error.code` of a failed generation is one of `invalid_request` (the model rejected the request; adjust the prompt or settings), `content_rejected` (rejected by content moderation or the model provider's safety policy; the hold is released), `timeout`, `upstream_unavailable` or `generation_failed`. For `content_rejected`, `error.reason` says what was rejected: `prompt` (the prompt), `input_image` (a reference image) or `model` (the model provider's safety policy). The same `reason` appears in the 422 response when a submitted prompt is blocked. When `invalid_request` is caused by a reference image that can't be used, `error.input` names it: `image_url`, `last_image_url` or `reference_images[0]` (zero-based). Replace that image and create a new generation.

Example response (illustrative values)

```
{
  "id": "gen_3b9e…",
  "type": "video",
  "model": "seedance-2.5",
  "mode": "t2v",
  "status": "succeeded",
  "prompt": "A slow dolly shot through a greenhouse",
  "params": { "duration": 5, "resolution": "720p", "aspectRatio": null },
  "amount": "500000",
  "billing": "charged",
  "price_version": 3,
  "outputs": [
    {
      "index": 0,
      "url": "/v1/generations/gen_3b9e…/outputs/0",
      "state": "stored",
      "contentType": "video/mp4",
      "expiresAt": "2026-11-08T09:14:03.000Z"
    }
  ],
  "error": null,
  "created_at": "2026-10-09T09:12:41.000Z",
  "finished_at": "2026-10-09T09:14:03.000Z",
  "draft": null,
  "source_draft_id": null
}
```

Drafts and finals carry two more fields, which are `null` on other generations. On a draft, `draft.expires_at` is the deadline for making its final and `draft.final_id` is the id of its final in progress or succeeded (`null` if none). On a final, `source_draft_id` is the draft it came from.

90 days after a generation finishes, its request content is cleared under our data retention policy: `prompt` becomes an empty string. Billing details (`model`, `params`, `amount`, `status` and timestamps) are kept.

`GET /v1/generations/{id}/events` returns the generation's timeline. Codes: `created`, `submitted`, `generating`, `delivered`, `failed_refunded`, `canceled_refunded`, `checking`, `requeued`.

GEThttps://api.makernice.com/v1/generations/{id}/events

Example response (illustrative values)

```
{
  "data": [
    { "code": "created", "at": "2026-10-09T09:12:41.000Z" },
    { "code": "submitted", "at": "2026-10-09T09:12:43.000Z" },
    { "code": "generating", "at": "2026-10-09T09:12:50.000Z" },
    { "code": "delivered", "at": "2026-10-09T09:14:03.000Z" }
  ]
}
```

## Download outputs

Each item in `outputs` has a `url` such as `/v1/generations/gen_…/outputs/0`, relative to `https://api.makernice.com`. Request it with your API key; the response is a `302` redirect to a short-lived link to the file. Request the endpoint again whenever you need the file instead of storing the redirect target.

GEThttps://api.makernice.com/v1/generations/{id}/outputs/{n}

curl

```
curl -L -o video.mp4 https://api.makernice.com/v1/generations/gen_…/outputs/0 \
  -H "Authorization: Bearer $MAKERNICE_API_KEY"
```

-   Add `?download=1` to have the file served as an attachment. This works once the file is `stored`; while it is `pending` or `degraded` the redirect goes to the original file and the parameter has no effect.
-   `curl -L` doesn't send your `Authorization` header to the redirect host, so your key stays with us.
-   Outputs exist only when the generation has `succeeded`; otherwise the endpoint returns `404 output_not_found`.
-   `state`: `pending` (still being saved; the link already works), `stored` (saved until `expiresAt`), `degraded` (saving didn't complete; the link may stop working sooner — download it soon), `expired` (the saved file has expired; the endpoint returns `410 output_expired`), `blocked` (the output didn't pass content moderation; `url` is an empty string — contact support for a manual review).
-   The short-lived redirect is valid for one hour. While a file is still `pending` or `degraded`, the redirect may go to the provider's original file instead of a signed link. Stored files are removed about 30 days after they are saved, at `expiresAt`. There is no API to delete a single generation or its files; they are removed automatically when they expire.

## Cancel

Only `queued` generations can be canceled; the hold is released in full and the response is the canceled generation. Once a generation is `generating` it can't be stopped, and cancel returns `409 not_cancelable`.

POSThttps://api.makernice.com/v1/generations/{id}/cancel

curl

```
curl -X POST https://api.makernice.com/v1/generations/gen_…/cancel \
  -H "Authorization: Bearer $MAKERNICE_API_KEY"

# → { "id": "gen_…", "status": "canceled", "billing": "released", … }
```

## List generations

Lists the generations in your account, newest first — including the ones created in the console.

GEThttps://api.makernice.com/v1/generations

| Query | Description |
| --- | --- |
| `limit` | Page size, 1–100. Default 20. |
| `cursor` | The `next_cursor` of the previous page. |
| `status` | One or more statuses, comma-separated, e.g. `queued,generating`. |
| `type` | `video` or `image`. |
| `model` | A model id. |
| `q` | Part of a generation id, or text contained in the prompt (both case-insensitive). |

curl

```
curl "https://api.makernice.com/v1/generations?status=queued,generating&limit=50" \
  -H "Authorization: Bearer $MAKERNICE_API_KEY"

# → { "data": [ …generations… ], "next_cursor": "gen_…" | null, "total": 12 }
```

`total` counts all generations matching the filters. When `next_cursor` is `null`, you've reached the last page.

## Webhooks

Instead of polling, you can have us POST the generation to your server when it reaches a final status. We send to the `callback_url` given when creating the generation; without one, to your account's webhook address (set it in [console settings](https://makernice.com/console/settings/)). With neither, nothing is sent.

| Event | Sent when |
| --- | --- |
| `generation.succeeded` | The generation succeeded and was charged. |
| `generation.failed` | The generation failed; the held amount was released. |
| `generation.canceled` | The generation was canceled; the held amount was released. |

### Request

Example request (illustrative values)

```
POST /your/webhook/path HTTP/1.1
Content-Type: application/json
Makernice-Signature: t=1791364443,v1=5f0c2d…e81a
Makernice-Event-Id: evt_1b7f…
```

Example body (illustrative values)

```
{
  "id": "evt_1b7f…",
  "type": "generation.succeeded",
  "created_at": "2026-10-09T09:14:03.000Z",
  "data": {
    "id": "gen_3b9e…",
    "status": "succeeded",
    "billing": "charged",
    "outputs": [
      { "index": 0, "url": "https://api.makernice.com/v1/generations/gen_3b9e…/outputs/0", "state": "stored", … }
    ],
    …
  }
}
```

-   `data` is the same generation object as `GET /v1/generations/{id}`, except that `outputs[].url` is an absolute URL.
-   `Makernice-Event-Id` equals the body's `id` and stays the same across retries. Use it to ignore duplicates.

### Verify the signature

`Makernice-Signature` is `t=<unix seconds>,v1=<hex>`, where `v1` is HMAC-SHA256 with your signing secret over `t + "." + raw body`. Compute it over the raw bytes you received, compare in constant time, and reject requests whose `t` is more than 5 minutes from your clock. The signing secret is in console settings; callback\_url deliveries are signed with the same secret. After you rotate it, deliveries not yet sent are signed with the new one.

Node.js

```
import { createHmac, timingSafeEqual } from "node:crypto";

// rawBody: the body exactly as received (Buffer). Don't re-serialize parsed JSON.
export function verifyWebhook(rawBody, signatureHeader, secret, toleranceSeconds = 300) {
  const parts = Object.fromEntries(signatureHeader.split(",").map((p) => [p.slice(0, p.indexOf("=")), p.slice(p.indexOf("=") + 1)]));
  const t = Number(parts.t);
  if (!Number.isInteger(t) || Math.abs(Date.now() / 1000 - t) > toleranceSeconds) return false;
  const expected = createHmac("sha256", secret).update(`${t}.`).update(rawBody).digest();
  const given = Buffer.from(parts.v1 ?? "", "hex");
  return given.length === expected.length && timingSafeEqual(given, expected);
}
```

Python

```
import hashlib
import hmac
import time

# raw_body: the body exactly as received (bytes). Don't re-serialize parsed JSON.
def verify_webhook(raw_body: bytes, signature_header: str, secret: str, tolerance_seconds: int = 300) -> bool:
    parts = dict(p.split("=", 1) for p in signature_header.split(",") if "=" in p)
    try:
        t = int(parts["t"])
    except (KeyError, ValueError):
        return False
    if abs(time.time() - t) > tolerance_seconds:
        return False
    expected = hmac.new(secret.encode(), f"{t}.".encode() + raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, parts.get("v1", ""))
```

### Delivery and retries

-   HTTPS only. Redirects aren't followed. Each attempt times out after 10 seconds.
-   Any 2xx response counts as delivered. Respond quickly and do heavy work afterwards.
-   Otherwise we retry after 1 min, 5 min, 30 min, 2 h, 6 h, 12 h — 7 attempts in total — and then mark the delivery failed. Recent deliveries and their last response are shown in console settings.
-   Each generation normally sends one event, and a delivery can arrive more than once (for example after a timeout on your side). If an output held back by content review is later released, we send the generation again with a new event id, so you may get two events for it; the latest one wins.

### Account events

Your account's webhook address can also receive two account events. They're off by default: turn them on under Account events in console settings. We only send events that happen after you turn them on.

| Event | Sent when |
| --- | --- |
| `announcement.published` | We publish a product update (the same entries as `GET /v1/changelog`, in English). |
| `model.released` | A new model becomes available. |

Example bodies (illustrative values)

```
{
  "id": "evt_5c21…",
  "type": "announcement.published",
  "created_at": "2026-11-11T09:00:12.000Z",
  "data": {
    "id": "ann_…",
    "kind": "feature",
    "published_at": "2026-11-11T09:00:00.000Z",
    "title": "…",
    "body": "…",
    "bullets": ["…"]
  }
}

{
  "id": "evt_8d40…",
  "type": "model.released",
  "created_at": "2026-11-11T09:00:12.000Z",
  "data": { "model": "seedream-5.5", "type": "image", "released_at": "2026-11-11" }
}
```

-   Sent only to the account address, never to a `callback_url`. Signed and retried like generation events; each update or model is sent once per account.
-   Ignore event types and fields you don't recognize. We may add new ones.

## Models

`GET /v1/models` lists the models and the modes, resolutions and durations you can use. Only modes that have a price are listed, with their prices in `modes[].prices`. It needs no API key and may be cached for up to 60 seconds. Responses may gain new fields over time; ignore fields you don't recognize.

GEThttps://api.makernice.com/v1/models

-   `resolutions` / `defaultResolution`: allowed values for `resolution`. An empty list means the model has a fixed resolution and you leave `resolution` out (sending it, even with the fixed value, returns `400 invalid_request`). The fixed tier is the one shown in `modes[].prices[].resolution`: for example, `seedance-2.0-fast` always renders 720p. A listed resolution may have no price in some modes: check `modes[].prices`; quoting it returns `422 price_unavailable`.
-   `durations`: `{ min, max, default }` in seconds for videos, `null` for images.
-   `modes[].needs`: which images the mode requires (`image` → `image_url`, `lastImage` → `last_image_url`, `references` → `reference_images`, up to `maxReferences`).
-   `modes[].aspectRatios`: allowed `aspect_ratio` values. `modes[].prices`: unit price per resolution.

Example response (illustrative values)

```
{
  "data": [
    {
      "id": "seedance-2.5",
      "type": "video",
      "resolutions": ["480p", "720p", "1080p", "4k"],
      "defaultResolution": "720p",
      "durations": { "min": 4, "max": 30, "default": 5 },
      "modes": [
        {
          "mode": "t2v",
          "needs": { "image": false, "lastImage": false, "references": false },
          "maxReferences": null,
          "aspectRatios": ["adaptive", "16:9", "9:16", "1:1", "4:3", "3:4", "21:9", "9:21"],
          "prices": [{ "resolution": "720p", "unit": "second", "unitPrice": "100000" }]
        }
      ]
    }
  ]
}
```

### Which models can I call?

One API key calls all 21 models: 15 video and 6 image models from ByteDance, Kuaishou, MiniMax and Alibaba, including Seedance, Kling, Wan and MiniMax H3. Every model uses the same request format; set `model` to the API model id below.

| Model | Vendor | API model id | Type |
| --- | --- | --- | --- |
| Seedance 2.5 | ByteDance | `seedance-2.5` | Video |
| Seedance 2.0 | ByteDance | `seedance-2.0` | Video |
| Seedance 2.0 Fast | ByteDance | `seedance-2.0-fast` | Video |
| Seedance 2.5 Flash | ByteDance | `seedance-2.5-flash` | Video |
| MiniMax H3 | MiniMax | `minimax-h3` | Video |
| MiniMax H3 Max | MiniMax | `minimax-h3-max` | Video |
| MiniMax H3 Max Turbo | MiniMax | `minimax-h3-max-turbo` | Video |
| Wan 3.0 | Alibaba | `wan-3.0` | Video |
| Wan 3.0 Prime | Alibaba | `wan-3.0-prime` | Video |
| Kling 3.0 Pro | Kuaishou | `kling-3.0-pro` | Video |
| Kling 3.0 Standard | Kuaishou | `kling-3.0-standard` | Video |
| Kling 3.0 4K | Kuaishou | `kling-3.0-4k` | Video |
| Kling 4.0 | Kuaishou | `kling-4.0` | Video |
| Happy Horse 1.1 | Alibaba | `happy-horse-1.1` | Video |
| Magi 2 | Sand.ai | `magi-2` | Video |
| Seedream 5.0 Pro | ByteDance | `seedream-5.0-pro` | Image |
| Seedream 5.0 | ByteDance | `seedream-5.0` | Image |
| Seedream 5.5 | ByteDance | `seedream-5.5` | Image |
| Qwen3 Image | Alibaba | `qwen3-image` | Image |
| Qwen3 Pro Image | Alibaba | `qwen3-pro-image` | Image |
| MiniMax H3-Image | MiniMax | `minimax-h3-image` | Image |

Models by task, with supported modes and example prices: [image to video](https://makernice.com/image-to-video/), [AI video generator](https://makernice.com/ai-video-generator/) and [AI image generator](https://makernice.com/ai-image-generator/).

## Errors

Errors are JSON: `{ "error": { "code", "message", "reason"?, "details"?, "request_id" } }`. Branch on `code`; messages may change. Every response carries an `x-request-id` header (same value as `request_id`); include it when contacting support so we can find the request.

| Status | Code | What to do |
| --- | --- | --- |
| 400 | `invalid_request` | The body, query or a header is invalid. details lists each field and the problem; fix the request. |
| 400 | `template_conflict` | A template request only takes template, images and the optional prompt, resolution and aspect\_ratio; the template fixes the model, mode, duration and other settings. Remove the other fields. |
| 400 | `draft_requires_480p` | Drafts (draft: true) only run at 480p. Set resolution to 480p. |
| 400 | `not_a_draft` | from\_draft points to a generation that is not a draft of this model. Use a succeeded draft of the same model. |
| 401 | `invalid_api_key` | The key is missing, malformed, disabled, expired or deleted. |
| 402 | `insufficient_balance` | Top up your wallet. |
| 402 | `key_spend_limit_reached` | Raise the key's spend limit or use another key. |
| 402 | `daily_spend_limit_reached` | Your account reached its daily spend limit; it resets at 00:00 UTC. Contact support to raise it. |
| 403 | `org_frozen` | Your account is frozen. Contact support. |
| 404 | `quote_not_found` | The quote doesn't exist in your account. Get a new quote. |
| 404 | `task_not_found` | The generation doesn't exist in your account. Check the id. |
| 404 | `output_not_found` | The generation hasn't succeeded or has no output with that index. |
| 404 | `template_not_found` | No template with this id. List available templates with GET /v1/templates. |
| 404 | `draft_not_found` | No draft with this id in your account. Check from\_draft. |
| 404 | `not_found` | Unknown endpoint. Check the method and path. |
| 409 | `quote_already_used` | Get a new quote. |
| 409 | `not_cancelable` | Only queued generations can be canceled. |
| 409 | `draft_not_ready` | The draft has not succeeded yet. Wait until it succeeds, then quote the final. |
| 409 | `draft_already_finalized` | This draft already has a final in progress or succeeded. Each draft makes one successful final. |
| 410 | `quote_expired` | Get a new quote. |
| 410 | `output_expired` | The stored file has expired and can no longer be downloaded. |
| 410 | `template_retired` | This template is no longer available. Pick another one from GET /v1/templates; generations you already made are not affected. |
| 410 | `draft_expired` | The draft is past its 3-day window. Make a new draft. |
| 413 | `payload_too_large` | The request body is over 64 KB. Shorten the prompt or send fewer image URLs. |
| 422 | `idempotency_conflict` | This Idempotency-Key was used for a different request. Use a new key. |
| 422 | `quote_mismatch` | The input changes the price (model, mode, resolution or duration). Quote this input again. |
| 422 | `price_unavailable` | This combination has no price. Pick one listed by GET /v1/models. |
| 422 | `content_rejected` | Rejected by content moderation or the model provider's safety policy; error.reason says which (prompt, input\_image or model). Change the prompt or images; you were not charged. |
| 429 | `rate_limited` | Wait for Retry-After seconds, then retry. |
| 429 | `concurrency_limit_reached` | Too many generations in progress for your account. Wait for one to finish (see Retry-After), or contact support to raise the limit. |
| 500 | `internal_error` | Unexpected server error. Retry with backoff; include request\_id if you contact support. |
| 503 | `draft_channel_unavailable` | The service that made this draft is unavailable right now. Try again later; nothing was charged. |

For unexpected `5xx` responses or network errors, retry with backoff. When retrying a create request, reuse the same `Idempotency-Key` so you're never charged twice.

### Why did my request or generation fail?

Most failures come from one of these eight causes. Each one says what you see, why it happens and what to change.

-   **An image is too small, too large or the wrong shape.** Each model's provider sets pixel and aspect-ratio limits, for example 300–6000 px per side for Seedance; the provider's message reads like "Width must be between 300px and 6000px". For some models we check the size when you create the generation and reject it at once with a 400 `invalid_request`, before anything is held; otherwise the generation fails with `invalid_request` and the hold is released in full. Resize or crop the image to the limits in [the image table](https://makernice.com/docs/#images), then create a new generation.
-   **An image URL redirects.** We fetch each image directly and don't follow redirects, so share links and shortened links fail with `invalid_request`. Use the final https URL that returns the image itself.
-   **An image file is rejected.** Images must be still JPEG, PNG or WebP files of at most 10 MB; animated WebP and GIF are not supported. For Kling 3.0, Kling 4.0 and Seedream 5.0, use JPEG or PNG.
-   **`400 invalid_request` when you send `aspect_ratio` with an image.** Only the Seedance models accept `aspect_ratio` in image-to-video; the other models reject fields their mode doesn't use. Remove the field, or use a Seedance model.
-   **`410 quote_expired`, `409 quote_already_used` or `422 quote_mismatch`.** A quote locks its price for 12 minutes and can be used once. Changing the model, mode, resolution or duration after quoting needs a new quote; changing only the prompt keeps it. Request a new quote and create the generation with it.
-   **`content_rejected`.** `error.reason` says what was rejected: `prompt`, `input_image` or `model` (the model provider's safety policy). The hold is released; change the prompt or the image and try again. Note: if a finished output is blocked by output moderation for a policy violation, the run is still charged. You can contact support for a manual review.
-   **`402 key_spend_limit_reached`, `402 daily_spend_limit_reached`, `429 concurrency_limit_reached` or `429 rate_limited`.** A key has reached its own spend limit, the account has reached its daily spend or in-progress limit, or requests came too fast. Raise the key's limit in the console, wait for a running generation to finish, or retry after the `Retry-After` seconds; contact support to raise account limits.
-   **Webhooks don't arrive.** We deliver only to HTTPS endpoints, don't follow redirects and wait 10 seconds per attempt; any 2xx counts as delivered. Failed deliveries are retried 6 times over about 21 hours (7 attempts in total) and then marked failed. Check the endpoint in console settings, and poll `GET /v1/generations/{id}` as a fallback.

## Rate limits

Limits are per minute. Going over returns `429 rate_limited` with a `Retry-After` header (seconds).

| Scope | Limit |
| --- | --- |
| Per key — writes (quote, create, cancel) | 60 / min |
| Per key — reads (get, list, events, outputs) | 600 / min |
| Per account — writes across all keys | 120 / min |
| Per IP — models, pricing and requests with a rejected key | 120 / min |

A key can also have at most 4 create requests in progress at the same time; more return 429 as well. Limits may be adjusted.

Each account also has two usage limits, by default 2 generations in progress at once and US$100 of spend per UTC day. Going over returns `429 concurrency_limit_reached` (with `Retry-After`) or `402 daily_spend_limit_reached`. Contact support to raise them. A generation counts toward the in-progress limit while it is `queued`, `generating` or `checking`, whichever model or key created it. It stops counting once it reaches `moderating`, `succeeded`, `failed` or `canceled`. Generations you start in the web app count toward the same limit.

## Idempotency

-   `POST /v1/generations` requires an `Idempotency-Key` header: 1–200 printable ASCII characters, no spaces. Use a new value, such as a UUID, for each new generation.
-   Keys are unique within your account and shared by all of its API keys.
-   Repeating a request with the same key, quote and input returns the original generation with `200` and doesn't charge again.
-   Using the same key with a different `quote_id`, different `input` (including the prompt and image URLs) or a different `callback_url` returns `422 idempotency_conflict`.
-   Quotes and cancels take no Idempotency-Key. Repeating a cancel that already succeeded returns `409 not_cancelable`; check the status with `GET`.

## FAQ

#### Does a quote cost anything?

No. `POST /v1/generations/quote` only prices your input; nothing is held or charged until you create a generation with that quote.

#### Do I need a separate API key for each model?

No. One API key calls all 20 models; to switch models, change the `model` field in the request.
