Build a Consistent AI Influencer with Muse Image and Muse Video in Node.js, $0.39 per Clip

本文为原文前 6,000 字符的节选翻译,完整内容请查看原文。

Muse Image has no seed, so the same prompt never draws the same person twice. That makes a recurring AI character, the kind an influencer account needs, the hard part. This tutorial builds one in about a hundred lines of Node.js: generate a character sheet with Muse Image, cut it into a headshot and a turnaround, and hand both to Muse Video as reference images to get a 10-second vertical clip of the same woman.

Muse Image 没有种子值,因此相同的提示词永远无法绘制出同一个人。这使得创建一个循环出现的 AI 角色(网红账号所必需的那种)变得非常困难。本教程将使用大约一百行 Node.js 代码来实现这一目标:利用 Muse Image 生成一张角色设定图,将其裁剪为头像和多角度视图,然后将两者作为参考图像传给 Muse Video,从而获得一段 10 秒长的同一女性的竖屏视频。

Muse Image is Meta’s image model (text-to-image, or one to four reference images, about 2.5 megapixels per image). Muse Video is Meta’s video model (720p, 4 to 30 seconds, landscape or portrait, with an optional first frame or up to four reference images). The script calls both through one HTTP API. Disclosure: the endpoints and prices below are from apimodels.app, the API I work on. apimodels.app is a multi-model API gateway: one key and one OpenAI-compatible endpoint for 110+ image, video, audio and language models; the two Muse models are muse-image and muse-video there.

Muse Image 是 Meta 的图像模型(支持文生图,或使用一到四张参考图像,每张图像约 250 万像素)。Muse Video 是 Meta 的视频模型(支持 720p 分辨率,时长 4 到 30 秒,横屏或竖屏,可选首帧或最多四张参考图像)。该脚本通过一个 HTTP API 调用两者。披露:下方的端点和价格来自 apimodels.app,这是我参与开发的 API。apimodels.app 是一个多模型 API 网关:提供一个密钥和一个兼容 OpenAI 的端点,可访问 110 多种图像、视频、音频和语言模型;其中的两个 Muse 模型分别是 muse-image 和 muse-video。

This post is AI-assisted: drafted with an AI model from our own docs and test notes, then checked by hand. What you need Node.js 18 or newer (the script uses the built-in fetch and top-level await). sharp for cropping: npm install sharp. An API key in APIMODELS_API_KEY. About $0.39 per run: $0.02 for the sheet and $0.037 per requested second for the clip (10 seconds = $0.37), at list prices on 1 November 2026. Failed tasks are not charged.

本文由 AI 辅助完成:使用我们自己的文档和测试笔记通过 AI 模型起草,随后经过人工核对。你需要准备:Node.js 18 或更高版本(脚本使用了内置的 fetch 和顶层 await)。用于裁剪的 sharp 库:npm install sharp。一个存放在 APIMODELS_API_KEY 中的 API 密钥。每次运行成本约为 0.39 美元:设定图 0.02 美元,视频片段每秒 0.037 美元(10 秒即 0.37 美元),按 2026 年 11 月 1 日的标价计算。失败的任务不收费。

Step 1: one character sheet, not one portrait. Instead of asking for a nice photo, ask for a sheet: a large headshot in the left third and a front, side and back turnaround of the same woman on the right, on a plain light-grey background. One image, one person, every angle the video model needs. Three things in the prompt matter more than the rest: A concrete adult age. “A 25-year-old woman.” In our tests, words like “18”, “student” or “freshman” made Muse draw someone visibly younger, so every character we make is 25. The outfit with its limits spelled out. Our date outfits show shoulders, arms and legs, and the prompt also says “modest neckline, no cleavage”. “Same face, same hair and same outfit in every view.” The sheet is only useful if the views agree. Muse Image takes aspect_ratio (2:1 here) and renders about 2.5 megapixels, so a 2:1 sheet comes back around 2240 x 1120. One request returns one image; n above 1 is rejected.

第一步:一张角色设定图,而非一张肖像。不要要求生成一张精美的照片,而是要求生成一张设定图:左侧三分之一处为大头像,右侧为同一女性的正面、侧面和背面多角度视图,背景为纯浅灰色。一张图,一个人,包含视频模型所需的所有角度。提示词中有三点至关重要:具体的成年年龄。“一位 25 岁的女性。”在我们的测试中,像“18 岁”、“学生”或“大一新生”这样的词会让 Muse 画出看起来更年轻的人,所以我们创建的每个角色都是 25 岁。明确界限的服装。我们的约会装束展示了肩膀、手臂和腿部,提示词中还注明了“领口保守,无乳沟”。“每个视图中面部、发型和服装保持一致。”只有当各个视图一致时,设定图才有用。Muse Image 接受 aspect_ratio(此处为 2:1)并渲染约 250 万像素,因此 2:1 的设定图返回尺寸约为 2240 x 1120。一次请求返回一张图像;n 大于 1 的请求会被拒绝。

Step 2: cut the sheet in two. We pass the headshot and the turnaround as two separate reference images, each described in the video prompt. The cut is not at a fixed fraction: on our sheets the headshot ended anywhere between 39% and 44% of the width, and on one of them it touched the turnaround with no gap at all. splitSheet() in the script finds the first background gap to the right of the headshot. When there is no gap, it cuts where the two overlap least and prints a warning. We checked it against four of our own sheets: it landed inside the gap on the three that had one, and within a few pixels of our hand-made cut on the one that did not. It is still a heuristic, so open ref-head.jpg and ref-turnaround.jpg before you pay for a video.

第二步:将设定图一分为二。我们将头像和多角度视图作为两个独立的参考图像传入,并在视频提示词中分别描述。裁剪位置并非固定比例:在我们的设定图中,头像结束的位置在宽度的 39% 到 44% 之间,其中一张图甚至与多角度视图紧贴在一起,没有任何间隙。脚本中的 splitSheet() 函数会寻找头像右侧的第一个背景间隙。如果没有间隙,它会在两者重叠最少的地方进行裁剪并打印警告。我们用自己的四张设定图进行了测试:在有间隙的三张图中,它准确落在了间隙内;在没有间隙的那张图中,它与我们手动裁剪的位置仅差几个像素。这仍然是一种启发式方法,因此在为视频付费之前,请务必打开 ref-head.jpg 和 ref-turnaround.jpg 进行检查。

Step 3: a time-coded video prompt with both references. The video prompt starts by saying what each image is for (image 1 is the face, image 2 is the outfit and body), repeats the age, and then reads like a shot list: scene, camera, one beat per second and a half, how she behaves, the sound, the style, and an Avoid line. References go in images as public URLs or base64 data URIs (PNG, JPEG or WebP, up to 20 MB each). The script sends data URIs, so nothing needs hosting. duration: 10 with aspect_ratio: “9:16” returns a 720 x 1280 MP4. Clips up to 10 seconds usually finish in one to two minutes; 15 to 30 seconds take three to seven.

第三步:带有两个参考图像的时间编码视频提示词。视频提示词首先说明每张图像的用途(图像 1 为面部,图像 2 为服装和身体),重复年龄,然后像拍摄清单一样书写:场景、摄像机、每 1.5 秒一个节拍、她的行为方式、声音、风格以及“避免”项。参考图像以公共 URL 或 base64 数据 URI(PNG、JPEG 或 WebP,最大 20 MB)的形式放入 images 字段中。脚本发送的是数据 URI,因此无需托管任何内容。duration: 10 配合 aspect_ratio: “9:16” 会返回一个 720 x 1280 的 MP4 文件。10 秒以内的片段通常在 1 到 2 分钟内完成;15 到 30 秒的片段需要 3 到 7 分钟。