DreamAvatar - Digital Human Video Generator
Generate talking avatar videos from images and audio using DreamAvatar 3.0 Fast API.
Quick Start
1. Get API Key
Before using this skill, you need a DreamAPI API key. Visit https://api.newportai.com/api-reference/get-started to sign up and get your API key.
For more AI tools, please visit: https://tools.dreamfaceapp.com/home
2. Configure API Key
Users must set their DreamAPI key in OpenClaw config:
CODEBLOCK0
Or add to ~/.openclaw/openclaw.json:
CODEBLOCK1
3. Generate Video
You can provide input in two ways:
Option A: Local Files (Recommended)
- - image: Path to a local image file (jpg, jpeg, png, webp, gif)
- audio: Path to a local audio file (mp3, wav, mp4, max 3 minutes)
- prompt: Description of the expression/behavior
- resolution (optional): "480p" or "720p", default "480p"
The skill will automatically upload your local files and generate the video.
Option B: Public URLs
- - image: URL to a publicly accessible image (jpg, jpeg, png, webp, gif)
- audio: URL to a publicly accessible audio (mp3, wav, mp4, max 3 minutes)
- prompt: Description of the expression/behavior
- resolution (optional): "480p" or "720p", default "480p"
API Details
1. Get Upload Policy
CODEBLOCK2
Headers:
CODEBLOCK3
Request Body:
CODEBLOCK4
Response:
CODEBLOCK5
2. Upload File to OSS
Form Data:
| Parameter | Type | Required | Description |
|---|
| policy | string | Yes | Upload policy from getpolicy API |
| OSSAccessKeyId |
string | Yes | Access ID from getpolicy API |
| success
actionstatus | string | Yes | Fixed value: "200" |
| signature | string | Yes | Signature from get_policy API |
| key | string | Yes | Full path: dir + filename |
| callback | string | Yes | Callback from get_policy API |
| file | binary | Yes | File content (must be last parameter) |
Response:
CODEBLOCK6
The uploaded file URL will be: INLINECODE1
3. Generate Video (Image to Video)
CODEBLOCK7
Headers:
CODEBLOCK8
Request Body:
CODEBLOCK9
Response (Task Submission):
CODEBLOCK10
4. Polling for Result
Use the taskId to poll for results:
CODEBLOCK11
Request body:
CODEBLOCK12
Response When Complete:
CODEBLOCK13
Implementation Notes
- - Local files: The skill handles upload automatically. Files are uploaded to OSS and URLs are generated.
- URL input: Image and audio URLs must be publicly accessible (not behind authentication)
- Audio duration: Cannot exceed 3 minutes
- The API is async: You must poll for results
- Poll every 2-3 seconds, with a timeout of ~60 seconds
- Status codes: 0 = pending, 1 = processing, 2 = processing (not failed!), 3 = completed, 4 = timeout
- Uploaded file URLs: Only valid for 1 day (Storage service is free but for AI program support only)
Upload Process Flow
CODEBLOCK14
The skill implements this flow automatically when local files are provided:
- 1. Call
get_policy to receive OSS credentials - Upload image/audio to OSS
- Construct public URL from host + key
- Call DreamAvatar API with the uploaded URLs
- Poll for video completion
- Return the final video URL
DreamAvatar - 数字人视频生成器
通过DreamAvatar 3.0快速API,从图片和音频生成说话头像视频。
快速开始
1. 获取API密钥
使用此技能前,您需要获取DreamAPI的API密钥。访问 https://api.newportai.com/api-reference/get-started 注册并获取您的API密钥。
更多AI工具,请访问:https://tools.dreamfaceapp.com/home
2. 配置API密钥
用户必须在OpenClaw配置中设置DreamAPI密钥:
bash
openclaw config patch --json {skills: {entries: {dream-avatar: {env: {DREAMAPIKEY: your-api-key-here}}}}}
或添加到 ~/.openclaw/openclaw.json:
json
{
skills: {
entries: {
dream-avatar: {
env: {
DREAMAPIKEY: your-api-key
}
}
}
}
}
3. 生成视频
您可以通过两种方式提供输入:
方式A:本地文件(推荐)
- - image:本地图片文件路径(jpg、jpeg、png、webp、gif格式)
- audio:本地音频文件路径(mp3、wav、mp4格式,最长3分钟)
- prompt:表情/行为的描述
- resolution(可选):480p或720p,默认为480p
该技能将自动上传您的本地文件并生成视频。
方式B:公共URL
- - image:可公开访问的图片URL(jpg、jpeg、png、webp、gif格式)
- audio:可公开访问的音频URL(mp3、wav、mp4格式,最长3分钟)
- prompt:表情/行为的描述
- resolution(可选):480p或720p,默认为480p
API详情
1. 获取上传策略
POST https://api.newportai.com/api/file/v1/get_policy
请求头:
Authorization: Bearer {DREAMAPIKEY}
Content-Type: application/json
请求体:
json
{
scene: Dream-CN
}
响应:
json
{
code: 0,
message: success,
data: {
accessId: LTAI5tF1QzxoHGvEcziVACyc,
policy: eyJ0...,
signature: G2TzrhlybemHbfFakysY4j2EI2I=,
dir: tmp/dream/2024-11-19/5369207820989002/,
host: https://...,
expire: 1732005888,
callback: eyJ0...
}
}
2. 上传文件到OSS
表单数据:
| 参数 | 类型 | 必填 | 描述 |
|---|
| policy | string | 是 | 从getpolicy API获取的上传策略 |
| OSSAccessKeyId |
string | 是 | 从getpolicy API获取的访问ID |
| success
actionstatus | string | 是 | 固定值:200 |
| signature | string | 是 | 从get_policy API获取的签名 |
| key | string | 是 | 完整路径:dir + 文件名 |
| callback | string | 是 | 从get_policy API获取的回调 |
| file | binary | 是 | 文件内容(必须为最后一个参数) |
响应:
json
{
code: 0,
message: success,
data: {
verifyStatus: false,
reqId: 732c9caa-0a2e-4aa1-87d9-52430a8f0314
}
}
上传的文件URL将为:{host}/{key}
3. 生成视频(图片转视频)
POST https://api.newportai.com/api/async/dreamavatar/imagetovideo/3.0fast
请求头:
Authorization: Bearer {DREAMAPIKEY}
Content-Type: application/json
请求体:
json
{
image: https://.../photo.jpg,
audio: https://.../speech.mp3,
prompt: 一个微笑说话的人,
resolution: 480p
}
响应(任务提交):
json
{
code: 0,
message: success,
data: {
taskId: aa4bf173ffd84c2f8734d536d6a7b5a7
}
}
4. 轮询获取结果
使用taskId轮询获取结果:
POST https://api.newportai.com/api/getAsyncResult
请求体:
json
{
taskId: your-task-id
}
完成时的响应:
json
{
code: 0,
message: success,
data: {
task: {
taskId: aa4bf173ffd84c2f8734d536d6a7b5a7,
status: 3,
taskType: dreamavatar/imagetovideo/3.0fast
},
videos: [
{
videoType: mp4,
videoUrl: https://...video.mp4
}
]
}
}
实现说明
- - 本地文件:技能自动处理上传。文件上传到OSS并生成URL。
- URL输入:图片和音频URL必须可公开访问(无需认证)
- 音频时长:不能超过3分钟
- API为异步:必须轮询获取结果
- 每2-3秒轮询一次,超时时间约60秒
- 状态码:0 = 待处理,1 = 处理中,2 = 处理中(非失败!),3 = 已完成,4 = 超时
- 上传的文件URL:仅有效1天(存储服务免费,但仅用于AI程序支持)
上传流程
本地文件 → 获取上传策略 → 上传到OSS → 获取公共URL → 生成视频
当提供本地文件时,技能自动实现此流程:
- 1. 调用get_policy获取OSS凭证
- 将图片/音频上传到OSS
- 从host + key构建公共URL
- 使用上传的URL调用DreamAvatar API
- 轮询等待视频完成
- 返回最终视频URL