Remesh API
Remesh API を使用すると、他の Meshy API(Image to 3D や Text to 3D など)で生成された既存の 3D モデルをリメッシュし、さまざまな形式にエクスポートできます。このセクションでは、Remesh API の使用方法について詳しく説明します。
リメッシュタスクを作成する
この endpoint は新しいリメッシュタスクを作成します。
フォーマット変換とサイズ変更には、専用の Convert API と Resize API を使用してください。以下の非推奨パラメーターは引き続き動作しますが、新しい連携では新しい endpoint の使用を推奨します。
パラメーター
input_task_id または model_url のどちらか一方のみが必須です。両方が指定された場合、input_task_id が優先されます。
- Name
- input_task_id
- Type
- string
- 必須
- Description
リメッシュしたい、完了済みの Image to 3D または Text to 3D タスクの ID。 このタスクは、Text to 3D Preview、Text to 3D Refine、Image to 3D、または Retexture のいずれかのタスクである必要があります。さらに、ステータスが
SUCCEEDEDである必要があります。
- Name
- model_url
- Type
- string
- 必須
- Description
Meshy がリメッシュする 3D モデルを、公開アクセス可能な URL またはデータ URI で指定してください。 対応フォーマット:
.glb,.gltf,.obj,.fbx,.stl.データ URI の場合は、MIME タイプ
application/octet-streamを使用してください。
- Name
- target_formats
- Type
- string[]
- デフォルト ["glb"]
- Description
リメッシュ後モデルのターゲットフォーマットのリスト。省略した場合、GLB のみが生成されます。
使用可能な値:
glb,fbx,obj,usdz,blend,stl,3mf.
- Name
- topology
- Type
- string
- デフォルト triangle
- Description
生成されるモデルのトポロジーを指定します。
使用可能な値:
quad: 四角形優勢のメッシュを生成します。triangle: 間引きされた三角形メッシュを生成します。
- Name
- target_polycount
- Type
- integer
- デフォルト 30,000
- Description
生成されるモデルの目標ポリゴン数を指定します。実際のポリゴン数は、ジオメトリの複雑さに応じて目標値からずれる場合があります。
有効な値の範囲はユーザーティアによって異なります:
- 100 から 300,000(両端を含む)
- Name
- decimation_mode
- Type
- integer
- Description
ポリゴン数レベルを設定して適応的なデシメーションを有効にします。設定すると、
target_polycountは無視されます。使用可能な値:
1: 適応 — 超高ポリゴン数。2: 適応 — 高ポリゴン数。3: 適応 — 中ポリゴン数。4: 適応 — 低ポリゴン数。
- Name
- resize_height
- Type
- number
- ⚠ 非推奨
- デフォルト 0
- Description
モデルをメートル単位で測定される特定の高さにリサイズします。代わりに専用の Resize API を使用することを推奨します。
auto_size,resize_height, andresize_longest_sideは相互に排他的です。
- Name
- resize_longest_side
- Type
- number
- ⚠ 非推奨
- デフォルト 0
- Description
最長のバウンディングボックス寸法がメートル単位で指定された値と等しくなるようにモデルをリサイズします。代わりに専用の Resize API を使用することを推奨します。
auto_size,resize_height, andresize_longest_sideは相互に排他的です。
- Name
- auto_size
- Type
- boolean
- ⚠ 非推奨
- デフォルト false
- Description
trueに設定すると、サービスは AI ビジョンを使用してオブジェクトの実世界での高さを自動的に推定し、それに応じてモデルをリサイズします。代わりに専用の Resize API を使用することを推奨します。auto_size,resize_height, andresize_longest_sideは相互に排他的です。
auto_size = true- Name
- origin_at
- Type
- string
- ⚠ 非推奨
- デフォルト bottom
- Description
原点の位置。代わりに専用の Resize API を使用することを推奨します。
使用可能な値:
bottom,center.
- Name
- convert_format_only
- Type
- boolean
- ⚠ 非推奨
- Description
trueの場合、サービスは入力モデルファイルのフォーマットのみを変更し、topology、resize_height、target_polycountなどの他の入力は無視します。代わりに専用の Convert API を使用することを推奨します。convert_format_onlyがtrueに設定されている場合、target_formatsを指定する必要があります。
- Name
- alpha_thumbnail
- Type
- boolean
- デフォルト false
- Description
trueに設定すると、タスクは追加でプレビューの透明背景(RGBA)バージョンをレンダリングし、GET レスポンスでalpha_thumbnail_urlとして返します。既存のthumbnail_urlフィールドは変更されません。
戻り値
レスポンスの result プロパティには、新しく作成されたリメッシュタスクの id が含まれます。
失敗モード
- Name
400 - Bad Request- Description
リクエストは受け入れられませんでした。一般的な原因:
- パラメーターの不足:
model_urlまたはinput_task_idのいずれかを指定する必要があります。 - 無効な入力タスク:
input_task_idは、対応モデルからの成功したタスクを参照している必要があります。 - 無効なモデルフォーマット:
model_urlが、対応していない拡張子のファイルを指しています。 - 到達不能な URL:
model_urlをダウンロードできませんでした。 - 無効なトポロジー:
topologyパラメーターが無効です。 - 相互に排他的なパラメーター:
auto_sizeとresize_heightは両方を設定できません。
- パラメーターの不足:
- Name
401 - Unauthorized- Description
認証に失敗しました。API key を確認してください。
- Name
402 - Payment Required- Description
このタスクを実行するためのクレジットが不足しています。
- Name
429 - Too Many Requests- Description
レート制限を超過しました。
Request
# Basic remesh with custom formats and resize
curl https://api.meshy.ai/openapi/v1/remesh \
-X POST \
-H "Authorization: Bearer ${YOUR_API_KEY}" \
-H 'Content-Type: application/json' \
-d '{
"input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578",
"target_formats": ["glb", "fbx"],
"topology": "quad",
"target_polycount": 50000,
"resize_height": 1.0,
"origin_at": "bottom"
}'
# Quad remesh with auto-size
curl https://api.meshy.ai/openapi/v1/remesh \
-X POST \
-H "Authorization: Bearer ${YOUR_API_KEY}" \
-H 'Content-Type: application/json' \
-d '{
"input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578",
"target_formats": ["glb", "fbx"],
"topology": "quad",
"target_polycount": 50000,
"auto_size": true
}'
Response
{
"result": "0193bfc5-ee4f-73f8-8525-44b398884ce9"
}
Remeshタスクを取得
このendpointは、IDによってremeshタスクを取得します。
パラメーター
- Name
- id
- Type
- path
- Description
取得するremeshタスクのID。
戻り値
Remesh Taskオブジェクト。
Request
curl https://api.meshy.ai/openapi/v1/remesh/a43b5c6d-7e8f-901a-234b-567c890d1e2f \
-H "Authorization: Bearer ${YOUR_API_KEY}"
Response
{
"id": "0193bfc5-ee4f-73f8-8525-44b398884ce9",
"type": "remesh",
"model_urls": {
"glb": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.glb?Expires=***",
"fbx": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.fbx?Expires=***",
"obj": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.obj?Expires=***",
"usdz": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.usdz?Expires=***",
"blend": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.blend?Expires=***",
"stl": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.stl?Expires=***"
},
"progress": 100,
"status": "SUCCEEDED",
"created_at": 1699999999000,
"started_at": 1700000000000,
"finished_at": 1700000001000,
"task_error": null,
}
リメッシュタスクを削除
この endpoint は、関連するすべてのモデルとデータを含むリメッシュタスクを完全に削除します。この操作は元に戻せません。
パスパラメータ
- Name
- id
- Type
- path
- Description
削除するリメッシュタスクの ID。
戻り値
成功時に 200 OK を返します。
Request
curl --request DELETE \
--url https://api.meshy.ai/openapi/v1/remesh/a43b5c6d-7e8f-901a-234b-567c890d1e2f \
-H "Authorization: Bearer ${YOUR_API_KEY}"
Response
// Returns 200 Ok on success.
Remeshタスクの一覧表示
このendpointでは、Remeshタスクの一覧を取得できます。
パラメータ
- Name
- page_num
- Type
- integer
- デフォルト 1
- Description
ページネーション用のページ番号。
- Name
- page_size
- Type
- integer
- デフォルト 10
- Description
ページサイズの上限。許可される最大値は
50件です。
- Name
- sort_by
- Type
- string
- Description
ソートに使用するフィールド。
利用可能な値:
+created_at: 作成時刻の昇順でソートします。-created_at: 作成時刻の降順でソートします。
戻り値
Remeshタスクオブジェクト のページ分割された一覧を返します。
Request
curl https://api.meshy.ai/openapi/v1/remesh?page_size=10 \
-H "Authorization: Bearer ${YOUR_API_KEY}"
Response
[
{
"id": "0193bfc5-ee4f-73f8-8525-44b398884ce9",
"type": "remesh",
"model_urls": {
"glb": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.glb?Expires=***",
"fbx": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.fbx?Expires=***",
"obj": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.obj?Expires=***",
"usdz": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.usdz?Expires=***",
"blend": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.blend?Expires=***",
"stl": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.stl?Expires=***"
},
"progress": 100,
"status": "SUCCEEDED",
"created_at": 1699999999000,
"started_at": 1700000000000,
"finished_at": 1700000001000,
"task_error": null
}
]
Remeshタスクをストリーミングする
このendpointは、Server-Sent Events(SSE)を使用してRemeshタスクのリアルタイム更新をストリーミングします。
パラメータ
- Name
- id
- Type
- path
- Description
ストリーミングするRemeshタスクの一意の識別子。
戻り値
RemeshタスクオブジェクトのストリームをServer-Sent Eventsとして返します。
PENDINGまたはIN_PROGRESSのタスクの場合、レスポンスストリームには必要なprogressおよびstatusフィールドのみが含まれます。
Request
curl -N https://api.meshy.ai/openapi/v1/remesh/a43b5c6d-7e8f-901a-234b-567c890d1e2f/stream \
-H "Authorization: Bearer ${YOUR_API_KEY}"
Response Stream
// Error event example
event: error
data: {
"status_code": 404,
"message": "Task not found"
}
// Message event examples illustrate task progress.
// For PENDING or IN_PROGRESS tasks, the response stream will not include all fields.
event: message
data: {
"id": "0193bfc5-ee4f-73f8-8525-44b398884ce9",
"progress": 0,
"status": "PENDING"
}
event: message
data: {
"id": "0193bfc5-ee4f-73f8-8525-44b398884ce9",
"type": "remesh",
"model_urls": {
"glb": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.glb?Expires=***",
"fbx": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.fbx?Expires=***",
"obj": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.obj?Expires=***",
"usdz": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.usdz?Expires=***",
"blend": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.blend?Expires=***",
"stl": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.stl?Expires=***"
},
"progress": 100,
"status": "SUCCEEDED",
"created_at": 1699999999000,
"started_at": 1700000000000,
"finished_at": 1700000001000,
"task_error": null,
}
リメッシュタスクオブジェクト
リメッシュタスクオブジェクトは、Meshy が既存の3Dモデルをリメッシュし、さまざまな形式にエクスポートするために使用する作業単位を表します。 このオブジェクトには以下のプロパティがあります:
プロパティ
- Name
- id
- Type
- string
- Description
タスクの一意の識別子です。実装の詳細として、タスク ID には k-sortable UUID を使用していますが、 id の形式についていかなる仮定も行わないでください。
- Name
- type
- Type
- string
- Description
リメッシュタスクのタイプです。値は
remeshです。
- Name
- model_urls
- Type
- object
- Description
Meshy によって生成された、テクスチャ付き3Dモデルファイルへのダウンロード可能なURLです。形式が生成されていない場合、その形式のプロパティは空文字列を返すのではなく省略されます。
- Name
glb- Type
- string
- Description
GLB ファイルへのダウンロード可能なURLです。
- Name
fbx- Type
- string
- Description
FBX ファイルへのダウンロード可能なURLです。
- Name
obj- Type
- string
- Description
OBJ ファイルへのダウンロード可能なURLです。
- Name
usdz- Type
- string
- Description
USDZ ファイルへのダウンロード可能なURLです。
- Name
blend- Type
- string
- Description
Blender ファイルへのダウンロード可能なURLです。
- Name
stl- Type
- string
- Description
STL ファイルへのダウンロード可能なURLです。
- Name
3mf- Type
- string
- Description
3MF ファイルへのダウンロード可能なURLです。
target_formatsで3mfがリクエストされた場合にのみ存在します。
- Name
- thumbnail_url
- Type
- string
- Description
リメッシュされたモデルからレンダリングされたプレビュー画像へのダウンロード可能なURLです。
- Name
- alpha_thumbnail_url
- Type
- string
- Description
thumbnail_urlの透明背景 (RGBA) 版へのダウンロード可能なURLです。タスクがalpha_thumbnail: trueで作成され、透明プレビューのレンダリングに成功した場合にのみ存在します。それ以外の場合、このフィールドは省略されます。
- Name
- progress
- Type
- integer
- Description
タスクの進捗です。タスクがまだ開始されていない場合、このプロパティは
0になります。タスクが成功すると、これは100になります。
- Name
- status
- Type
- string
- Description
タスクのステータスです。指定可能な値は
PENDING、IN_PROGRESS、SUCCEEDED、FAILEDのいずれかです。
- Name
- preceding_tasks
- Type
- integer
- Description
先行するタスクの数です。
このフィールドの値は、タスクのステータスが
PENDINGの場合にのみ意味を持ちます。
- Name
- created_at
- Type
- timestamp
- Description
タスクが作成された時刻のタイムスタンプ(ミリ秒)です。
- Name
- started_at
- Type
- timestamp
- Description
タスクが開始された時刻のタイムスタンプ(ミリ秒)です。タスクがまだ開始されていない場合、このプロパティは
0になります。
- Name
- finished_at
- Type
- timestamp
- Description
タスクが完了した時刻のタイムスタンプ(ミリ秒)です。タスクがまだ完了していない場合、このプロパティは
0になります。
- Name
- task_error
- Type
- object
- Description
失敗したタスクのエラー詳細です。完全な
task_errorオブジェクトリファレンスについては、Errors を参照してください。
- Name
- consumed_credits
- Type
- integer
- Description
このタスクで消費されたクレジット数です。タスクのステータスが
PENDING、IN_PROGRESS、またはSUCCEEDEDの場合に存在します。FAILEDタスクでは0を返します(失敗時にはクレジットが返還されます)。
Example Remesh Task Object
{
"id": "0193bfc5-ee4f-73f8-8525-44b398884ce9",
"type": "remesh",
"model_urls": {
"glb": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.glb?Expires=***",
"fbx": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.fbx?Expires=***",
"obj": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.obj?Expires=***",
"usdz": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.usdz?Expires=***",
"blend": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.blend?Expires=***",
"stl": "https://assets.meshy.ai/***/tasks/0193bfc5-ee4f-73f8-8525-44b398884ce9/output/model.stl?Expires=***"
},
"progress": 100,
"status": "SUCCEEDED",
"preceding_tasks": 0,
"created_at": 1699999999000,
"started_at": 1700000000000,
"finished_at": 1700000001000,
"task_error": {
"message": ""
},
"consumed_credits": 5
}