hintstring
Optional text naming the parts you want.
tripo3d/tripo/smart-segmentTripo Smart Segment splits an image or a 3D model into named semantic parts, returning a segmented 3D model and a part mask.
试用该模型
PNG、JPEG、WebP 或 GIF · 最大 20 MiB
您的输出将显示在这里
完成输入,然后点击运行。
Tripo Smart Segment splits an image or a 3D model into named semantic parts, returning a segmented 3D model and a part mask.
| Field | Type | Default | Notes |
|---|---|---|---|
seg_type | image / model, required | image | image segments an image and builds a segmented 3D model; model segments an existing GLB. |
image | string | — | Input image when seg_type is image. |
model_url | string | — | Input GLB when seg_type is model. |
granularity | coarse / medium / fine | medium | How finely to split. |
hint | string | — | Optional text naming the parts you want. |
transform | array | — | Model transform as a column-major 4x4 matrix (16 numbers). Used when seg_type is model; identity when unset. |
url: Segmented GLB, one node per part.mask: Part mask image.parts: Comma-separated part names.| seg_type | Price |
|---|---|
| image | $0.85 |
| model | $0.55 |
| Failed runs are not charged. |
开始构建
选择任一受支持的 API,使用统一身份验证和使用情况跟踪。
# The quoted heredoc keeps Unicode and shell metacharacters unchanged.
result=$(curl --fail-with-body --silent \
-X POST "https://api.sandbase.ai/v1/run" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @- <<'SANDBASE_JSON'
{
"model": "tripo3d/tripo/smart-segment",
"image": "https://static.sandbase.ai/examples/tencent/hunyuan-3d/v3/input_image_0.png",
"seg_type": "image",
"model_url": "https://static.sandbase.ai/examples/tripo3d/tripo/shared/object.glb",
"granularity": "medium"
}
SANDBASE_JSON
)
run_id=$(printf '%s' "$result" | jq -r .id)
for attempt in $(seq 1 120); do
status=$(printf '%s' "$result" | jq -r .status)
case "$status" in completed|failed|timeout) break ;; esac
sleep 2
result=$(curl --fail-with-body --silent \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
"https://api.sandbase.ai/v1/run/$run_id")
done
status=$(printf '%s' "$result" | jq -r .status)
[ "$status" = completed ] || { echo "Generation ended: $status" >&2; exit 1; }
printf '%s\n' "$result"创建一个 SandBase API 密钥,并将其设置到服务器环境中。所有请求都使用 Bearer 身份验证。
export SANDBASE_API_KEY="YOUR_API_KEY"请将密钥保存在服务器端。不要在浏览器代码中暴露它,也不要提交到仓库。
使用此模型 ID 及其输入向 /v1/run 发送 POST 请求。上方的请求示例包含提交和轮询。
使用返回的运行 ID 轮询,直到状态为 completed、failed 或 timeout。仅在 completed 后读取输出。
curl "https://api.sandbase.ai/v1/run/$RUN_ID" \
-H "Authorization: Bearer $SANDBASE_API_KEY"在模型的 image、video 或 audio 字段中传入一个可公开访问的文件 URL。支持的格式和限制显示在每个 Playground 输入项旁边。
在 Playground 中支持的图片字段上使用上传或替换控件。视频 URL 字段接受托管的 driving video;这并不表示支持视频上传。
hintstringOptional text naming the parts you want.
imagestringInput image when seg_type is image.
seg_typestring必填image segments an image and builds a segmented 3D model; model segments an existing GLB.
默认值:"image"
可选值:"image", "model"
model_urlstringInput GLB when seg_type is model.
transformarrayModel transform as a column-major 4x4 matrix (16 numbers). Used when seg_type is model; identity when unset.
granularitystringHow finely to split.
默认值:"medium"
可选值:"coarse", "medium", "fine"
{
"model": "tripo3d/tripo/smart-segment",
"image": "https://static.sandbase.ai/examples/tencent/hunyuan-3d/v3/input_image_0.png",
"seg_type": "image",
"model_url": "https://static.sandbase.ai/examples/tripo3d/tripo/shared/object.glb",
"granularity": "medium"
}已完成的运行会在输出中展示结果。以下内容是该模型保存的示例,而不是新的生成结果。
尚未发布示例输出。请在运行完成后使用 Playground → Result → JSON 查看响应。
此模型也通过 Tripo 的 v3 API 提供。请求体、任务对象和错误码都遵循 Tripo,因此只要将 base URL 改为 https://api.sandbase.ai/tripo/v3 并以 Authorization: Bearer 发送 SandBase API key,现有 Tripo 代码即可继续工作。请求会通过 Tripo 官方通道运行,价格与 /v1/run 相同。
POST https://api.sandbase.ai/tripo/v3/mesh/smartsegment。model 是可选项,用于选择 Tripo 算法版本;省略时会使用 Tripo 的默认版本。上方 Tripo v3 API 下的请求示例展示了完整调用。
Tripo 对这些输入的命名与下面的 Schema 不同。其他所有字段都保持原名。
| Schema 字段 | Tripo 字段 |
|---|---|
model_url | input |
image | input |
输入为公开 URL,可以是字符串,也可以是带有 url 字段的对象。目前不接受 Tripo 任务 id 和 file_token 值,不支持文件上传,webhook_url 会被忽略。
提交后返回 data.task_id。持续轮询,直到 data.status 为 success、failed 或 cancelled。成功时,data.output 使用 Tripo 字段名,例如 model_url,credits_consumed 是 SandBase 的扣费,1 credit = $0.01。
curl "https://api.sandbase.ai/tripo/v3/tasks/$TASK_ID" \
-H "Authorization: Bearer $SANDBASE_API_KEY"带有 {"task_ids": [...]} 的 POST /tripo/v3/tasks/list 最多返回 100 个任务。GET /tripo/v3/account/balance 返回你在 SandBase 的 credits 余额。
错误使用 Tripo 的响应封装:{"code": 1004, "status": "error", "message": "..."}。
| code | 含义 |
|---|---|
2 / 1002 | 缺少、无效或未授权的 SandBase API key |
1003 | 请求体不是 JSON 对象 |
1004 | 缺少或无效的参数。消息会注明 Tripo 字段名 |
1007 / 2000 | 达到速率限制或并发限制 |
2001 | 未找到任务,或该任务是用另一个 API key 创建的 |
2002 | SandBase 不支持该端点或功能 |
2010 | SandBase 余额不足或已达到 API key 消费限额 |
4001 | 未知端点 |
当 Tripo 拒绝或失败一个任务时,它会以 failed 结束,并带有 Tripo 的 error_code 和 error_message。与你的请求或内容相关的代码会原样透传;与上游 Tripo 账户相关的代码会报告为 1000。