15 分钟上手 Tripo API,生成你的第一个 3D 模型。
1
获取 API Key
前往 API 密钥 页面,创建一个新密钥并复制。请安全保管——它只显示一次。
安全提示:
将 API Key 存储在环境变量中(export TRIPO_API_KEY="sk-...")。切勿在源码中硬编码或提交到代码仓库。2
发送第一个请求
通过文本描述生成 3D 模型。所有生成 API 都是异步的——响应会立即返回一个 task_id。
-cmd">curl -X POST https://openapi.tripo3d.ai/v3/generation/text class="hl-flag">-to-model \
-H "Content-Type: application/json" \
-H "Authorization: Bearer " \
-d '{
"prompt": "a cute cat",
"model": "v3.1-20260211"}' 200响应 — 200 OK
{
"code": 0,
"data": {
"task_id": "task_abc123"}
}3
查询任务结果
使用 task_id 轮询直到 status: "success"。每 2 秒轮询一次,典型生成耗时 10–120 秒。
-cmd">curl -X GET https://openapi.tripo3d.ai/v3/tasks/{task_id} \
-H "Authorization: Bearer " 200响应 — 任务完成
{
"code": 0,
"data": {
"task_id": "task_abc123",
"type": "text_to_model",
"status": "success",
"progress": 100,
"output": {
"model_url": "https://...",
"rendered_image_url": "https://..."}
}
}4
下载模型
从响应中的 output.model_url 下载 GLB 3D 模型文件,可以直接在以下工具中使用:
BlenderUnityUnreal EngineThree.jsBabylon.jsmodel-viewer
注意:
模型 URL 在 5 分钟后过期,任务成功后请立即下载。从 output.model_url 获取 3D 模型文件。进阶工作流
探索面向特定使用场景和功能的完整 API 流水线。
游戏就绪角色
生成带骨骼和动画的低面数角色,可直接导入 Unity/Unreal Engine。
调用时序
你的应用
Tripo API
1POSTimage-to-model
task_id
POLLGET tasks/{task_id} → until success
2POSTrig-check
riggable: true, rig_type: "biped"
3POSTrig
New task_id for rigged model
POLLGET tasks/{task_id} → until success
4POSTretarget
task_id with animated model URLs
POLLGET tasks/{task_id} → until success
API 数据流
POST
image-to-model
image-to-model
POST
rig-check
rig-check
POST
rig
rig
POST
retarget
retarget
1
POST /v3/generation/image-to-model
输入
Image URL or file_token
输出
task_id
Poll GET /v3/tasks/{task_id} until status=success
2
POST /v3/animations/rig-check
输入
{ input: "task_abc123" }
输出
riggable: true, rig_type: "biped"
If riggable=true, pass task_id + rig_type to rig
3
POST /v3/animations/rig
输入
{ input: "task_abc123", rig_type: "biped" }
输出
New task_id for rigged model
Poll until success, pass rigged task_id to retarget
4
POST /v3/animations/retarget
输入
{ input: "task_rig456", animations: [...] }
输出
task_id with animated model URLs
Download output.model_urls
关键参数
| 参数 | 值 | 说明 |
|---|---|---|
model | P1-20260311 | 面向游戏资产优化的低多边形拓扑模型 |
face_limit | 5000 | 控制最大面数预算,适用于移动端与实时游戏场景 |
texture | true | 提升角色模型的视觉保真度 |
rig_type | biped | 适用于人形角色骨骼绑定 |
spec | mixamo | 兼容 Unity / Unreal 导入 |
animations | preset:walkpreset:idlepreset:run | 预设基础角色动作集 |
预计耗时
~105s
消耗积分
~85
import requests, time
HEADERS = {"Authorization": "Bearer " , "Content-Type": "application/json"}
def poll(task_id):
while True:
r = requests.get(f"https://openapi.tripo3d.ai/v3/tasks/{task_id}", headers=HEADERS).json()
if r["data"]["status"] == "success": return r["data"]
if r["data"]["status"] in ("failed","cancelled"): raise Exception(r["data"])
time.sleep(2)
# Step 1 — Generate model
task_id = requests.post("https://openapi.tripo3d.ai/v3/generation/image-to-model",
headers=HEADERS, json={"file_token":"" ,"model":"P1-20260311","face_limit":5000}
).json()["data"]["task_id"]
poll(task_id)
# Step 2 — Rig check
rig_type = requests.post("https://openapi.tripo3d.ai/v3/animations/rig-check",
headers=HEADERS, json={"input": task_id}).json()["data"]["rig_type"]
# Step 3 — Rig
rig_id = requests.post("https://openapi.tripo3d.ai/v3/animations/rig",
headers=HEADERS, json={"input":task_id,"rig_type":rig_type,"spec":"mixamo"}
).json()["data"]["task_id"]
poll(rig_id)
# Step 4 — Retarget animations
anim_id = requests.post("https://openapi.tripo3d.ai/v3/animations/retarget",
headers=HEADERS, json={"input":rig_id,"animations":["preset:walk","preset:idle","preset:run"]}
).json()["data"]["task_id"]
result = poll(anim_id)
print("Animated GLBs:", result["output"]["model_urls"])开发者提示
- •调用绑骨前务必先调 rig-check,它会返回推荐的 rig_type 并避免失败
- •每 2 秒轮询一次任务状态,不超过 1 次/秒以避免限流
- •Unity/Unreal 请用 spec: "mixamo";自定义流水线用 spec: "tripo"
常见问题
- •如果 rig-check 返回 riggable=false,尝试用更干净的提示词重新生成(避免复杂姿势)
- •retarget 只接受绑骨模型的 task_id——传入原始生成的 task_id 会失败