前提条件
- 开通服务:前往千问AI平台控制台,搜索“Tripo”,找到Tripo模型卡片,单击立即开通,在弹窗内确认开通及授权。
- 配置 API Key:获取与配置 API Key,再配置API Key到环境变量。
- 准备前序任务:先通过Tripo-自动绑骨创建任务(
spec不能为mixamo),待任务执行成功后,将其task_id传入original_model_task_id。
HTTP调用
API采用异步调用。整个流程包含 "创建任务 -> 轮询获取" 两个核心步骤,具体如下:
步骤1:创建任务获取任务ID
POST https://maas.qianwenaiapi.com/api/v1/services/aigc/video-generation/3d-generation
- 创建成功后,使用接口返回的
task_id查询结果,task_id 有效期为 24 小时。请勿重复创建任务,轮询获取即可。 - 新手指引请参见Postman。
请求参数请求头(Headers)Content-Typestring(必选)请求内容类型。此参数必须设置为application/json。Authorizationstring(必选)请求身份认证。接口使用千问AI平台API Key进行身份认证。示例值:Bearer sk-xxxx。X-DashScope-Asyncstring(必选)异步处理配置参数。HTTP请求只支持异步,必须设置为enable。缺少此请求头将报错:“current user api does not support synchronous calls”。 请求体(Request Body)modelstring (必选)模型名称。固定值:Tripo/Tripo-AnimationRetarget。input object (必选)输入信息。
属性 original_model_task_id string (必选)前序任务ID。仅支持Tripo-自动绑骨任务,传入该任务创建时返回的task_id,系统会自动使用该任务输出的已绑骨模型。
object (可选)动画重定向参数。
属性 animations array[string] (条件必填)预设动画名称列表,最多5个,按动画个数计费。与animation互斥,只能二选一。每个元素须为带preset:前缀的预制动画名称(如preset:walk),区分大小写。不在列表中的名称在创建任务时返回400错误,不扣费。完整的动画名称请参见动画名称列表。animation string (条件必填)单个预设动画名称,取值要求与animations相同。与animations互斥,只能二选一。此参数为旧版参数,计为1个动画,计费与animations只传1个动画时相同。out_format string (可选)输出格式。默认值为glb。可选值:
boolean (可选)是否烘焙动画。该参数已废弃,传入不会报错,也不会生效或计费,仅为向后兼容保留,无需传入。export_with_geometry boolean (可选)导出时是否包含几何体。默认值为true。animate_in_place boolean (可选)是否原地播放动画。默认值为false。设为true时,模型在动画中不产生位移。 |
|
响应参数outputobject任务输出信息。
属性 task_id string任务ID。查询有效期24小时。task_status string任务状态。
枚举值
string请求唯一标识。可用于请求明细溯源和问题排查。codestring请求失败的错误码。请求成功时不会返回此参数,详情请参见错误码。messagestring请求失败的详细信息。请求成功时不会返回此参数,详情请参见错误码。 |
请保存 task_id,用于查询任务状态与结果。 |
步骤2:根据任务ID查询结果
GET https://maas.qianwenaiapi.com/api/v1/tasks/{task_id}
请求参数请求头(Headers)Authorizationstring(必选)请求身份认证。接口使用千问AI平台API Key进行身份认证。示例值:Bearer sk-xxxx。URL路径参数(Path parameters)task_idstring(必选)任务ID。 |
将 {task_id}完整替换为上一步接口返回的task_id的值。task_id查询有效期为24小时。 |
响应参数outputobject任务输出信息。
属性 task_id string任务ID。查询有效期24小时。task_status string任务状态。
枚举值
string任务提交时间。格式为 YYYY-MM-DD HH:mm:ss.SSS。scheduled_time string任务执行时间。格式为 YYYY-MM-DD HH:mm:ss.SSS。end_time string任务完成时间。格式为 YYYY-MM-DD HH:mm:ss.SSS。resultsarray重定向结果列表。仅在 task_status 为 SUCCEEDED 时返回。各URL均为带签名的临时链接,有效期2小时,请及时下载。
属性 model_url string重定向后3D模型的URL。string请求失败的错误码。请求成功时不会返回此参数,详情请参见错误码。messagestring请求失败的详细信息。请求成功时不会返回此参数,详情请参见错误码。object输出信息统计。仅在任务成功时返回,任务失败时不返回。
属性 3d_task_type string任务类型。动画重定向固定为animation-retarget。credits_consumed integer本次任务消耗的积分,按动画数量计费。动画数量为animations中非空元素的个数;使用animation时计为1个动画。 |
|
动画名称列表
以下为parameters.animations和parameters.animation参数的可选值。名称须带preset:前缀,区分大小写。
常用动画
preset:idle:待机preset:walk:行走preset:run:奔跑preset:jump:跳跃preset:climb:攀爬preset:dive:俯冲preset:slash:挥砍preset:shoot:射击preset:hurt:受击preset:fall:跌落preset:turn:转身
非人形骨骼
非人形骨骼仅支持以下名称,写法为preset:<体型>:<动作>。
- 四足(
quadruped):preset:quadruped:walk、preset:quadruped:catwalk - 水生(
aquatic):preset:aquatic:march - 蛇形(
serpentine):preset:serpentine:march - 六足(
hexapod):preset:hexapod:walk - 八足(
octopod):preset:octopod:walk
人形骨骼
人形骨骼(biped)的动作名有两种等价写法:preset:<动作>或preset:biped:<动作>,例如preset:walk与preset:biped:walk效果相同。
preset:afraid、preset:agree、preset:angry_01、preset:angry_02、preset:angry_03preset:basketball_shot、preset:blade_wraparound_test、preset:bow、preset:box_01、preset:box_02、preset:box_03preset:cast_a_spell、preset:cheer、preset:chop、preset:clap、preset:climb、preset:complain_01、preset:complain_02、preset:cpr、preset:cross_body_crunch、preset:crossover_dribble、preset:crypreset:dance_01、preset:dance_02、preset:dance_03、preset:dance_04、preset:dance_05、preset:dance_06、preset:defeat_02、preset:defeat_03、preset:depressed、preset:dig、preset:dive、preset:dribblepreset:fall、preset:fire、preset:flee_01、preset:flee_02、preset:flip、preset:fold_arms、preset:football_catch、preset:football_pass、preset:football_save、preset:freaky、preset:frightened、preset:front_kick_01、preset:front_kick_02、preset:frustrated_01、preset:frustrated_02preset:golf、preset:greet_01、preset:greet_02、preset:greet_03、preset:greet_04preset:heart_pose、preset:hit_to_body_01、preset:hit_to_body_02、preset:hit_to_head、preset:hit_to_side、preset:hit_to_stomach、preset:hug、preset:hurtpreset:idlepreset:jump、preset:jump_down、preset:jump_rope_01、preset:jump_rope_02preset:laugh_01、preset:laugh_02、preset:lift_heavy、preset:look_aroundpreset:make_a_call_01、preset:make_a_call_02preset:pitch_baseball、preset:play_mobile_game、preset:play_video_game、preset:press-uppreset:run、preset:run_upstairspreset:scared_01、preset:scared_02、preset:scratch、preset:shoot、preset:shovel、preset:sing_01、preset:sing_02、preset:sing_03、preset:sing_04、preset:sit、preset:slash、preset:sob、preset:standing_relax、preset:surf、preset:swagger、preset:swim、preset:sword_judgment_testpreset:turnpreset:victory_celebration、preset:volleyballpreset:wait、preset:walk、preset:warm_up、preset:wave_goodbye_01、preset:wave_goodbye_02
错误码
如果模型调用失败并返回报错信息,请参见错误信息进行解决。
其他接口
鉴权
string
header
必填
Header 参数
enum<string>
必填
(必选)
异步处理配置参数。HTTP请求只支持异步,必须设置为enable。
缺少此请求头将报错:“current user api does not support synchronous calls”。
enable