# 3D 打印检查与修复（Preview）

**Base URL:** `https://openapi.tripo3d.ai/v3`

**Endpoint:** `POST /mesh/print-autofix`

**预览版说明：**3D 打印检查与修复当前处于公开预览（Preview）阶段，接口能力、输出字段及计费规则在正式版发布前可能调整。
检查 3D 模型的可打印性（水密性、非流形几何、小于 1 毫米的薄壁占比），并可按需自动修复网格几何（type: autofix_3d_printer）。计费说明- **只检查（autofix_3d_printer 不传或 false）：****免费**（不预扣、无账单记录）。
- **修复（autofix_3d_printer=true），终态输出包含 model_url：****10 积分**（× 账号折扣）。
- **修复（autofix_3d_printer=true），终态输出无 model_url（原模型已可打印或无法修复出新模型）：****全额退回**（预扣的 10 积分自动取消退回；任务状态仍为 success，任务查询中 credits_consumed 省略，用量明细与 Webhook 中为 0）。
- **提交失败、任务失败或过期：****全额退回**。

错误码- 400 / 1004 缺少 input：input is required for autofix_3d_printer (task_id, file_token, or URL)
- 400 / 1004 input 格式不合法：invalid input: must be a valid task_id (UUID), file_token, or URL
- 400 / 1004 max_size_3d_printer 非法：max_size_3d_printer must be a positive number of millimeters, got 0.0
- 400 / 1004 autofix_3d_printer 非布尔值：autofix_3d_printer must be a boolean, got true
- 400 / 1004 model 非 default：invalid model for autofix_3d_printer; allowed: default
- 400 / 1004 源模型扩展名不支持或为大写：print autofix source model must use a lowercase extension glb, fbx, stl, ply, obj, usd or usdz, got model.gltf
- 400 / 1004 原任务没有模型产物：original task has no model output
- 404 / 2001 原任务不存在或不属于当前 API Key：The task is not found
- 400 / 2007 原任务未处于成功状态：The original task is not a succeeded task
- 400 / 2006 原任务产物已过期（超出 7 天资产保留期）：Task output files have expired
鉴权失败、余额不足（403 / 2010）、限流（429 / 2000）以及外部模型导入失败（400 / 2006）等通用错误请参考 [错误处理](https://developers.tripo3d.ai/zh/docs/error-handling)。



## Request Parameters

### input

- **Type:** string
- **Required:** 必选

模型来源，接受以下三种格式之一：**任选以下一种格式传入。**传入 `file_token` 或 `URL` 时，服务端会先同步导入模型再提交处理（导入步骤不额外计费，请求响应时间会相应增加）。

- task_id（UUID）：当前账号下已成功且包含模型产物的任务 ID（须处于 7 天资产保留期内，已过期返回 `400 / 2006`）。
示例： `00000000-0000-0000-0000-000000000001`
- file_token：通过 [POST /v3/files](https://developers.tripo3d.ai/zh/docs/files) 上传模型后获得的令牌。
示例： `file_<your-upload-token>`
- URL：可公开访问的模型直链。
示例： `https://example.com/models/sample.glb`



- 源文件扩展名必须为小写的 `glb`、`fbx`、`stl`、`ply`、`obj`、`usd` 或 `usdz`（不支持大写扩展名或 `.gltf`）。

### model

- **Type:** string
- **Required:** 可选
- **Default:** `default`

处理模型版本，仅支持 `default`；传入其他值返回 `400 / 1004`。
### autofix_3d_printer

- **Type:** boolean
- **Required:** 可选
- **Default:** `false`

是否执行自动修复。`false` 仅做可打印性检查（免费）；`true` 执行网格修复（预扣 10 积分，仅当产出修复后新模型时确认扣费，否则全额退回）。

必须为布尔值，放在 `parameters` 中同样校验。
### max_size_3d_printer

- **Type:** number
- **Required:** 必选

模型目标最长边尺寸，单位毫米（mm）。仅用于按比例判定小于 `1 mm` 的薄壁区域，**不会缩放**返回的模型尺寸。

必须为大于 `0` 的有限数字（不能为布尔值）。放在 `parameters` 中同样校验。

## Response Fields

### printable.watertight

- **Type:** boolean
- **Required:** 必选

模型是否水密（所有部件均水密时为 `true`）。
### printable.non_manifold

- **Type:** integer
- **Required:** 必选

非流形顶点数与非流形边数之和（全部件合计；无非流形问题时为 `0`）。
### printable.thinwall_ratio

- **Type:** number
- **Required:** 必选

厚度小于 `1 mm` 的表面积占比（区间 `[0, 1]`）。当模型不水密、无法计算壁厚时固定返回 `-1`。
### model_url

- **Type:** string
- **Required:** 可选

修复后模型的签名下载链接。仅当 `autofix_3d_printer=true` 且修复确实产出了新模型文件时出现；只检查、原模型已可打印无需修改、或模型无法修复时均不返回该字段。

## Request Example

### 仅检查已有任务（免费）

```bash
curl --request POST \
  --url https://openapi.tripo3d.ai/v3/mesh/print-autofix \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "input": "00000000-0000-0000-0000-000000000001",
  "model": "default",
  "autofix_3d_printer": false,
  "max_size_3d_printer": 100
}'
```

### 使用 file_token 执行修复（最多 10 积分）

```bash
curl --request POST \
  --url https://openapi.tripo3d.ai/v3/mesh/print-autofix \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "input": "file_<your-upload-token>",
  "autofix_3d_printer": true,
  "max_size_3d_printer": 100
}'
```

### 使用模型 URL 执行修复（最多 10 积分）

```bash
curl --request POST \
  --url https://openapi.tripo3d.ai/v3/mesh/print-autofix \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "input": "https://example.com/models/sample.glb",
  "autofix_3d_printer": true,
  "max_size_3d_printer": 120
}'
```


## Response Example

### 创建任务

```json
{
  "code": 0,
  "status": "success",
  "data": {
    "task_id": "00000000-0000-0000-0000-000000000002",
    "type": "autofix_3d_printer",
    "status": "queued"
  }
}
```

### 仅检查结果（免费）

```json
{
  "code": 0,
  "status": "success",
  "data": {
    "task_id": "00000000-0000-0000-0000-000000000002",
    "type": "autofix_3d_printer",
    "status": "success",
    "progress": 100,
    "input": {
      "original_model_id": "00000000-0000-0000-0000-000000000001",
      "model_version": "default",
      "autofix_3d_printer": false,
      "max_size_3d_printer": 100.0
    },
    "output": {
      "printable": {
        "watertight": true,
        "non_manifold": 0,
        "thinwall_ratio": 0.000005
      }
    },
    "created_at": "2026-12-01T00:00:00Z",
    "completed_at": "2026-12-01T00:00:18Z"
  }
}
```

### 修复成功且产出新模型（扣 10 积分）

```json
{
  "code": 0,
  "status": "success",
  "data": {
    "task_id": "00000000-0000-0000-0000-000000000003",
    "type": "autofix_3d_printer",
    "status": "success",
    "progress": 100,
    "input": {
      "original_model_id": "00000000-0000-0000-0000-000000000001",
      "model_version": "default",
      "autofix_3d_printer": true,
      "max_size_3d_printer": 100.0
    },
    "output": {
      "printable": {
        "watertight": true,
        "non_manifold": 0,
        "thinwall_ratio": 0.000005
      },
      "model_url": "https://cdn.example.com/output/repaired.glb"
    },
    "created_at": "2026-12-01T00:01:00Z",
    "completed_at": "2026-12-01T00:01:42Z",
    "credits_consumed": 10.00,
    "cost_amount": "0.10",
    "currency": "USD",
    "files_expired": false,
    "files_expire_at": "2026-12-09T00:00:00Z"
  }
}
```

### 修复完成但未产出新模型（已全额退回）

```json
{
  "code": 0,
  "status": "success",
  "data": {
    "task_id": "00000000-0000-0000-0000-000000000004",
    "type": "autofix_3d_printer",
    "status": "success",
    "progress": 100,
    "input": {
      "original_model_id": "00000000-0000-0000-0000-000000000001",
      "model_version": "default",
      "autofix_3d_printer": true,
      "max_size_3d_printer": 100.0
    },
    "output": {
      "printable": {
        "watertight": false,
        "non_manifold": 3,
        "thinwall_ratio": -1
      }
    },
    "created_at": "2026-12-01T00:02:00Z",
    "completed_at": "2026-12-01T00:02:15Z"
  }
}
```
