如何通过 Muse API 用 Meta Muse 生成 AI 图片和带对白的视频(中文教程)

Chinese-language tutorial. This page is written in Simplified Chinese for Chinese-speaking developers. The same material in English: How to Generate AI Videos and Images with the Meta Muse API · Muse API docs

12 分钟阅读 • 2026 年 10 月 12 日

useapi.net 是第三方 API,与 Meta 无关联,也未获得 Meta 的认可。

目录

  1. 简介
  2. 消耗了多少额度
  3. 准备工作
  4. 实战步骤
    1. 1. 绑定账号
    2. 2. 上传照片
    3. 3. 文生图
    4. 4. 三张照片合成一张图
    5. 5. 把图片做成视频,无需重新上传
    6. 6. 修复老照片并上色
    7. 7. 让老照片里的人开口说话
    8. 8. 视频换人
    9. 9. 查看每周额度
  5. 经验总结
  6. 常见问题
  7. 结语

简介

useapi.net 的 Muse API 让你用代码调用 Meta 的个人 AI 智能体 Muse:一个 POST 请求就能生成一张图片,或一段 10 秒、带人物对白的视频,而且生成的每个文件都是一个 asset id,可以直接作为下一个任务的输入。

API 运行在你自己的 Muse 账号上,免费套餐就能用。本文从三张普通照片出发:一辆老式宝马摩托车、一位红发骑手和金门大桥下的海滩,把它们合成一张她骑着这辆摩托车冲过浪花的图片。接着把这张图片做成视频,让她喊出一句台词。第三个任务里,第四张照片中的另一位女士在视频里替换了她,骑行画面保持不变。过程中还会演示文生图,以及把一张百年老照片修复、上色,再让照片里的人抬头开口说话。下面的每个请求都是生成本页素材时实际用的请求。

把照片里的骑手换进 Muse 用一张静态图片生成的视频(第 8 步)。

本文由 useapi.net 维护者撰写,介绍的是我们自己的托管 API。

消耗了多少额度

useapi.net 是一个 API,本身不是图片或视频服务。每次调用都运行在你通过 Setup Muse 绑定的 Muse 账号上,消耗该账号每周的 Muse 额度。Muse 用整数百分比报告已用额度,所以生成一张图片后往往看不到变化。你向 useapi.net 支付每月固定 15 美元,包含我们所有的 API,不按图片或视频计费。

下表是免费套餐上每一步消耗的额度(取自前后两次 percentUsed 的差值)以及每个任务的耗时:

步骤 接口 输出 消耗额度 耗时
文生图,9:16 POST /jobs/image 1152×2048 未测量 30 秒
文生图,严格 16:9 POST /jobs/image 2048×1152 0% 21 秒
骑手 + 摩托车 + 海滩 POST /jobs/image 2048×1152 0% 31 秒
把图片做成视频 POST /jobs/video 1280×720,10 秒 3% 88 秒
修复老照片 POST /jobs/image 1344×1792 1% 34 秒
让人像开口说话 POST /jobs/video 832×1104,10 秒 2% 68 秒
视频换人 POST /jobs/video 1248×704,10 秒 3% 138 秒

上传不消耗额度。在免费套餐上,一条视频消耗每周额度的 2% 到 3%,一张图片 0% 到 1%,所以一个免费账号每周大约能生成 30 到 50 条视频,或几百张图片(见第 9 步)。

开始使用

每月 15 美元的订阅即可使用 useapi.net 上的所有 API:一个 Token,所有服务。每个服务最多绑定 3 个你自己的账号,useapi.net 负责 REST 接口、负载均衡和轮询。

订阅 — 每月 15 美元

没有国际信用卡?可以用加密货币订阅(加密货币付款不退款)。价格与批量方案见订阅页面。用 Stripe 付款,首次购买 14 天内、且成功生成少于 50 次可全额退款。

准备工作

你需要一个 useapi.net API Token,以及一个通过 Setup Muse 绑定的 Muse 账号。Muse 目前只在美国和加拿大开放(Meta 官方说明),账号需要在这两个国家注册;绑定后可以在任何地方调用 API。绑定前请先在 muse.ai 完成 Muse 的新手引导(包括 Meta 的年龄验证)并生成一张图片;账号必须能用邮箱 + 密码登录,只用邮件验证码登录的 Meta 账号需要先在 Meta 账户中心 设置密码,否则绑定会返回 400。完整流程也做成了一个脚本(Node.js 和 Python):GitHub 上 useapi/muse-api 仓库的 images-videos/,另有给 Claude Code 和 Codex 用的 agent skill。所有请求也都在 Postman 集合里。

下面的步骤用到 curl、jq 和这些变量与辅助函数:

展开变量与辅助函数
export USEAPI_TOKEN="user:12345-..."
export EMAIL="[email protected]"
export MUSE_PASSWORD="..."   # the Muse account password, used once in step 1
API=https://api.useapi.net/v1/muse
AUTH="Authorization: Bearer $USEAPI_TOKEN"
enc() { jq -rn --arg v "$1" '$v|@uri'; }
post() { curl -sS -X POST "$API/$1" -H "$AUTH" -H "Content-Type: application/json" -d "$2"; }
get() { curl -sS "$API/$1" -H "$AUTH"; }
upload() { curl -sS -X POST "$API/assets?email=$(enc "$EMAIL")" -H "$AUTH" -H "Content-Type: $2" --data-binary @"$1" | jq -r .assetId; }
download() { curl -sSf "$API/assets/$(enc "$1")" -H "$AUTH" -o "$2"; }

# run a job async: submit it, poll GET /jobs/{jobid} every 10 s, save the final job record to $1
run() {
  local job id
  job=$(post "$2" "$(jq '. + {async: true}' <<< "$3")")
  id=$(jq -r .jobid <<< "$job")
  while [ "$(jq -r .status <<< "$job")" = started ]; do
    sleep 10
    job=$(get "jobs/$(enc "$id")")
  done
  echo "$job" > "$1"
  jq '{status, error, text: .result.text, asset: .result.assets[0].assetId}' "$1"
}

每次生成都作为一个任务运行。不传 async 时,POST 最多等待约 100 秒,返回完成的任务记录,或者在任务仍在运行时返回 202。本文中一条视频耗时 68 到 138 秒,所以 run 对每个任务都传 async: true,再轮询 GET /jobs/jobid。如果 run 输出的 status 不是 completed,先看 error 再继续。

不想轮询的话,可以在下面任意请求体里加上 replyUrl: "https://example.com/hooks/muse"(可选再加 replyRef)。任务结束时,API 会向这个地址发送一次 POST,内容是 JSON 格式的最终任务记录。

各种 id 里含有 : 和 @,放进 URL 路径时要用 enc 编码。同一个任务的所有输入必须在同一个 Muse 账号上,所以上传时指定了 email,任务会在持有这些输入的账号上运行。

实战步骤

提示词保持英文原样,因为它们是直接发给 Muse 的。

1. 绑定账号

POST /accounts 接收 Muse 账号的邮箱和密码。API 只登录一次,保存 30 天的会话并自动续期。每次登录时 Muse 都会给账号发一封登录验证码邮件,这封邮件只是通知,不需要输入任何内容。

curl — POST /accounts
post accounts "$(jq -n --arg email "$EMAIL" --arg password "$MUSE_PASSWORD" '{email: $email, password: $password}')" | jq '{health, maxJobs, quota}'

返回结果里有 health: "OK"、maxJobs(默认 2)以及账号的套餐和用量,这里是 tier: "HATCH_FREE",即免费套餐。如果返回的是 596,说明 Meta 要求做安全验证:在浏览器里登录一次 muse.ai 完成验证,再用同样的邮箱和密码重新提交。

2. 上传照片

POST /assets 以原始文件作为请求体,单个文件最大 50 MB(上传速度约每秒 1 MB,50 MB 约需一分钟),文件写入账号的 Muse 工作区,useapi.net 不存储任何内容。返回的 assetId 就是任务里 image_N 要传的值。

curl — POST /assets
BMW=$(upload bmw.jpeg image/jpeg)
RIDER=$(upload rider.jpeg image/jpeg)
BEACH=$(upload beach.jpeg image/jpeg)
OLD_PHOTO=$(upload old-photo.jpeg image/jpeg)
PINK=$(upload pink-hair.jpeg image/jpeg)
echo "$BMW"
# user:12345-email:6578616d706c6540676d61696c2e636f6d-image:7db53e7a1f0979cbab6ff46ec3f0a35b60e6ee579a0d738a9628cf46a0c7a0f5.jpg
image_1:摩托车
image_1:摩托车
image_2:骑手
image_2:骑手
image_3:海滩
image_3:海滩
老人像照片
老人像照片
第二位骑手
第二位骑手

五张输入图片:摩托车、骑手、海滩、老人像照片和第二位骑手。

asset id 由文件内容生成,所以把同一个文件再次上传到同一个账号,会返回同样的 id,不会重复写入。

3. 文生图

Muse 没有宽高比参数,比例写在提示词里。先生成一张竖幅人像:

curl — POST /jobs/image
run portrait.json jobs/image "$(jq -n '{prompt: "Vertical 9:16 full-body portrait photo: a confident young woman biker with long wavy fiery red hair, green eyes and freckles, in a worn black leather jacket, dark jeans and boots, standing in a rain-soaked neon alley at dusk, looking straight at the camera, cinematic lighting, photorealistic."}')"
download "$(jq -r '.result.assets[0].assetId' portrait.json)" portrait.webp

9:16 文生图:雨夜霓虹小巷里的红发女骑手

在新标签页打开

返回的正好是 9:16,1152×2048。横幅版本用 Cinematic 16:9 landscape photo: … 描述时,返回的是 1920×1280,也就是 3:2。改写成 in exactly 16:9 aspect ratio 后比例就对了:

curl — POST /jobs/image
run bmw-noir.json jobs/image "$(jq -n '{prompt: "In exactly 16:9 aspect ratio (landscape), a cinematic photo of a vintage 1920s black BMW motorcycle with white pinstripes, spoked wheels and a brown leather saddle, parked on wet cobblestones at night in San Francisco, the Golden Gate Bridge glowing through fog in the distance, neo-noir moonlight, reflections on the wet street, shot on 35mm film."}')"
download "$(jq -r '.result.assets[0].assetId' bmw-noir.json)" bmw-noir.webp

严格 16:9 文生图:旧金山雨夜街头的老式宝马摩托车

在新标签页打开

Muse 的回复是 “That 16:9 frame with the bridge ghosting through the fog is pure neo-noir. Enjoy.”,它的回复在 result.text 里。

4. 三张照片合成一张图

一个任务最多接受 9 张图片,参数为 image_1..image_9,提示词里按名字引用它们。这里摩托车是 image_1,骑手是 image_2,海滩是 image_3。提示词要求 Muse 按原样使用照片里的海滩,所以金门大桥留在照片中原来的位置。

curl — POST /jobs/image
run beach-ride.json jobs/image "$(jq -n --arg bmw "$BMW" --arg rider "$RIDER" --arg beach "$BEACH" \
  '{image_1: $bmw, image_2: $rider, image_3: $beach,
  prompt: "In exactly 16:9 aspect ratio (landscape), a cinematic photo: the woman from image_2 (her face, long wavy red hair, light blue top and jeans) riding the exact vintage motorcycle from image_1 along the shoreline of the beach in image_3, the front wheel cutting through the shallow surf and throwing spray, bright afternoon sun, her hair streaming in the wind, photorealistic. Use the beach, rocks and Golden Gate Bridge from image_3 as the background exactly as photographed: same position, same orientation, not mirrored or redrawn. Keep her face and the motorcycle'\''s design exactly as in the images."}')"
BEACH_RIDE=$(jq -r '.result.assets[0].assetId' beach-ride.json)
download "$BEACH_RIDE" beach-ride.webp

骑手、摩托车和海滩合成在一张图里

在新标签页打开

耗时 31 秒,每周额度没有可见的变化。

5. 把图片做成视频,无需重新上传

BEACH_RIDE 是 Muse 生成的文件的 id,它已经在账号的工作区里,所以可以直接作为下一个任务的 image_1,不用下载也不用上传。Animate image_1 会生成一段以这张图片开头、保持其画幅的视频,引号里的台词会被说出来。

curl — POST /jobs/video
run surf.json jobs/video "$(jq -n --arg img "$BEACH_RIDE" '{image_1: $img,
  prompt: "Animate image_1 into a cinematic video in exactly 16:9 aspect ratio (landscape): she rides the vintage motorcycle along the shoreline, the front wheel slices through the shallow waves and sends spray flying, the old engine roars, she raises one fist and shouts with a laugh: \"Nothing beats this view!\" The camera tracks alongside her. The beach, the rocks and the Golden Gate Bridge stay exactly as in image_1 (same orientation). Keep her face and the motorcycle exactly as in image_1."}')"
SURF=$(jq -r '.result.assets[0].assetId' surf.json)
download "$SURF" surf.mp4

10 秒,1280×720,带声音。Muse 的回复是 “Done. 10 seconds, 16:9 landscape, straight from your image — no edits, no upscaling.”

这个任务第一次运行时在 37 秒后失败了,Muse 的回答是 “the video worker glitched out before it rendered anything, so no clip was made”。API 把这类回答报告为 503,表示什么都没有生成,同样的请求再运行一次就成功了。因内容原因被拒绝则是 403,需要换一个提示词。

6. 修复老照片并上色

图片任务也能修复图片。这张老人像是一张褪色的棕褐色照片,685×900 像素,3:4。提示词列出要修复的内容,并坚持保持同样的画面。

curl — POST /jobs/image
run restored.json jobs/image "$(jq -n --arg img "$OLD_PHOTO" '{image_1: $img,
  prompt: "Restore the old photograph image_1 as a high-quality modern photo: remove the scratches, dust, stains, fading and grain, recover sharp detail in the face, hair and fabric, and colorize it naturally (warm natural skin tones, dark brown hair, ivory tulle shawl, a soft pink rose with green leaves, a muted warm background). Keep the exact same person, expression, pose, framing and crop, and the same portrait aspect ratio as image_1 (3:4, 685×900): do not crop, extend or reframe it."}')"
RESTORED=$(jq -r '.result.assets[0].assetId' restored.json)
download "$RESTORED" restored.webp
修复前:原图,685×900
修复前:原图,685×900
修复后:修复并上色,1344×1792
修复后:修复并上色,1344×1792

结果是 1344×1792,同样的 3:4 画面,尺寸约为原图的两倍,姿势和裁切都没变。Muse 的回复是 “Done — restored, de-grained, and colorized, same framing and pose.”

7. 让老照片里的人开口说话

修复后的图片直接进入视频任务。视频保持人像的画幅,返回的是 832×1104。

curl — POST /jobs/video
run portrait-video.json jobs/video "$(jq -n --arg img "$RESTORED" '{image_1: $img,
  prompt: "Animate image_1 into a video with the same portrait frame: the young woman slowly lifts her eyes to the camera, her smile widens, she gently touches the rose on her shoulder and says softly: \"It has been a hundred years... and you still remember me.\" A light breeze moves a few strands of her hair, soft window light, the camera stays still with a very slow push-in. Keep her face exactly as in image_1."}')"
download "$(jq -r '.result.assets[0].assetId' portrait-video.json)" portrait.mp4

8. 视频换人

视频任务也接受视频作为输入。video_1 是第 5 步生成的海边骑行视频,image_1 是第二位女士的照片,她留着粉色双丸子头。提示词要求 Muse 替换骑手、其他一切保持不变,并给她一句新台词。

curl — POST /jobs/video
run swap.json jobs/video "$(jq -n --arg vid "$SURF" --arg img "$PINK" '{video_1: $vid, image_1: $img,
  prompt: "Edit video_1: replace the rider with the woman from image_1 (her face, pink hair in two buns, colorful makeup and tattoos), and keep everything else the same: the motorcycle, the beach, the waves and spray, the Golden Gate Bridge, the light, the camera move and the timing. Instead of the original line she shouts: \"Catch me if you can, San Francisco!\" Keep the 16:9 frame and the same length."}')"
download "$(jq -r '.result.assets[0].assetId' swap.json)" swap.mp4
替换前:原来的骑手
替换后:照片里的骑手

这个任务耗时 138 秒,是整个流程里最慢的一个,这也是本文所有任务都用异步方式运行的原因。成片是同一段骑行,摩托车上换成了另一位女士,喊出新的台词。Muse 的回复是 “Done. She’s in, 10 seconds, 16:9, same ride, same bridge, same waves.”

9. 查看每周额度

GET /accounts/email 实时读取账号的套餐和用量:

curl — GET /accounts/email
get "accounts/$(enc "$EMAIL")" | jq '{session, quota}'

quota.percentUsed 是本周已用额度的整数百分比,quota.resetsAt 是额度重置的时间,即本周期开始后一周。上面三条视频各消耗 2% 到 3%,图片各消耗 0% 或 1%。整个测试过程中(另外还运行了两个本文没有展示的任务),这个免费账号从 16% 用到了 28%。账号额度用完后,不指定 email 的新任务会分配到你的其他账号,指定了该账号的任务会返回 412,直到 resetsAt。

经验总结

  • 宽高比写成 in exactly 16:9 aspect ratio。Cinematic 16:9 landscape photo 曾经返回 3:2。
  • 每条视频都是约 10 秒。提示词要求 5 秒,得到的仍是 10 秒。
  • 图生视频会保持图片的画幅,除非提示词要求别的比例:in exactly 9:16 aspect ratio 把我们 16:9 的海滩图片变成了 720×1280 的竖屏视频,是重新构图,不是拉伸。
  • 视频提示词里写在引号中的台词会被说出来。
  • 生成的文件用 assetId 传给下一个任务。它们保存在账号的工作区里,连续编辑时中间不需要下载。
  • 说清楚哪些东西必须保持不变。”Same position, same orientation, not mirrored or redrawn” 让合成图里保留了真实的海滩。
  • 返回 503 且带有 Muse 自己的话(比如 “glitched out”)时,值得再运行一次。403 是拒绝,需要换提示词。
  • 视频任务用 async: true 提交。同步请求最多等待约 100 秒,而换人任务用了 138 秒。

常见问题

  • Meta Muse(muse.ai)有 API 吗? useapi.net 提供一个:Muse API 在你自己的账号上运行 Muse。用邮箱和密码绑定账号,然后用 POST /jobs/image 生成图片,用 POST /jobs/video 生成视频。
  • 免费的 Muse 套餐能用吗? 能。本页所有内容都是在免费套餐(HATCH_FREE)上生成的,它有每周额度。一条视频消耗其中 2% 到 3%,一张图片 0% 到 1%。
  • 怎么设置宽高比、时长或分辨率? 写在提示词里,没有对应的参数。宽高比写成 in exactly 16:9 aspect ratio 时会被遵守。视频总是约 10 秒、约 720p,带声音。
  • 能用自己的照片和视频吗? 能。用 POST /assets 上传,每个文件最大 50 MB,再把 assetId 作为 image_1..image_9 传入;视频任务还可以传 video_1..video_3 和 audio_1..audio_3。同一个任务的所有输入必须在同一个账号上。
  • 怎么让一张照片开口说话? 把它作为 image_1 传给 POST /jobs/video,提示词类似 Animate image_1: … she says softly: "…",见第 7 步。
  • 能替换视频里的人吗? 能。把视频作为 video_1、新人物的照片作为 image_1 传入,让 Muse 替换人物、其他保持不变,见第 8 步。
  • 同步请求为什么返回 202? 任务运行约 100 秒后仍未完成,它会在我们这边继续运行。用 GET /jobs/jobid 查询,或者对耗时长的任务直接用 async: true。
  • 为什么 Muse 给我发了登录验证码邮件? API 登录了这个账号,这发生在绑定账号时,以及大约每 30 天续期会话时。验证码不需要任何操作,见 Setup Muse。
  • Muse API 多少钱? 向 useapi.net 支付每月固定 15 美元,包含 useapi.net 的所有 API,不按图片或视频收费。生成消耗的是你自己 Muse 账号的每周额度。

结语

有问题欢迎加入我们的 Discord 服务器 或 Telegram 频道。