Heygen Avatar Iv
heygen-avatar-iv
价格
heygen-avatar-iv 每秒
| 单价 | $0.150 |
|---|
模型介绍撰写中
该模型的详细指南正在准备中。下方的价格、参数与 API 文档已可查阅。
提交生成任务
https://api.hiapi.ai/v1/tasks 请求头
Authorizationstring必填账号 API Key,所有请求必填。示例:Bearer YOUR_HIAPI_API_KEY。获取 API Key
Content-Typestring可选请求体固定按 JSON 解析;如携带,仅接受 application/json(可带 charset),其他取值返回 415。示例:application/json。
Idempotency-Keystring可选幂等键,最长 255 字节。同账户同键的重试只创建一次任务,重放返回首次 taskId。
网络超时或客户端自动重试时,同键只创建一次任务、不会重复扣费(幂等范围 = API Key 所属账户)。建议用业务侧唯一标识做键(如 "order-42");同键重放返回首次 taskId,键在首次提交 24 小时后过期。详细的场景矩阵见统一异步接口介绍页。
请求体
modelstring必填当前固定值:heygen-avatar-iv
routestring可选当前固定值:default
inputobject必填
heygen-avatar-iv 和线路 default 的业务参数对象,见下方参数表。
voicestring可选默认值: "Warm Pro Narrator"minLength 1Voice used to speak the script. Ignored when audio_url is present.
Warm Pro NarratorChill BrianIvyJohn DoeMonika SogamHope Archer Brittney显示全部(94 项)
PatrickDavid CastlemoreMichael CAdam Stone JuniperCassidy Jessica Anne BogartArabellaAndrewSpuds Oxley Grace ElderHelenCanyon RiversDerya - Lifelike - ExcitedMellow MarcusJack Sterling - BroadcasterBrenda - UGC - 1.mp4ReidReaganTerryJennyRadio RickDeniseTim in car - ExcitedIskanderThompsonDelicate Daisy - ExcitedKingstonGeorge UGC 1Bold BlakeJaneExpressive EvanMarianne - IAAaronModern Recipe Host - Voice 1WillowCute Chloe - FriendlyRafaelJune - LifelikeCrisp ChloeSlick SimonNassim - InformativeBaritone BenMaxwellEllie Faye - ExcitedMilaniFeisty Fiona - ExcitedProfessor DeanRose - UGC - 1.mp4ShonaHudson WilderAnn - IAAlastair KensingtonOxleyChristinaAndrew Rizz PeytonGerardo - OutdoorChloe - LifelikeStephanieAnthony - IASignal - Voice 1LucaLisa - Voice 1T.W.TuckerJack Sullivan - SeriousWinterMireia - LifelikeGeorgiaStellaMasha - LifelikeCharming Charles - FriendlySerenityAnnie - ExcitedRalphBethanyDominicMason FinnLeenaVeteran VictorTamaraNik PublicCalm ChloeSevikReillyRaulImposing IanRelaxed RayDexter - ProfessionalRelaxed RickEdwinRupert BlackwoodGinnyHopepromptstring可选minLength 1maxLength 5000Text the avatar will speak. Required when audio_url is absent.
audio_urlstring可选pattern ^https://HTTPS audio URL for lip-sync, at most 600 seconds. When present, prompt and voice are ignored.
image_urlstring必填pattern ^https://HTTPS URL of the photo to animate. It must contain one clear, front-facing face. jpg, jpeg, png, webp, gif, avif, heic, heif.
backgroundobject可选
Fills the frame area not covered by the portrait when the output aspect ratio differs from the photo. color takes a #RRGGBB hex value; image takes an HTTPS image URL. Defaults to white.
typestring必填colorimagevaluestring必填minLength 1resolutionstring可选默认值: "720p"720p1080paspect_ratiostring可选默认值: "16:9"auto keeps the source photo ratio when it can be read, otherwise 16:9.
16:99:164:55:41:1autocallbackobject可选
终态通知配置;为空则不回调,由调用方自行查询。详见下方回调说明。
创建任务时提供 callback.url,任务终态时 HiAPI 主动 POST 通知你的服务,可免去轮询。回调请求体与任务详情数据结构同构;签名校验、投递重试与幂等说明见统一异步接口介绍页的回调说明。
urlstring必填callback 存在时必填;任务终态后向该 URL 发起 POST,须为合法 http(s) URL。
whenstring可选默认值: "final"当前仅支持 final,即 success / fail 均回调。
finalstoragestring可选默认值: "temp"产物存储档位:temp(默认,保留约 7 天)或 persistent(长期保存,按大小计费)。余额不足或超出存储上限会静默降级为 temp;实际生效档位见任务详情响应。
temppersistent请求示例
# 提交异步任务,成功立即返回 taskId(不等待生成完成)
curl -X POST "https://api.hiapi.ai/v1/tasks" \
-H "Authorization: Bearer $HIAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "heygen-avatar-iv",
"input": {
"voice": "Warm Pro Narrator",
"image_url": "…",
"resolution": "720p",
"aspect_ratio": "16:9"
}
}' const res = await fetch("https://api.hiapi.ai/v1/tasks", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.HIAPI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "heygen-avatar-iv",
input: {
"voice": "Warm Pro Narrator",
"image_url": "…",
"resolution": "720p",
"aspect_ratio": "16:9"
}
}),
});
const task = await res.json();
// { code: 200, message: "success", data: { taskId } } import os, requests
res = requests.post(
"https://api.hiapi.ai/v1/tasks",
headers={"Authorization": f"Bearer {os.environ['HIAPI_API_KEY']}"},
json={
"model": "heygen-avatar-iv",
"input": {
"voice": "Warm Pro Narrator",
"image_url": "…",
"resolution": "720p",
"aspect_ratio": "16:9"
}
},
)
print(res.json()) # { code, message, data: { taskId } } 200 OK
{
"code": 200,
"message": "success",
"data": {
"taskId": "tk-hiapi-01HZTQ8BX2N3GM3YFK4Z9D7VQR"
}
} 400 Bad Request
{
"code": 400,
"message": "invalid request",
"data": null,
"error_code": "INVALID_REQUEST"
} 获取任务详情
https://api.hiapi.ai/v1/tasks/:id 响应字段
taskIdstring必填任务 ID,前缀固定 tk-hiapi-。
modelstring必填解析后的模型全名。用 route 参数提交的任务返回 base@线路(如 gpt-image-2/text-to-image@ext);否则与创建时传入的模型名一致。
routestring可选仅当任务用显式 route 参数提交时出现,回显提交时的原值。
statusstring必填任务状态。
queued 已入队,尚未开始。
handling 处理中。
archiving 处理完成,产物准备中。
success 终态:完成,产物可用(返回 output)。
fail 终态:失败(返回 error)。
提交后按 status 判断:success 或 fail 为终态,其余为非终态,建议按 1~3 秒间隔轮询直至终态。成功终态后从 output[].url 下载产物,并在 expireAt 前完成下载或转存;需要长期保留时在创建任务时使用 storage: "persistent"。
creatednumber必填任务创建时间(Unix 秒)。
completednumber必填进入终态的 Unix 秒;非终态固定为 0。
outputarray可选
仅 status == success 时出现。产物列表,始终为数组,同一任务可能同时返回多个 type(如 video + first_frame)。
Array [ object ]
数组元素
urlstring必填资源 URL,可直接下载。
typestring必填当前可能值:video、image、audio、first_frame、last_frame、thumbnail,后续可能会扩展。
expireAtnumber必填资源可访问截止时间(Unix 秒);过期前请完成下载或转存。
errorobject可选
仅 status == fail 时出现。
codestring必填业务错误码。
messagestring必填错误描述。
响应示例
成功
{
"code": 200,
"message": "success",
"data": {
"taskId": "tk-hiapi-01HZTQ8BX2N3GM3YFK4Z9D7VQR",
"model": "happyhorse-1-0",
"status": "success",
"created": 1777282033,
"completed": 1777282099,
"output": [
{
"url": "https://cdn.hiapi.ai/tasks/.../video.mp4",
"type": "video",
"expireAt": 1777886899
}
]
}
} 处理中(非终态)
{
"code": 200,
"message": "success",
"data": {
"taskId": "tk-hiapi-...",
"model": "happyhorse-1-0",
"status": "archiving",
"created": 1777282033,
"completed": 0
}
} 失败
{
"code": 200,
"message": "success",
"data": {
"taskId": "tk-hiapi-...",
"model": "happyhorse-1-0",
"status": "fail",
"created": 1777282033,
"completed": 1777282099,
"error": {
"code": "TASK_FAILED",
"message": "task failed"
}
}
}