Higgsfield Genjutsu Motion Transfer V1.0:通过 Comfy Router 调用
通过 Comfy Router 调用 higgsfield/higgsfield-genjutsu-motion-transfer-v1.0:端点、请求形状以及 Router 返回的响应。
Higgsfield Genjutsu Motion Transfer V1.0:通过 Comfy Router 调用
通过 Comfy Router 调用 higgsfield/higgsfield-genjutsu-motion-transfer-v1.0:端点、请求形状以及 Router 返回的响应。
higgsfield/higgsfield-genjutsu-motion-transfer-v1.0 的 API 参考,由 Comfy Router 从 Higgsfield 提供。
输入: 视频、图像、文本 · 输出: 视频
快速开始
在你的 Comfy 工作区中创建一个密钥,并将其导出为 COMFY_API_KEY。Python 和 TypeScript 代码片段使用 Comfy SDK(pip install comfy-sdk 和 npm install @comfyorg/sdk);cURL 代码片段是通过原生 HTTP 发起的同一个调用。
模型 ID: higgsfield/higgsfield-genjutsu-motion-transfer-v1.0
端点: POST https://api.comfy.org/v2/models/higgsfield/higgsfield-genjutsu-motion-transfer-v1.0
[tab] 等待结果 ``python Python theme={null} from comfy_sdk import Comfy # 从环境中读取 COMFY_API_KEY。 # SDK 会自动创建幂等键,并在自动重试时复用它。 with Comfy() as client: result = client.models.run( "higgsfield/higgsfield-genjutsu-motion-transfer-v1.0", { "image_urls": ["https://cdn.example.com/character.jpg"], "prompt": "Keep the camera move and recast the dancer as the character in the reference image", "resolution": "720p", "video_url": "https://cdn.example.com/source.mp4", }, ) print(result)``typescript TypeScript theme={null} import { comfy } from "@comfyorg/sdk"; // 从环境中读取 COMFY_API_KEY。 // SDK 会自动创建幂等键,并在自动重试时复用它。 const { data } = await comfy.models.run("higgsfield/higgsfield-genjutsu-motion-transfer-v1.0", { image_urls: ["https://cdn.example.com/character.jpg"], prompt: "Keep the camera move and recast the dancer as the character in the reference image", resolution: "720p", video_url: "https://cdn.example.com/source.mp4", }); console.log(data);``bash cURL theme={null} curl https://api.comfy.org/v2/models/higgsfield/higgsfield-genjutsu-motion-transfer-v1.0 \ -H "X-API-Key: $COMFY_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d "{\"image_urls\": [\"https://cdn.example.com/character.jpg\"], \"prompt\": \"Keep the camera move and recast the dancer as the character in the reference image\", \"resolution\": \"720p\", \"video_url\": \"https://cdn.example.com/source.mp4\"}"``
[tab] 入队并稍后收集 相同的请求体,发送到POST https://api.comfy.org/v2/models/higgsfield/higgsfield-genjutsu-motion-transfer-v1.0/requests。运行被接纳后,Router 会立即返回201和request_id;结果就绪后即可收集,可由当前进程或另一个进程完成。队列投递详细介绍了状态查询、取消和结果收集。 ``python Python theme={null} import asyncio from comfy_sdk import AsyncComfy # 从环境中读取 COMFY_API_KEY。 # 每次调用 submit() 都会生成自己的 Idempotency-Key,并在自动重试时复用它。 async def main(): async with AsyncComfy() as client: handle = await client.models.submit( "higgsfield/higgsfield-genjutsu-motion-transfer-v1.0", { "image_urls": ["https://cdn.example.com/character.jpg"], "prompt": "Keep the camera move and recast the dancer as the character in the reference image", "resolution": "720p", "video_url": "https://cdn.example.com/source.mp4", }, ) print("request_id:", handle.request_id) # 加上模型 ID,就是另一个进程所需的全部信息 # 轮询直到请求完成,等待服务器指定的 Retry-After 时长。 async for update in handle.iter_events(): print(update.status, update.queue_position) # 提供商自己的响应负载,与 models.run() 返回的值相同。 # 失败或已取消的请求会在此处抛出类型化的 Router 错误。 result = await handle.get() print(result) asyncio.run(main())``typescript TypeScript theme={null} import { comfy } from "@comfyorg/sdk"; // 从环境中读取 COMFY_API_KEY。 // 每次调用 submit() 都会生成自己的 Idempotency-Key,并在自动重试时复用它。 const handle = await comfy.models.submit("higgsfield/higgsfield-genjutsu-motion-transfer-v1.0", { image_urls: ["https://cdn.example.com/character.jpg"], prompt: "Keep the camera move and recast the dancer as the character in the reference image", resolution: "720p", video_url: "https://cdn.example.com/source.mp4", }); console.log("requestId:", handle.requestId); // 加上模型 ID,就是另一个进程所需的全部信息 // 轮询直到请求完成,等待服务器指定的 Retry-After 时长。 for await (const update of handle.events()) { console.log(update.status, update.queuePosition); } // 与 models.run() 返回的结果相同。失败或已取消的请求会在此处被拒绝。 const result = await handle.get(); console.log(result.data);``bash cURL theme={null} # 1. 提交。Router 返回 201,以及 request_id、status_url、response_url 和 cancel_url。 curl https://api.comfy.org/v2/models/higgsfield/higgsfield-genjutsu-motion-transfer-v1.0/requests \ -H "X-API-Key: $COMFY_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d "{\"image_urls\": [\"https://cdn.example.com/character.jpg\"], \"prompt\": \"Keep the camera move and recast the dancer as the character in the reference image\", \"resolution\": \"720p\", \"video_url\": \"https://cdn.example.com/source.mp4\"}" # 2. 轮询直到状态为 COMPLETED,每次响应都会指明需要等待的 Retry-After 秒数。 REQUEST_ID="<request_id from the 201 body>" curl -i https://api.comfy.org/v2/models/higgsfield/higgsfield-genjutsu-motion-transfer-v1.0/requests/$REQUEST_ID/status \ -H "X-API-Key: $COMFY_API_KEY" # 3. 收集。返回 200 及模型的原始输出;仍在运行时返回 202 及状态响应体。 curl https://api.comfy.org/v2/models/higgsfield/higgsfield-genjutsu-motion-transfer-v1.0/requests/$REQUEST_ID \ -H "X-API-Key: $COMFY_API_KEY"``
Schema
输入
image\_urls string[] required
1 到 8 张参考图像的 URL,用于指定演员、场景和风格。
prompt string
用于重新选角的可选引导。
resolution string (default: "720p")
输出分辨率:480p、720p 或 1080p。
video\_url string required
来源视频的 URL,其运动、相机和时序会被保留。最短 4 秒;更长的视频会被裁剪到 30 秒。
该文档由 Router 在 GET /v2/models/higgsfield/higgsfield-genjutsu-motion-transfer-v1.0/openapi.json 提供的 schema 生成,与它在请求到达提供商之前用于校验调用的文档相同。
输出
cancel\_url string
用于在处理开始之前取消请求的绝对 URL。
error string
失败详情,当 status 为 failed 时设置。
request\_id string required
用于轮询、取消和支持的稳定标识符。
status string required
当前请求状态。
可能的值:queued、in_progress、nsfw、failed、completed、canceled
status\_url string
用于轮询直到请求达到终端状态的绝对 URL。
video object
一个 Higgsfield 媒体输出。
video.url string required
已生成媒体的下载 URL。
示例
输入
{
"image_urls": [
"https://cdn.example.com/character.jpg"
],
"prompt": "Keep the camera move and recast the dancer as the character in the reference image",
"resolution": "720p",
"video_url": "https://cdn.example.com/source.mp4"
}
输出
{
"cancel_url": "https://api.higgsfield.ai/requests/2e9b7c44-81d3-4f0a-a6e5-3b9d0c71f5a8/cancel",
"request_id": "2e9b7c44-81d3-4f0a-a6e5-3b9d0c71f5a8",
"status": "completed",
"status_url": "https://api.higgsfield.ai/requests/2e9b7c44-81d3-4f0a-a6e5-3b9d0c71f5a8/status",
"video": {
"url": "https://example.invalid/higgsfield/higgsfield-genjutsu-motion-transfer-v1.0/generated.mp4"
}
}
发布前须知
SDK 会生成 Idempotency-Key 并在自动重试中复用它。手动重试时,请复用原始 key。Router 最长可保持连接 10 分钟。
请求失败时,Router 会发送 X-Comfy-Error-Type 响应头说明原因。422 表示 Router 在调用提供商之前就拒绝了输入,413 表示请求体超出了 Router 可接受的大小。已生成的资源请及时下载,因为结果 URL 会过期。
上文任何字段描述中提到的尺寸限制,都是提供商对该字段自身的限定,引自提供商的规范。Router 会对整个请求体另行设置上限,base64 编码的媒体内容也计入其中:参见请求体大小。
本页记录的是通过 Comfy Router 调用的某一个合作伙伴模型。同一个 comfy-sdk / @comfyorg/sdk 包还提供第二个客户端,用于在 Comfy Cloud 上运行完整的 ComfyUI 工作流图:Comfy(api_key=...) / new Comfy({ apiKey }),并带有 client.workflows、client.assets 和 client.jobs。请参阅 Comfy SDKs。
[card] 请求头 身份验证、幂等性、请求 ID、错误分类、重试节奏、消费限额。
[card] 使用 Router API 模型发现、验证错误、重试与计费。
[card] 限制 Router 目前不支持的功能,以及替代方案。