Happy Pony API Get an API key →

Image to video

Pricing: MiniMax H3 video

A first frame, a last frame and/or timed keyframes plus a prompt in, one video with sound out (MiniMax H3). The same job as the Frames mode of www.happypony.io/minimax-h3. A video takes a few minutes; longer, higher-resolution and quality jobs take longer.

POST https://api.happypony.io/api/v1/jobs/image-to-video
GET  https://api.happypony.io/api/v1/jobs/:requestId/status
GET  https://api.happypony.io/api/v1/jobs/:requestId
PUT  https://api.happypony.io/api/v1/jobs/:requestId/cancel

1) Create a request

POST https://api.happypony.io/api/v1/jobs/image-to-video with Content-Type: application/json.

Field Type Required Default Description
prompt string yes — What happens: motion, camera, dialogue in quotes, sounds. At most 8000 characters.
first_frame_url string see below — The image the video starts from. See Image inputs.
last_frame_url string see below — The image the video ends on.
keyframes object[] see below — Stills pinned at given moments inside the clip: { "url", "time" } or { "url", "frame" }. See Keyframes.
duration integer no 5 Seconds, from 5 to the canvas limit (Duration limits).
short_edge integer no 768 480, 768 or 1080: the shorter side in pixels. 768 is native; 1080 is rendered smaller and upscaled.
aspect_ratio string no "auto" "auto" (follow the frame), "21:9", "16:9", "4:3", "1:1", "3:4" or "9:16".
tier string no "turbo" "turbo" (fast) or "quality" (slower, more detail).

At least one of first_frame_url, last_frame_url and keyframes is required; any combination works.

Request body:

{
  "prompt": "She smiles, waves at the camera and says \"Hi, nice to meet you!\"",
  "first_frame_url": "https://resource.pipelet.net/images/test/selfie3.png",
  "duration": 5,
  "short_edge": 768,
  "aspect_ratio": "auto",
  "tier": "turbo"
}
curl -X POST https://api.happypony.io/api/v1/jobs/image-to-video \
  -H "Authorization: Bearer $HP_KEY" -H "Content-Type: application/json" \
  -d '{"prompt": "She smiles, waves at the camera and says \"Hi, nice to meet you!\"", "first_frame_url": "https://resource.pipelet.net/images/test/selfie3.png", "duration": 5, "short_edge": 768, "aspect_ratio": "auto", "tier": "turbo"}'

Response 202 (fields: Create response):

{
  "request_id": "48250",
  "type": "image-to-video",
  "status": "IN_QUEUE",
  "credits": 20,
  "status_url": "https://api.happypony.io/api/v1/jobs/48250/status",
  "response_url": "https://api.happypony.io/api/v1/jobs/48250",
  "cancel_url": "https://api.happypony.io/api/v1/jobs/48250/cancel"
}

Duration limits

The longest clip depends on the canvas (auto follows the 1:1 column). A longer duration is a 400.

short_edge auto, 1:1 4:3, 3:4 16:9, 9:16 21:9
480 20 s 20 s 20 s 20 s
768 20 s 20 s 15 s 10 s
1080 20 s 20 s 20 s 20 s

Prompt tips

The model writes the picture and the soundtrack from the prompt. In one paragraph: describe the motion that starts from the frame (with two frames, the motion that connects them), direct the camera in words, put spoken lines in quotation marks (about 3 words per second of clip), and name the sounds and what makes them. There is no negative prompt: write "Ambient sound only." rather than "no music". Prompts under 3200 characters are expanded automatically (see Prompt enrichment); quoted dialogue is kept word for word.

Keyframes

keyframes pins extra images at chosen moments inside the clip, between the first and the last frame. The video passes through each one at its time. Each entry is an object:

Field Type Description
url string The image. Same rules as first_frame_url: see Image inputs. An unusable URL is a 400 invalid_media with field set to e.g. keyframes[0].url.
time number Seconds from the start of the clip, greater than 0, rounded to the nearest frame (24 fps).
frame integer Alternative to time: the frame index at 24 fps. Negative counts from the end (-1 is the last frame, -2 the one before it).

Rules (a request that breaks one is a 400 invalid_request whose details lists every problem, e.g. keyframes[1] falls on frame 144; nothing is charged):

A 5-second clip with a first frame, two keyframes (one at 1.5 s, one at frame -40, i.e. frame 84 = 3.5 s) and a last frame:

{
  "prompt": "A woman stands at a window and turns toward the camera. At 1.50 seconds she faces the camera, as in <Picture 2>, and starts to smile. She walks to the table and picks up a cup; at 3.50 seconds she holds it up, as in <Picture 3>. She sits down in the armchair and takes a sip, ending as in <Picture 4>. Quiet room tone, footsteps on wood, the clink of the cup.",
  "first_frame_url": "https://example.com/window.png",
  "keyframes": [
    { "url": "https://example.com/facing-camera.png", "time": 1.5 },
    { "url": "https://example.com/holding-cup.png", "frame": -40 }
  ],
  "last_frame_url": "https://example.com/armchair.png",
  "duration": 5,
  "short_edge": 768
}

Writing the prompt with keyframes:

Caveats:

2) Poll for status

Poll the status_url until status is COMPLETED, FAILED or CANCELLED (fields: Status response). A queued job can be cancelled with PUT on the cancel_url (Cancel a request).

curl https://api.happypony.io/api/v1/jobs/48250/status -H "Authorization: Bearer $HP_KEY"
{
  "request_id": "48250",
  "type": "image-to-video",
  "status": "IN_QUEUE",
  "created_at": "2026-10-05T10:00:00.000Z",
  "completed_at": null,
  "credits": 20,
  "queue_position": 1,
  "eta_seconds": 240,
  "status_url": "…", "response_url": "…", "cancel_url": "…"
}

3) Fetch the result

When status is COMPLETED, fetch the response_url (common fields: Result response):

curl https://api.happypony.io/api/v1/jobs/48250 -H "Authorization: Bearer $HP_KEY"
{
  "request_id": "48250",
  "type": "image-to-video",
  "status": "COMPLETED",
  "created_at": "2026-10-05T10:00:00.000Z",
  "completed_at": "2026-10-05T10:03:12.000Z",
  "credits": 20,
  "videos": [{ "url": "https://…signed…", "format": "mp4" }],
  "expires_in": 259200,
  "parameters": { "prompt": "She smiles, waves at the camera and says \"Hi, nice to meet you!\"",
                  "tier": "turbo", "duration": 5, "short_edge": 768, "aspect_ratio": "auto" },
  "status_url": "…", "response_url": "…", "cancel_url": "…"
}
Field Type Description
videos object[] One mp4 with its soundtrack.
parameters object prompt, tier, duration, short_edge, aspect_ratio, plus keyframes when the request had keyframes.
parameters.keyframes object[] Only when the request had keyframes: the entries as you sent them ({ "url", "time" } or { "url", "frame" }, with your own URLs), sorted by time.

For a request with keyframes, such as the Keyframes example, parameters reads:

"parameters": { "prompt": "A woman stands at a window and turns toward the camera. …",
                "tier": "turbo", "duration": 5, "short_edge": 768, "aspect_ratio": "auto",
                "keyframes": [{ "url": "https://example.com/facing-camera.png", "time": 1.5 },
                              { "url": "https://example.com/holding-cup.png", "frame": -40 }] }

Full example

Create, poll until done, download:

curl (bash)

# Needs curl and jq. Usage: HP_KEY=hp_… ./i2v.sh
JOB=$(curl -s -X POST https://api.happypony.io/api/v1/jobs/image-to-video \
  -H "Authorization: Bearer $HP_KEY" -H "Content-Type: application/json" \
  -d '{"prompt": "She smiles, waves at the camera and says \"Hi, nice to meet you!\"",
       "first_frame_url": "https://resource.pipelet.net/images/test/selfie3.png", "duration": 5}')
echo "$JOB" | jq .
STATUS_URL=$(echo "$JOB" | jq -r .status_url)
RESPONSE_URL=$(echo "$JOB" | jq -r .response_url)

while :; do
  STATUS=$(curl -s "$STATUS_URL" -H "Authorization: Bearer $HP_KEY" | jq -r .status)
  [ "$STATUS" = IN_QUEUE ] || [ "$STATUS" = IN_PROGRESS ] || break
  sleep 10
done
echo "$STATUS"
curl -s "$RESPONSE_URL" -H "Authorization: Bearer $HP_KEY" | jq -r '.videos[] | "\(.format) \(.url)"' |
  while read -r FORMAT URL; do curl -s -o "video-$((++i)).$FORMAT" "$URL"; done

Python

# pip install requests   |   HP_KEY=hp_… python i2v.py
import os, time, requests

BASE = "https://api.happypony.io/api/v1/jobs"
H = {"Authorization": f"Bearer {os.environ['HP_KEY']}"}

# A local file instead of a public URL: upload it first.
# first = requests.post(f"{BASE}/uploads", headers=H, files={"file": open("me.png", "rb")}).json()["url"]
first = "https://resource.pipelet.net/images/test/selfie3.png"

job = requests.post(f"{BASE}/image-to-video", headers=H, json={
    "prompt": 'She smiles, waves at the camera and says "Hi, nice to meet you!"',
    "first_frame_url": first,
    "duration": 5,
})
job.raise_for_status()
job = job.json()
print("job", job["request_id"], "costs", job["credits"], "credits")

while (s := requests.get(job["status_url"], headers=H).json())["status"] in ("IN_QUEUE", "IN_PROGRESS"):
    time.sleep(10)

result = requests.get(job["response_url"], headers=H).json()
if result["status"] != "COMPLETED":
    raise SystemExit(f"{result['status']}: {result.get('error', '')}")
for i, video in enumerate(result["videos"]):
    with open(f"video-{job['request_id']}-{i}.{video['format']}", "wb") as f:
        f.write(requests.get(video["url"]).content)

TypeScript

// Node 18+ (global fetch).   HP_KEY=hp_… npx tsx i2v.ts
import { writeFile } from 'node:fs/promises';

const BASE = 'https://api.happypony.io/api/v1/jobs';
const H = { Authorization: `Bearer ${process.env.HP_KEY}`, 'Content-Type': 'application/json' };

const res = await fetch(`${BASE}/image-to-video`, {
  method: 'POST', headers: H,
  body: JSON.stringify({
    prompt: 'She smiles, waves at the camera and says "Hi, nice to meet you!"',
    first_frame_url: 'https://resource.pipelet.net/images/test/selfie3.png',
    duration: 5,
  }),
});
const job = await res.json();
if (!res.ok) throw new Error(`${res.status}: ${job.message}`);

let status = 'IN_QUEUE';
while (status === 'IN_QUEUE' || status === 'IN_PROGRESS') {
  await new Promise((r) => setTimeout(r, 10_000));
  status = (await (await fetch(job.status_url, { headers: H })).json()).status;
}
const result = await (await fetch(job.response_url, { headers: H })).json();
if (result.status !== 'COMPLETED') throw new Error(`${result.status}: ${result.error ?? ''}`);
for (const [i, video] of result.videos.entries()) {
  await writeFile(`video-${job.request_id}-${i}.${video.format}`, Buffer.from(await (await fetch(video.url)).arrayBuffer()));
}

图生视频

价格:MiniMax H3 视频

传入首帧、尾帧和/或定时关键帧与提示词,生成一段带声音的视频(MiniMax H3)。与 www.happypony.io/minimax-h3 首尾帧模式的任务完全相同。生成一段视频需要几分钟;时长越长、分辨率越高或使用 quality 都会更久。

POST https://api.happypony.io/api/v1/jobs/image-to-video
GET  https://api.happypony.io/api/v1/jobs/:requestId/status
GET  https://api.happypony.io/api/v1/jobs/:requestId
PUT  https://api.happypony.io/api/v1/jobs/:requestId/cancel

1) 创建请求

POST https://api.happypony.io/api/v1/jobs/image-to-video,Content-Type: application/json。

字段 类型 必填 默认值 说明
prompt string 是 — 视频中发生的事:动作、镜头、引号内的台词、声音。最多 8000 个字符。
first_frame_url string 见下文 — 视频开始的画面。见图片输入。
last_frame_url string 见下文 — 视频结束的画面。
keyframes object[] 见下文 — 固定在片段内指定时刻的画面:{ "url", "time" } 或 { "url", "frame" }。见关键帧。
duration integer 否 5 秒数,从 5 到画布上限(见时长上限)。
short_edge integer 否 768 480、768 或 1080:短边像素数。768 为原生尺寸;1080 先以较小尺寸渲染再放大。
aspect_ratio string 否 "auto" "auto"(跟随帧图片)、"21:9"、"16:9"、"4:3"、"1:1"、"3:4" 或 "9:16"。
tier string 否 "turbo" "turbo"(快)或 "quality"(较慢,细节更多)。

first_frame_url、last_frame_url、keyframes 至少填一个,可任意组合。

请求体:

{
  "prompt": "She smiles, waves at the camera and says \"Hi, nice to meet you!\"",
  "first_frame_url": "https://resource.pipelet.net/images/test/selfie3.png",
  "duration": 5,
  "short_edge": 768,
  "aspect_ratio": "auto",
  "tier": "turbo"
}
curl -X POST https://api.happypony.io/api/v1/jobs/image-to-video \
  -H "Authorization: Bearer $HP_KEY" -H "Content-Type: application/json" \
  -d '{"prompt": "She smiles, waves at the camera and says \"Hi, nice to meet you!\"", "first_frame_url": "https://resource.pipelet.net/images/test/selfie3.png", "duration": 5, "short_edge": 768, "aspect_ratio": "auto", "tier": "turbo"}'

响应 202(字段见创建响应):

{
  "request_id": "48250",
  "type": "image-to-video",
  "status": "IN_QUEUE",
  "credits": 20,
  "status_url": "https://api.happypony.io/api/v1/jobs/48250/status",
  "response_url": "https://api.happypony.io/api/v1/jobs/48250",
  "cancel_url": "https://api.happypony.io/api/v1/jobs/48250/cancel"
}

时长上限

最长时长取决于画布(auto 按 1:1 一列计算)。超过上限的 duration 返回 400。

short_edge auto、1:1 4:3、3:4 16:9、9:16 21:9
480 20 秒 20 秒 20 秒 20 秒
768 20 秒 20 秒 15 秒 10 秒
1080 20 秒 20 秒 20 秒 20 秒

提示词技巧

模型会根据提示词同时生成画面和声音。用一段话:描述从首帧开始的动作(有两帧时,描述连接两帧的动作),用文字指挥镜头,台词放在引号里(每秒视频约 3 个词),并写出声音及其来源。不支持负面提示词:写“Ambient sound only.”而不是“no music”。不足 3200 个字符的提示词会自动扩写(见提示词增强);引号内的台词会逐字保留。

关键帧

keyframes 用于在片段内部(首帧与尾帧之间)的指定时刻固定额外的画面,视频会在对应时刻经过每一张图。每一项是一个对象:

字段 类型 说明
url string 图片。规则与 first_frame_url 相同:见图片输入。无法使用的 URL 返回 400 invalid_media,field 形如 keyframes[0].url。
time number 距片段开头的秒数(必须大于 0),四舍五入到最近的一帧(24 fps)。
frame integer time 的替代写法:24 fps 下的帧序号。负数从末尾倒数(-1 是最后一帧,-2 是倒数第二帧)。

规则(违反任一条返回 400 invalid_request,details 会列出所有问题,例如 keyframes[1] falls on frame 144;不扣积分):

一段 5 秒的片段,包含首帧、两个关键帧(一个在 1.5 秒,一个在第 -40 帧,即第 84 帧 = 3.5 秒)和尾帧:

{
  "prompt": "A woman stands at a window and turns toward the camera. At 1.50 seconds she faces the camera, as in <Picture 2>, and starts to smile. She walks to the table and picks up a cup; at 3.50 seconds she holds it up, as in <Picture 3>. She sits down in the armchair and takes a sip, ending as in <Picture 4>. Quiet room tone, footsteps on wood, the clink of the cup.",
  "first_frame_url": "https://example.com/window.png",
  "keyframes": [
    { "url": "https://example.com/facing-camera.png", "time": 1.5 },
    { "url": "https://example.com/holding-cup.png", "frame": -40 }
  ],
  "last_frame_url": "https://example.com/armchair.png",
  "duration": 5,
  "short_edge": 768
}

使用关键帧时的提示词写法:

注意事项:

2) 轮询状态

轮询 status_url,直到 status 变为 COMPLETED、FAILED 或 CANCELLED(字段见状态响应)。排队中的任务可以向 cancel_url 发送 PUT 取消(见取消请求)。

curl https://api.happypony.io/api/v1/jobs/48250/status -H "Authorization: Bearer $HP_KEY"
{
  "request_id": "48250",
  "type": "image-to-video",
  "status": "IN_QUEUE",
  "created_at": "2026-10-05T10:00:00.000Z",
  "completed_at": null,
  "credits": 20,
  "queue_position": 1,
  "eta_seconds": 240,
  "status_url": "…", "response_url": "…", "cancel_url": "…"
}

3) 获取结果

status 为 COMPLETED 后,获取 response_url(通用字段见结果响应):

curl https://api.happypony.io/api/v1/jobs/48250 -H "Authorization: Bearer $HP_KEY"
{
  "request_id": "48250",
  "type": "image-to-video",
  "status": "COMPLETED",
  "created_at": "2026-10-05T10:00:00.000Z",
  "completed_at": "2026-10-05T10:03:12.000Z",
  "credits": 20,
  "videos": [{ "url": "https://…signed…", "format": "mp4" }],
  "expires_in": 259200,
  "parameters": { "prompt": "She smiles, waves at the camera and says \"Hi, nice to meet you!\"",
                  "tier": "turbo", "duration": 5, "short_edge": 768, "aspect_ratio": "auto" },
  "status_url": "…", "response_url": "…", "cancel_url": "…"
}
字段 类型 说明
videos object[] 一个带音轨的 mp4。
parameters object prompt、tier、duration、short_edge、aspect_ratio;请求带关键帧时另有 keyframes。
parameters.keyframes object[] 仅当请求带关键帧时出现:与你发送的条目一致({ "url", "time" } 或 { "url", "frame" },保留你自己的 URL),按时间排序。

带关键帧的请求(如关键帧中的示例),parameters 为:

"parameters": { "prompt": "A woman stands at a window and turns toward the camera. …",
                "tier": "turbo", "duration": 5, "short_edge": 768, "aspect_ratio": "auto",
                "keyframes": [{ "url": "https://example.com/facing-camera.png", "time": 1.5 },
                              { "url": "https://example.com/holding-cup.png", "frame": -40 }] }

完整示例

创建、轮询直到完成、下载:

curl (bash)

# Needs curl and jq. Usage: HP_KEY=hp_… ./i2v.sh
JOB=$(curl -s -X POST https://api.happypony.io/api/v1/jobs/image-to-video \
  -H "Authorization: Bearer $HP_KEY" -H "Content-Type: application/json" \
  -d '{"prompt": "She smiles, waves at the camera and says \"Hi, nice to meet you!\"",
       "first_frame_url": "https://resource.pipelet.net/images/test/selfie3.png", "duration": 5}')
echo "$JOB" | jq .
STATUS_URL=$(echo "$JOB" | jq -r .status_url)
RESPONSE_URL=$(echo "$JOB" | jq -r .response_url)

while :; do
  STATUS=$(curl -s "$STATUS_URL" -H "Authorization: Bearer $HP_KEY" | jq -r .status)
  [ "$STATUS" = IN_QUEUE ] || [ "$STATUS" = IN_PROGRESS ] || break
  sleep 10
done
echo "$STATUS"
curl -s "$RESPONSE_URL" -H "Authorization: Bearer $HP_KEY" | jq -r '.videos[] | "\(.format) \(.url)"' |
  while read -r FORMAT URL; do curl -s -o "video-$((++i)).$FORMAT" "$URL"; done

Python

# pip install requests   |   HP_KEY=hp_… python i2v.py
import os, time, requests

BASE = "https://api.happypony.io/api/v1/jobs"
H = {"Authorization": f"Bearer {os.environ['HP_KEY']}"}

# A local file instead of a public URL: upload it first.
# first = requests.post(f"{BASE}/uploads", headers=H, files={"file": open("me.png", "rb")}).json()["url"]
first = "https://resource.pipelet.net/images/test/selfie3.png"

job = requests.post(f"{BASE}/image-to-video", headers=H, json={
    "prompt": 'She smiles, waves at the camera and says "Hi, nice to meet you!"',
    "first_frame_url": first,
    "duration": 5,
})
job.raise_for_status()
job = job.json()
print("job", job["request_id"], "costs", job["credits"], "credits")

while (s := requests.get(job["status_url"], headers=H).json())["status"] in ("IN_QUEUE", "IN_PROGRESS"):
    time.sleep(10)

result = requests.get(job["response_url"], headers=H).json()
if result["status"] != "COMPLETED":
    raise SystemExit(f"{result['status']}: {result.get('error', '')}")
for i, video in enumerate(result["videos"]):
    with open(f"video-{job['request_id']}-{i}.{video['format']}", "wb") as f:
        f.write(requests.get(video["url"]).content)

TypeScript

// Node 18+ (global fetch).   HP_KEY=hp_… npx tsx i2v.ts
import { writeFile } from 'node:fs/promises';

const BASE = 'https://api.happypony.io/api/v1/jobs';
const H = { Authorization: `Bearer ${process.env.HP_KEY}`, 'Content-Type': 'application/json' };

const res = await fetch(`${BASE}/image-to-video`, {
  method: 'POST', headers: H,
  body: JSON.stringify({
    prompt: 'She smiles, waves at the camera and says "Hi, nice to meet you!"',
    first_frame_url: 'https://resource.pipelet.net/images/test/selfie3.png',
    duration: 5,
  }),
});
const job = await res.json();
if (!res.ok) throw new Error(`${res.status}: ${job.message}`);

let status = 'IN_QUEUE';
while (status === 'IN_QUEUE' || status === 'IN_PROGRESS') {
  await new Promise((r) => setTimeout(r, 10_000));
  status = (await (await fetch(job.status_url, { headers: H })).json()).status;
}
const result = await (await fetch(job.response_url, { headers: H })).json();
if (result.status !== 'COMPLETED') throw new Error(`${result.status}: ${result.error ?? ''}`);
for (const [i, video] of result.videos.entries()) {
  await writeFile(`video-${job.request_id}-${i}.${video.format}`, Buffer.from(await (await fetch(video.url)).arrayBuffer()));
}