You authenticate with an API key. Create one in the Melius app under Team
settings → Integrations. See Authentication.
Base URL
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: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.
Post-process a node
Node tools modify a finished asset in place. Useremove-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.
topaz-upscale and its provider settings:
{ "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 ({}):
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; usecategory=image_toolfor image tools such as Topaz. - Rate limits. There is no monthly request quota on any plan. Requests can still return
429with aRetry-Afterheader — wait the number of seconds it gives you, then retry.
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 optionalIdempotency-Key header on these generation submission endpoints:
A–Z, a–z, 0–9, ., _, :, -). Whitespace is invalid and is not trimmed. A malformed key returns 400.
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
ForPOST /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.