# モデル形式の変換
> **POST** `/v3/models/convert`
3D モデルを別の形式に変換します。
## リクエストパラメータ
### リクエストヘッダー
| パラメータ | 種類 | 必須 | デフォルト | 説明 |
| :-: | :-: | :-: | :-: | :-: |
| Content-Type | 文字列 | はい | - | `application/json` |
| Authorization | 文字列 | はい | - | `Bearer {api_key}` |
### リクエストボディ
#### 基本パラメータ
| パラメータ | 種類 | 必須 | デフォルト | 説明 |
| :-: | :-: | :-: | :-: | :-: |
| input | 文字列 | はい | - | モデルソース。 `task_` で始まる task_id または `file_` で始まる file_token を受け入れます |
| format | 文字列 | はい | - | ターゲット形式。使用可能な値: `GLTF`、`USDZ`、`FBX`、`OBJ`、`STL`、`3MF`。3MF:単色の3D。 |
#### メッシュオプション
| パラメータ | 種類 | 必須 | デフォルト | 説明 |
| :-: | :-: | :-: | :-: | :-: |
| quad | ブール値 | いいえ | `false` | クワッドの再メッシュ |
| force_symmetry | ブール値 | いいえ | `false` | 対称性を強制します。 `quad` が `true` の場合のみ有効 |
| face_limit | 整数 | いいえ | - | 最大ポリ数。省略した場合、元の面数が保持されます。 |
| flatten_bottom | ブール値 | いいえ | `false` | 底を平らにする |
| flatten_bottom_threshold | フロート | いいえ | `0.01` | 平坦化深さのしきい値 |
#### テクスチャオプション
| パラメータ | 種類 | 必須 | デフォルト | 説明 |
| :-: | :-: | :-: | :-: | :-: |
| texture_size | 整数 | いいえ | `4096` | 拡散テクスチャ サイズ (ピクセル単位) |
| texture_format | 文字列 | いいえ | `JPEG` | テクスチャ形式。使用可能な値: `BMP`、`DPX`、`HDR`、`JPEG`、`PNG`、`TARGA`、`TIFF`、`WEBP` |
| bake | ブール値 | いいえ | `true` | 高度なマテリアルをベース テクスチャにベイク処理する |
| pack_uv | ブール値 | いいえ | `false` | すべての UV を統一レイアウトにパックする |
| export_vertex_colors | ブール値 | いいえ | `false` | 頂点カラーを含めます。 `OBJ` および `GLTF` 形式にのみ有効です |
#### エクスポートオプション
| パラメータ | 種類 | 必須 | デフォルト | 説明 |
| :-: | :-: | :-: | :-: | :-: |
| pivot_to_center_bottom | ブール値 | いいえ | `false` | ピボットを中央下に移動します |
| scale_factor | フロート | いいえ | `1` | スケールファクター |
| with_animation | ブール値 | いいえ | `true` | スケルトンとアニメーション データを含める |
| animate_in_place | ブール値 | いいえ | `false` | インプレイスアニメーション |
| part_names | 文字列[] | いいえ | - | メッシュ/segmentデータからエクスポートするパーツの名前 |
| export_orientation | 文字列 | いいえ | `+x` | 輸出方向。使用可能な値: `-x`、`-y`、`+y` |
| fbx_preset | 文字列 | いいえ | `blender` | 互換性のために FBX がプリセットされています。使用可能な値: `blender`、`3dsmax`、`mixamo` |
## リクエスト例
### curl
```bash
curl -X POST https://openapi.tripo3d.ai/v3/models/convert \
-H "Content-Type: application/json" \
-H "Authorization: Bearer {api_key}" \
-d '{
"input": "task_abc123",
"format": "FBX",
"quad": true,
"face_limit": 8000,
"texture_size": 2048,
"texture_format": "PNG",
"pivot_to_center_bottom": true,
"fbx_preset": "blender"
}'
```
### Python
```python
import requests
url = "https://openapi.tripo3d.ai/v3/models/convert"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer {api_key}"
}
payload = {
"input": "task_abc123",
"format": "FBX",
"quad": True,
"face_limit": 8000,
"texture_size": 2048,
"texture_format": "PNG",
"pivot_to_center_bottom": True,
"fbx_preset": "blender"
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
```
### JavaScript
```javascript
const url = "https://openapi.tripo3d.ai/v3/models/convert";
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer {api_key}"
},
body: JSON.stringify({
input: "task_abc123",
format: "FBX",
quad: true,
face_limit: 8000,
texture_size: 2048,
texture_format: "PNG",
pivot_to_center_bottom: true,
fbx_preset: "blender"
})
});
const data = await response.json();
console.log(data);
```
## 応答
### 成功した応答
```json
{
"code": 0,
"data": {
"task_id": "task_def456"
}
}
```
### 応答フィールド
| パラメータ | 種類 | 説明 |
| :-: | :-: | :-: |
| code | 整数 | ステータスコード。 `0` は成功を示します |
| data.task_id | 文字列 | 生成の進行状況と結果をクエリするために使用される一意のタスク識別子 |
## エラーコード
| HTTP ステータスコード | エラーコード | 説明 | おすすめ |
| :-: | :-: | :-: | :-: |
| 429 | 2000 | 世代制限を超えました | リクエスト率を下げて後で再試行してください |
| 400 | 2002 | サポートされていないリクエストパラメータ | リクエストボディのパラメータ名と値の範囲を確認してください |
| 400 | 2006 | 入力ソースのタスクタイプが無効です | `task_id` のタスク タイプが正しいことを確認します。 |
| 400 | 2007 | ソースタスクが正常に完了しませんでした | 変換を開始する前にソースタスクが完了するのを待ちます |
| 403 | 2010 | クレジットが不十分です | クレジットを補充して再試行してください |
モデル形式の変換
POST /v3/models/convert
3D モデルを別の形式に変換します。
リクエストパラメータ
リクエストヘッダー
| パラメータ |
種類 |
必須 |
デフォルト |
説明 |
| Content-Type |
文字列 |
はい |
- |
application/json |
| Authorization |
文字列 |
はい |
- |
Bearer {api_key} |
リクエストボディ
基本パラメータ
| パラメータ |
種類 |
必須 |
デフォルト |
説明 |
| input |
文字列 |
はい |
- |
モデルソース。 task_ で始まる task_id または file_ で始まる file_token を受け入れます |
| format |
文字列 |
はい |
- |
ターゲット形式。使用可能な値: GLTF、USDZ、FBX、OBJ、STL、3MF。3MF:単色の3D。 |
メッシュオプション
| パラメータ |
種類 |
必須 |
デフォルト |
説明 |
| quad |
ブール値 |
いいえ |
false |
クワッドの再メッシュ |
| force_symmetry |
ブール値 |
いいえ |
false |
対称性を強制します。 quad が true の場合のみ有効 |
| face_limit |
整数 |
いいえ |
- |
最大ポリ数。省略した場合、元の面数が保持されます。 |
| flatten_bottom |
ブール値 |
いいえ |
false |
底を平らにする |
| flatten_bottom_threshold |
フロート |
いいえ |
0.01 |
平坦化深さのしきい値 |
テクスチャオプション
| パラメータ |
種類 |
必須 |
デフォルト |
説明 |
| texture_size |
整数 |
いいえ |
4096 |
拡散テクスチャ サイズ (ピクセル単位) |
| texture_format |
文字列 |
いいえ |
JPEG |
テクスチャ形式。使用可能な値: BMP、DPX、HDR、JPEG、PNG、TARGA、TIFF、WEBP |
| bake |
ブール値 |
いいえ |
true |
高度なマテリアルをベース テクスチャにベイク処理する |
| pack_uv |
ブール値 |
いいえ |
false |
すべての UV を統一レイアウトにパックする |
| export_vertex_colors |
ブール値 |
いいえ |
false |
頂点カラーを含めます。 OBJ および GLTF 形式にのみ有効です |
エクスポートオプション
| パラメータ |
種類 |
必須 |
デフォルト |
説明 |
| pivot_to_center_bottom |
ブール値 |
いいえ |
false |
ピボットを中央下に移動します |
| scale_factor |
フロート |
いいえ |
1 |
スケールファクター |
| with_animation |
ブール値 |
いいえ |
true |
スケルトンとアニメーション データを含める |
| animate_in_place |
ブール値 |
いいえ |
false |
インプレイスアニメーション |
| part_names |
文字列[] |
いいえ |
- |
メッシュ/segmentデータからエクスポートするパーツの名前 |
| export_orientation |
文字列 |
いいえ |
+x |
輸出方向。使用可能な値: -x、-y、+y |
| fbx_preset |
文字列 |
いいえ |
blender |
互換性のために FBX がプリセットされています。使用可能な値: blender、3dsmax、mixamo |
リクエスト例
-cmd">curl -X POST https://openapi.tripo3d.ai/v3/models/convert \
-H "Content-Type: application/json" \
-H "Authorization: Bearer {api_key}" \
-d '{
"input": "task_abc123",
"format": "FBX",
"quad": true,
"face_limit": 8000,
"texture_size": 2048,
"texture_format": "PNG",
"pivot_to_center_bottom": true,
"fbx_preset": "blender"}'
import requests
url = "https://openapi.tripo3d.ai/v3/models/convert"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer {api_key}"
}
payload = {
"input": "task_abc123",
"format": "FBX",
"quad": True,
"face_limit": 8000,
"texture_size": 2048,
"texture_format": "PNG",
"pivot_to_center_bottom": True,
"fbx_preset": "blender"
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
const url = "https://openapi.tripo3d.ai/v3/models/convert";
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer {api_key}"
},
body: JSON.stringify({
input: "task_abc123",
format: "FBX",
quad: true,
face_limit: 8000,
texture_size: 2048,
texture_format: "PNG",
pivot_to_center_bottom: true,
fbx_preset: "blender"
})
});
const data = await response.json();
console.log(data);
応答
成功した応答
{
"code": 0,
"data": {
"task_id": "task_def456"}
}
応答フィールド
| パラメータ |
種類 |
説明 |
| code |
整数 |
ステータスコード。 0 は成功を示します |
| data.task_id |
文字列 |
生成の進行状況と結果をクエリするために使用される一意のタスク識別子 |
エラーコード
| HTTP ステータスコード |
エラーコード |
説明 |
おすすめ |
| 429 |
2000 |
世代制限を超えました |
リクエスト率を下げて後で再試行してください |
| 400 |
2002 |
サポートされていないリクエストパラメータ |
リクエストボディのパラメータ名と値の範囲を確認してください |
| 400 |
2006 |
入力ソースのタスクタイプが無効です |
task_id のタスク タイプが正しいことを確認します。 |
| 400 |
2007 |
ソースタスクが正常に完了しませんでした |
変換を開始する前にソースタスクが完了するのを待ちます |
| 403 |
2010 |
クレジットが不十分です |
クレジットを補充して再試行してください |