アニメーションAPI
利用可能なアニメーションを検出し、それらをrig済みキャラクターに適用するためのendpoint。
アニメーションタスクを作成
この endpoint では、以前にリギングされたキャラクターに特定のアニメーションアクションを適用する新しいタスクを作成できます。後処理オプションも含まれます。
パラメータ
- Name
- rig_task_id
- Type
- string
- 必須
- Description
正常に完了したリギングタスク(
POST /openapi/v1/riggingから)のid。このタスクのキャラクターがアニメーション化されます。
- Name
- action_id
- Type
- integer
- 必須
- Description
適用するアニメーションアクションの識別子。利用可能なアニメーションの完全な一覧については、アニメーションライブラリリファレンス
を参照してください。
- Name
- post_process
- Type
- object
- Description
アニメーション出力に対する任意の後処理。標準のアニメーションファイルを受け取るには省略してください。
post_process is set- Name
- operation_type
- Type
- string
- 必須
- Description
実行する操作の種類。利用可能な値:
change_fps,fbx2usdz,extract_armature。
- Name
- fps
- Type
- integer
- デフォルト 30
- Description
目標フレームレート。
operation_typeがchange_fpsの場合にのみ適用されます。許可される値:24,25,30,60。
戻り値
レスポンスの result プロパティには、新しく作成されたアニメーションタスクのタスク id が含まれます。
失敗モード
- Name
400 - Bad Request- Description
リクエストが受け付けられませんでした。一般的な原因:
- パラメータ不足:
rig_task_idまたはaction_idがありません。 - 無効なリギングタスク:
rig_task_idが無効であるか、失敗した/存在しないタスクを参照しています。 - 無効なアクション ID:
action_idが有効なアニメーションに対応していません。
- パラメータ不足:
- Name
401 - Unauthorized- Description
認証に失敗しました。API key を確認してください。
- Name
402 - Payment Required- Description
このタスクを実行するためのクレジットが不足しています。
- Name
404 - Not Found- Description
rig_task_idで指定されたリギングタスクが見つかりませんでした。
- Name
429 - Too Many Requests- Description
レート制限を超過しました。
Request
# Animate a rigged model with required params only
curl https://api.meshy.ai/openapi/v1/animations \
-X POST \
-H "Authorization: Bearer ${YOUR_API_KEY}" \
-H 'Content-Type: application/json' \
-d '{
"rig_task_id": "018b314a-a1b5-716d-c222-2f1776f7f579",
"action_id": 92
}'
# With post-processing to change FPS
curl https://api.meshy.ai/openapi/v1/animations \
-X POST \
-H "Authorization: Bearer ${YOUR_API_KEY}" \
-H 'Content-Type: application/json' \
-d '{
"rig_task_id": "018b314a-a1b5-716d-c222-2f1776f7f579",
"action_id": 92,
"post_process": {
"operation_type": "change_fps",
"fps": 24
}
}'
Response
{
"result": "018c425b-b2c6-727e-d333-3c1887i9h791"
}
アニメーションタスクを取得する
この endpoint では、有効なタスク id を指定してアニメーションタスクを取得できます。含まれるプロパティについては、アニメーションタスクオブジェクトを参照してください。
パラメータ
- Name
- id
- Type
- path
- Description
取得するアニメーションタスクの一意の識別子。
戻り値
レスポンスには Animation Task オブジェクトが含まれます。詳細については、アニメーションタスクオブジェクトセクションを確認してください。
Request
curl https://api.meshy.ai/openapi/v1/animations/018c425b-b2c6-727e-d333-3c1887i9h791
-H "Authorization: Bearer ${YOUR_API_KEY}"
Response
{
"id": "018c425b-b2c6-727e-d333-3c1887i9h791",
"type": "animate",
"status": "SUCCEEDED",
"created_at": 1747032440896,
"progress": 100,
"started_at": 1747032441210,
"finished_at": 1747032457530,
"expires_at": 1747291657530,
"task_error": {
"message": ""
},
"consumed_credits": 3,
"result": {
"animation_glb_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018c425b-b2c6-727e-d333-3c1887i9h791/output/Animation_Reaping_Swing_withSkin.glb?Expires=...",
"animation_fbx_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018c425b-b2c6-727e-d333-3c1887i9h791/output/Animation_Reaping_Swing_withSkin.fbx?Expires=...",
"processed_usdz_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018c425b-b2c6-727e-d333-3c1887i9h791/output/processed.usdz?Expires=...",
"processed_armature_fbx_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018c425b-b2c6-727e-d333-3c1887i9h791/output/processed_armature.fbx?Expires=...",
"processed_animation_fps_fbx_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018c425b-b2c6-727e-d333-3c1887i9h791/output/processed_60fps.fbx?Expires=..."
},
"preceding_tasks": 0
}
アニメーションタスクを削除
この endpoint は、関連するすべてのモデルとデータを含むアニメーションタスクを完全に削除します。この操作は元に戻せません。
パスパラメータ
- Name
- id
- Type
- path
- Description
削除するアニメーションタスクの ID。
戻り値
成功時に 200 OK を返します。
Request
curl --request DELETE \
--url https://api.meshy.ai/openapi/v1/animations/018b314a-a1b5-716d-c222-2f1776f7f579 \
-H "Authorization: Bearer ${YOUR_API_KEY}"
Response
// Returns 200 Ok on success.
アニメーションタスクをストリーミングする
このendpointは、Server-Sent Events(SSE)を使用してアニメーションタスクのリアルタイム更新をストリーミングします。
パラメータ
- Name
- id
- Type
- path
- Description
ストリーミングするアニメーションタスクの一意の識別子。
戻り値
アニメーションタスクオブジェクトのストリームを Server-Sent Events として返します。
PENDING または IN_PROGRESS のタスクでは、レスポンスストリームには必要な progress フィールドと status フィールドのみが含まれます。
Request
curl -N https://api.meshy.ai/openapi/v1/animations/018c425b-b2c6-727e-d333-3c1887i9h791/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": "018c425b-b2c6-727e-d333-3c1887i9h791",
"progress": 0,
"status": "PENDING"
}
event: message
data: {
"id": "018c425b-b2c6-727e-d333-3c1887i9h791",
"progress": 50,
"status": "IN_PROGRESS"
}
event: message
data: { // Example of a SUCCEEDED task stream item, mirroring The Animation Task Object structure
"id": "018c425b-b2c6-727e-d333-3c1887i9h791",
"type": "animate",
"status": "SUCCEEDED",
"created_at": 1747032440896,
"progress": 100,
"started_at": 1747032441210,
"finished_at": 1747032457530,
"expires_at": 1747291657530,
"task_error": {
"message": ""
},
"consumed_credits": 3,
"result": {
"animation_glb_url": "https://assets.meshy.ai/.../Animation_Reaping_Swing_withSkin.glb?...",
"animation_fbx_url": "https://assets.meshy.ai/.../Animation_Reaping_Swing_withSkin.fbx?...",
"processed_usdz_url": "https://assets.meshy.ai/.../processed.usdz?...",
"processed_armature_fbx_url": "https://assets.meshy.ai/.../processed_armature.fbx?...",
"processed_animation_fps_fbx_url": "https://assets.meshy.ai/.../processed_60fps.fbx?..."
},
"preceding_tasks": 0
}
アニメーションタスクオブジェクト
Animation Task オブジェクトは、リグ付きキャラクターにアニメーションを適用するための作業単位を表します。
プロパティ
- Name
- id
- Type
- string
- Description
タスクの一意の識別子。
- Name
- type
- Type
- string
- Description
Animationタスクのタイプ。値は
animateです。
- Name
- status
- Type
- string
- Description
タスクのステータス。指定可能な値:
PENDING,IN_PROGRESS,SUCCEEDED,FAILED,CANCELED。
- Name
- progress
- Type
- integer
- Description
タスクの進捗(0〜100)。
- Name
- created_at
- Type
- timestamp
- Description
タスクが作成された時刻のタイムスタンプ(エポックからのミリ秒)。
タイムスタンプは、1970年1月1日 UTC から経過したミリ秒数を表し、 RFC 3339
標準に従います。 たとえば、2023年9月1日金曜日 12:00:00 PM GMT は1693569600000として表されます。これは Meshy API の すべて のタイムスタンプに適用されます。
- Name
- started_at
- Type
- timestamp
- Description
タスクの処理が開始された時刻のタイムスタンプ(エポックからのミリ秒)。開始されていない場合は
0。
- Name
- finished_at
- Type
- timestamp
- Description
タスクが完了した時刻のタイムスタンプ(エポックからのミリ秒)。完了していない場合は
0。
- Name
- expires_at
- Type
- timestamp
- Description
タスク結果のアセットが期限切れになる時刻のタイムスタンプ(エポックからのミリ秒)。
- Name
- task_error
- Type
- object
- Description
失敗したタスクのエラー詳細。完全な
task_errorオブジェクトのリファレンスについては、エラー を参照してください。
- Name
- consumed_credits
- Type
- integer
- Description
このタスクで消費されたクレジット数。タスクのステータスが
PENDING、IN_PROGRESS、またはSUCCEEDEDの場合に存在します。FAILEDタスクでは0を返します(失敗時にはクレジットが返還されます)。
- Name
- result
- Type
- object
- Description
タスクが
SUCCEEDEDの場合、出力アニメーションのURLを含みます。- Name
animation_glb_url- Type
- string
- Description
- GLB形式のアニメーションのダウンロード可能なURL。
- Name
animation_fbx_url- Type
- string
- Description
- FBX形式のアニメーションのダウンロード可能なURL。
- Name
processed_usdz_url- Type
- string
- Description
- USDZ形式の処理済みアニメーションのダウンロード可能なURL。
- Name
processed_armature_fbx_url- Type
- string
- Description
- FBX形式の処理済みアーマチュアのダウンロード可能なURL。
- Name
processed_animation_fps_fbx_url- Type
- string
- Description
- FPSが変更されたアニメーションのFBX形式のダウンロード可能なURL(例:
change_fps操作が使用された場合)。
- Name
- preceding_tasks
- Type
- integer
- Description
キュー内で先行しているタスクの数。ステータスが
PENDINGの場合にのみ意味があります。
Example Animation Task Object
{
"id": "018c425b-b2c6-727e-d333-3c1887i9h791",
"type": "animate",
"status": "SUCCEEDED",
"created_at": 1747032440896,
"progress": 100,
"started_at": 1747032441210,
"finished_at": 1747032457530,
"expires_at": 1747291657530,
"task_error": {
"message": ""
},
"consumed_credits": 3,
"result": {
"animation_glb_url": "https://assets.meshy.ai/.../Animation_Reaping_Swing_withSkin.glb?...",
"animation_fbx_url": "https://assets.meshy.ai/.../Animation_Reaping_Swing_withSkin.fbx?...",
"processed_usdz_url": "https://assets.meshy.ai/.../processed.usdz?...",
"processed_armature_fbx_url": "https://assets.meshy.ai/.../processed_armature.fbx?...",
"processed_animation_fps_fbx_url": "https://assets.meshy.ai/.../processed_60fps.fbx?..."
},
"preceding_tasks": 0
}