# Tripo3D H3.1 图生 3D > 将单张图像转换为高度详细的 3D 模型,支持选择纹理质量和可选四边形拓扑。非常适合产品可视化、游戏道具和适合动画的资产。 ## 概览 - **端点**: `POST https://api.muapi.ai/api/v1/tripo3d-h31-image-to-3d` - **模型 ID**: `tripo3d-h31-image-to-3d` - **类别**: image to 3d - **变体**: Tripo3D H3.1 Image to 3D - **系列**: tripo3d - **费用**: 每次调用 0.3 credits(部分模型会根据参数动态计算费用) ## API 使用 MuApi 使用**提交后轮询**模式:提交任务,获取 `request_id`,然后轮询预测端点,直到 `status` 为 `completed`。也可以在提交请求中传入 `?webhook=YOUR_URL`,任务完成后接收 POST 回调(无需轮询)。 **身份验证**:在 `x-api-key` 请求头中发送 MuApi 密钥。可在 https://muapi.ai/access-keys 获取。 ### 1. 提交任务 ```http POST https://api.muapi.ai/api/v1/tripo3d-h31-image-to-3d Content-Type: application/json x-api-key: YOUR_API_KEY ``` **最小请求(仅必填参数):** ```json { "image_url": "https://example.com/your-image_url" } ``` **完整示例(全部参数):** ```json { "image_url": "https://example.com/your-image_url", "texture": true, "texture_quality": "standard", "geometry_quality": "standard", "pbr": false, "quad": false, "auto_size": false, "face_limit": "" } ``` **响应:** ```json { "request_id": "abc123", "status": "processing" } ``` ### 2. 轮询结果 ```http GET https://api.muapi.ai/api/v1/predictions/{request_id}/result x-api-key: YOUR_API_KEY ``` 可能的 `status` 值:`queued`、`pending`、`processing`、`completed`、`failed`、`cancelled`。每 2–5 秒轮询一次,直到进入终止状态。状态为 `completed` 时,结果 URL 位于 `outputs` 数组中。 **`completed` 状态的响应示例:** ```json { "id": "abc123", "status": "completed", "outputs": [ "https://cdn.muapi.ai/.../output.png" ], "urls": { "get": "https://api.muapi.ai/api/v1/predictions/abc123/result" }, "created_at": "2026-05-08T12:34:56Z", "has_nsfw_contents": [] } ``` ### cURL ```bash 1. 提交 REQUEST_ID=$(curl -s -X POST https://api.muapi.ai/api/v1/tripo3d-h31-image-to-3d \ -H "x-api-key: $MUAPI_API_KEY" \ -H "Content-Type: application/json" \ -d '{"image_url":"https://example.com/your-image_url"}' | jq -r .request_id) 2. 轮询直到完成 while :; do RESP=$(curl -s https://api.muapi.ai/api/v1/predictions/$REQUEST_ID/result -H "x-api-key: $MUAPI_API_KEY") STATUS=$(echo "$RESP" | jq -r .status) [ "$STATUS" = "completed" ] && echo "$RESP" | jq .outputs && break [ "$STATUS" = "failed" ] && echo "$RESP" && exit 1 sleep 3 done ``` ### Python ```python import os, time, requests API = "https://api.muapi.ai/api/v1" headers = {"x-api-key": os.environ["MUAPI_API_KEY"]} r = requests.post(f"{API}/tripo3d-h31-image-to-3d", headers=headers, json={"image_url":"https://example.com/your-image_url"}) request_id = r.json()["request_id"] while True: res = requests.get(f"{API}/predictions/{request_id}/result", headers=headers).json() if res["status"] == "completed": print(res["outputs"]); break if res["status"] == "failed": raise RuntimeError(res.get("error")); time.sleep(3) ``` ## 输入结构 API 接受以下输入参数: - **`image_url`** (`string`, _必填_): 用于生成 3D 模型的参考图像。 - **`texture`** (`boolean`, _可选_): 同时为网格生成纹理。 - 默认值: `true` - **`texture_quality`** (`string`, _可选_): 标准或详细纹理质量。 - 默认值: `"standard"` - 选项: `"standard"`, `"detailed"` - **`geometry_quality`** (`string`, _可选_): 详细几何会增加更细致的表面细节(+$0.20)。 - 默认值: `"standard"` - 选项: `"standard"`, `"detailed"` - **`pbr`** (`boolean`, _可选_): 启用基于物理的渲染材质。 - 默认值: `false` - **`quad`** (`boolean`, _可选_): 生成四边形拓扑网格(+$0.05)。 - 默认值: `false` - **`auto_size`** (`boolean`, _可选_): 自动缩放模型。 - 默认值: `false` - **`face_limit`** (`int`, _可选_): 目标多边形数量。 ## 输出结构 轮询端点会返回以下字段: - **`id`** (`string`): 请求 ID。 - **`status`** (`string`): 取值之一:`queued`、`pending`、`processing`、`completed`、`failed`、`cancelled`。 - **`outputs`** (`array`): 生成的图像、视频或音频 URL。`status` 为 `completed` 前为空。 - **`urls.get`** (`string`): 用于重新获取此预测结果的自身链接。 - **`error`** (`string` | `null`): `status` 为 `failed` 时的错误消息。 - **`created_at`** (`string`): 创建请求时的 ISO-8601 时间戳。 - **`has_nsfw_contents`** (`array of boolean`): 每个输出对应的 NSFW 检测标记。 ## Webhook(可选) 在提交 URL 后附加 `?webhook=https://your-server/path`。任务进入终止状态后,MuApi 会将与轮询响应相同结构的 POST 请求发送到你的 URL,无需轮询。 ## Agent 集成 MuApi 提供 MCP 服务器和 CLI,让 Agent(Claude Code、Cursor 或自定义 Agent)无需编写 HTTP 代码即可调用此端点: ```bash # 安装 CLI npm install -g muapi-cli # 完成一次身份验证 muapi auth login # 将所有 MuApi 模型作为 MCP 工具提供给 Agent muapi mcp serve ``` MCP 服务器为每个模型提供封装提交与轮询的工具,包括 `tripo3d-h31-image-to-3d`。使用 `muapi --help` 查看按类别划分的快捷命令(`muapi image generate`、`muapi video from-image` 等)。 ## 相关模型 - [Tripo3D P1 Text to 3D](https://muapi.ai/zh/playground/tripo3d-p1-text-to-3d) - [Tripo3D P1 Image to 3D](https://muapi.ai/zh/playground/tripo3d-p1-image-to-3d) - [Tripo3D H3.1 Text to 3D](https://muapi.ai/zh/playground/tripo3d-h31-text-to-3d) - [Tripo3D H3.1 Image to 3D](https://muapi.ai/zh/playground/tripo3d-h31-image-to-3d) - [Tripo3D H3.1 Multiview to 3D](https://muapi.ai/zh/playground/tripo3d-h31-multiview-to-3d) ## 资源 - [Playground 页面](https://muapi.ai/zh/playground/tripo3d-h31-image-to-3d) - [API 文档](https://muapi.ai/zh/playground/tripo3d-h31-image-to-3d/api) - [全站 llms.txt](https://muapi.ai/zh/llms.txt)