Skip to main content
The Melius REST API drives Melius canvases and generations from your own code — create projects and canvases, add nodes, wire edges, run generations across the latest image, video, audio, and language models, and read the results. It runs on the same backend as the Melius web app, CLI, and MCP server.
You authenticate with an API key. Create one in the Melius app under Team settings → Integrations. See Authentication.

Base URL

Every request needs a bearer API key. You can optionally select which team to act on with the x-team-id header — it defaults to the team your key belongs to:

How generations work

A generation in Melius is a canvas node — there’s no separate “generate” path, so the API stays consistent with the app. You create a node, start a run, and poll the run until it finishes:
Runs are asynchronous jobs. Starting a run returns immediately with a run id; the generation runs in the background across Melius’s model providers. Poll the run until status is finished (or failed). Pass seed as a top-level field when starting a run. API-key requests preserve it even when the team’s custom-seed UI setting is disabled. The value must be an integer from 0 to 2147483647, inclusive. For image generation, call GET /generation/models?category=image and select a model whose chosen entry in variants has supportsSeed: true.
The node’s configured prompt and model are used. For repeatable requests, keep the model, prompt, inputs, settings, and seed identical. Providers may normalize seed values, and identical requests can still produce different pixels even when the provider honors the seed. API-key bulk runs also preserve seeds configured on their nodes.

Post-process a node

Node tools modify a finished asset in place. Use remove-background for image nodes and file nodes that contain images, or topaz-upscale to increase an image’s resolution. remove-background runs Pixelcut. Topaz accepts provider settings through toolConfig, including upscale_factor. Both tools create and activate a new version on the same node.
To upscale an image, send topaz-upscale and its provider settings:
The response is { "id": "<nodeRunId>" }. Poll GET /api/v1/node-runs/<nodeRunId> until the run finishes, just like a generation run.

Get the result

When a run finishes, request a download with an empty JSON body ({}):
Fetch the returned URL directly, without your Melius authorization header. The download is a ZIP archive, including for a single image; extract it to read the generated or upscaled file.

Rate limits and credits

  • Credits. Generations consume credits from the team you act on, exactly like the app. Image model costs are shown in GET /generation/models?category=image; use category=image_tool for image tools such as Topaz.
  • Rate limits. There is no monthly request quota on any plan. Requests can still return 429 with a Retry-After header — wait the number of seconds it gives you, then retry.
For a temporary 429, use a bounded retry loop: wait at least Retry-After seconds, add a small random delay, and retry the rejected request. The JSON body’s retryAfterSeconds is a fallback if your client cannot read the header. Keep retries within the same concurrency limit. If requests keep returning 429, stop the burst and retry later; this is not a monthly quota error. For a timeout or 5xx from a submission you sent with an Idempotency-Key, retry the same request with the same key as described below. For other mutations, including submissions sent without the header, check the canvas or run state before resubmitting: their outcome can be uncertain and resubmission can duplicate work. If a canvas’s saved state exceeds the 48 MiB API loading limit, the operation returns 400 with code CANVAS_TOO_LARGE. Use a smaller canvas or create a new canvas. Retrying the same operation will not help.

Retry a submission safely

Send the optional Idempotency-Key header on these generation submission endpoints:
Choose one key per intended submission and save it before sending the request. A UUID works. Keys are case-sensitive and contain 1–255 ASCII letters, digits, periods, underscores, colons or hyphens (A–Z, a–z, 0–9, ., _, :, -). Whitespace is invalid and is not trimmed. A malformed key returns 400.
If the response is lost, retry the same request with render-42. Once accepted, the server replays the original successful HTTP status and JSON body, including the same run or approval ID, instead of starting another run. The replay is the submission response, not the run’s latest progress; use the returned ID to poll for that. Keys are scoped to the authenticated team and member, across the endpoints above. The saved request also binds the authentication and acting context, including agent approval and pricing context. Keep that context unchanged on retries. Authentication, membership, resource access and API access checks still apply on every request; a key does not grant access by itself. Keep the method, path, query and body unchanged. JSON object property order does not matter, including inside nested objects; array order does. Reusing a key for different input, a different endpoint or a different acting context returns 409 with code: "IDEMPOTENCY_KEY_REUSED". Use a fresh key for an intentional new run. If another request with the key is still being accepted, the server returns 409 with code: "IDEMPOTENCY_REQUEST_IN_PROGRESS", Retry-After: 1 and retryAfterSeconds: 1 in the JSON body. Wait at least one second, then retry with the same key and request. Both conflict responses include a message. Use bounded retries and keep them within your concurrency limit. Validation failures and rolled-back attempts release the key, so you can retry them. If acceptance commits but dispatch fails afterward, retrying the same request recovers the accepted response; it does not start another paid run. Ditto retries also retry a failed workflow start for the same accepted attempt. Accepted keys remain reserved until the team is erased, so do not recycle them after a run finishes or fails.

Cast and Ditto attempts

For POST /ditto, the key is the only way to recover a lost response: resending the request without one starts another video. For POST /cast/videos, keep the attemptId and resolved input from preparation in the body. For the deprecated /ditto/replacements and legacy /cast/replacements endpoints, keep the attemptId, input and quote fields. The optional header works alongside these existing attempt IDs; it does not replace them. Retries of a keyed submission must preserve the entire body, not just attemptId. To intentionally generate again, use a new key and a new attempt ID. Clients that omit the header retain their existing behavior, including Cast and Ditto’s attempt-based recovery. Other mutations, such as creating projects, canvases or nodes, are outside this header’s coverage. Adding the header to those endpoints does not make them retry-safe. The CLI’s canvas run commands retain a key and resolved request in a private receipt for explicit mel run retry <receipt> recovery. MCP run_start, bulk_run_start and run_magic_resize accept an optional idempotencyKey and retain normalized recovery input in uncertain-response errors. They add no automatic network or 5xx retries, because older or custom servers may ignore the header. See CLI recovery and MCP for caller responsibilities and exclusions. Deploy the API completely before publishing the client CLI release or rolling out hosted MCP. A source PR merge does not mean the CLI is published.

Next steps

Quickstart

Create a key and run your first generation end to end.

Authentication

API keys, the x-team-id header, and how keys are scoped.
Browse every endpoint under API reference in the sidebar — each has a live try it playground and code samples in cURL, Python, TypeScript, PHP, Go, and Ruby.
Last modified on November 11, 2026