Explore/MAGI-2
Video

MAGI-2

Animate a still image into a 1080p video, with an optional final frame to guide the ending. Add a prompt to describe the motion and choose a duration from 4 to 30 seconds, with optional generated audio.

View docs
import { config, higgsfield } from "@higgsfield/client/v2";config({  credentials: process.env.HF_CREDENTIALS,});const result = await higgsfield.subscribe(  "sand/magi-2/image-to-video",  {    input: {      "duration": 5,      "image_url": "https://example.com/input.jpg",      "resolution": "1080p",      "aspect_ratio": "16:9",      "generate_audio": true    },    withPolling: true,  },);console.log(result);

MAGI-2 uses the model ID sand/magi-2/image-to-video. Animate a first frame, or a first and a last frame, into a 1080p video with sound using MAGI-2. Add an optional prompt and choose a duration from 4 to 30 seconds.

1. Calling the API

Send requests to https://api.higgsfield.ai/sand/magi-2/image-to-video with a JSON body matching the parameters below.

Install

Install an official server-side SDK. cURL needs no package.

npm install @higgsfield/client

Setup

Keep credentials in server-side environment variables. The SDKs accept the same KEY_ID:KEY_SECRET value under their documented variable names.

export HF_CREDENTIALS="YOUR_KEY_ID:YOUR_KEY_SECRET" # TypeScript export HF_KEY="YOUR_KEY_ID:YOUR_KEY_SECRET" # Python and cURL

Request parameters

ParameterTypeRequiredDefaultDescription
seedintegerNo—Minimum: 0. Maximum: 4294967295.
promptstringNo—Minimum length: 1. Maximum length: 15000.
durationintegerNo5Minimum: 4. Maximum: 30.
image_urlstringYes—Maximum length: 8192.
resolutionstringNo"1080p"Options: 1080p.
aspect_ratiostringNo"16:9"Options: 21:9, 16:9, 4:3, 1:1, 3:4, 9:16.
end_image_urlstringNo—Maximum length: 8192.
generate_audiobooleanNotrue

2. Authentication

The official SDKs read credentials from the server environment and send the required Authorization: Key KEY_ID:KEY_SECRET header.

API Key

Never expose the secret in browser-side code or commit it to source control. The TypeScript SDK is server-side only. For direct HTTP calls, use:

Authorization: Key $HF_KEY

3. Queue

subscribe submits the asynchronous request and waits for a terminal result. The TypeScript SDK polls automatically when withPolling: true; the Python SDK's synchronous subscribe call also waits. A completed request returns the generated file in the video field.

Submit and wait

import { config, higgsfield } from "@higgsfield/client/v2"; config({ credentials: process.env.HF_CREDENTIALS, }); const result = await higgsfield.subscribe( "sand/magi-2/image-to-video", { input: { "duration": 5, "image_url": "https://example.com/input.jpg", "resolution": "1080p", "aspect_ratio": "16:9", "generate_audio": true }, withPolling: true, }, ); console.log(result);

Explicit lifecycle control

Use the Python SDK when a worker needs explicit status, result, or cancellation control for an existing request. The TypeScript v2 client currently exposes automatic polling through subscribe.

import higgsfield_client request_id = "{request_id}" status = higgsfield_client.status(request_id=request_id) result = higgsfield_client.result(request_id=request_id) higgsfield_client.cancel(request_id=request_id)

4. Pricing and limits

USD 0.08 per second of requested video; the default 5-second video costs USD 0.40. Generated audio is included.

One generation can run at a time per account across all three MAGI-2 modes. Additional requests wait in the queue.

Media references must be public HTTPS URLs. Images: under 30 MB; videos: MP4/MOV, up to 200 MB and 2–30 seconds each; audio: WAV/MP3, up to 15 MB and 2–30 seconds each. Total reference video duration and total reference audio duration must each be at most 30 seconds.