Skip to main content

1. Get an API key

In the Melius app, go to Team settings → Integrations, create a key, and copy it — it’s shown once. See Authentication for details.

2. Make your first request

Paste your key into the snippet below and run it. It creates a project and canvas, adds an image node with your prompt, runs it, waits for the generation to finish, and prints the URL of the generated image.
No model is specified, so Melius picks one for you. To choose a specific model, add a modelConfig to the node from List generative models. The x-team-id header is optional — requests default to the team your key belongs to. Save the run key and request before submission. If starting the run times out or returns 5xx, resend only that run request with the same key, body and acting context. The server replays the accepted status and response without starting another run. For 409 with IDEMPOTENCY_REQUEST_IN_PROGRESS, wait at least the Retry-After value of one second before retrying. IDEMPOTENCY_KEY_REUSED means the request changed; use a fresh key only when you intend a new run. Rerunning the entire snippet creates a new project, canvas, node and run. Those setup mutations are outside idempotency coverage. See Retry a submission safely for key scope, conflicts and retention.

Next steps

Authentication

Keys, the x-team-id header, and how keys are scoped.

API overview

The base URL, how generations work, rate limits, and credits.

Run with media URLs

Send mediaUrls on POST /nodes/{nodeId}/runs to run an image or video node directly from public media files:
Inside mediaUrls, imageUrls supplies start frames, endImageUrls supplies the end frame, referenceImageUrls supplies reference images, videoUrls supplies input clips, and audioUrls supplies audio. Send the roles your chosen model supports. The start-frame role is independent of the canvas’s generic image handle. Use this option on a node with text inputs only, and omit top-level imageUrls, endImageUrls and draftVersionId. Melius checks each URL and reads the file’s dimensions, size and duration before billing. Each file can be up to 50 MB; the model’s own limits still apply. Unsupported roles and clips that require automatic trimming are rejected. The explicit URL path also rejects images outside the model’s dimension and aspect-ratio limits; resize or crop them before submitting. These references are used for this run. They stay outside your asset library and receive no automatic captions. Keep the URLs accessible until the run finishes: the generation provider fetches them asynchronously. For reusable references on your canvas, use uploads and connect the resulting file nodes. Completing an upload stores the file; create the file node with the s3Key, s3Bucket and contentType the upload used, then connect it. Connect a start frame to the starting_image handle: on a model with a reference mode, the generic image handle takes a reference image (video input handles). Reference-to-video and video editing have different duration rules. Wan 3.0 reference-to-video accepts the requested output duration, subject to its reference and output limits. Modes that derive their length from a source clip use that clip’s duration. Image-to-video modes can derive the output shape from the start frame. Check the selected mode’s catalog settings before validating an output against your requested duration or aspect ratio.

Input limits for each mode

Call GET /generation/models?category=video to read the inputs and limits of every video mode before you build a request. Each entry in a model’s variants describes one mode: For example, Kling 4’s reference-to-video mode takes 10 reference images on their own, 9 with a start frame and 8 with an end frame, and its start frame sets the aspect ratio. Wan 3.0’s reference-to-video mode takes no start or end frame. A mode that lists duration renders the length you request, except Seedance 2.5 with exactly one input clip and no other references, which sets its own length. A mode that doesn’t list duration sets its own length: an editing or lip-sync mode renders at its input clip’s length, and other modes at the model’s fixed length or their audio’s length.

Exact settings and video end frames

Set strictSettings: true when creating a node and when starting its run to reject unsupported aspect ratios, durations and resolutions with HTTP 400. The error message names the unsupported setting. A refused run does not start generation or spend credits. Requests that omit strictSettings retain normalization of unsupported settings. A run started with strictSettings: true also refuses its connected inputs with HTTP 400 instead of adjusting them:
  • A connected image or video the selected mode can’t take. The error names the input’s node.
  • Input clips longer in total than the mode’s combined limit. Without strictSettings, the last clip is trimmed to fit.
Supply the settings you require in the run request. Run settings take precedence over the saved node settings. Setting strictSettings only at run time cannot recover a setting an earlier non-strict create already normalized. A video run can take a start frame in imageUrls and one end frame in endImageUrls:
Send this body to POST /nodes/{nodeId}/runs for a video node. Use publicly reachable image URLs. A start or end frame URL that cannot be read as an image returns HTTP 400 before the run is charged. A connected start frame takes precedence over imageUrls; an end-frame URL can also accompany that connected start frame. A request with both an end-frame URL and a connected end frame is refused. End-frame URLs require a model that supports start/end frames and cannot be combined with reference-image inputs.
Last modified on November 24, 2026