Media.io AI Dance Video Generator Skill
Overview
This skill calls Media.io OpenAPI to run dance video generation using model code effects-video-babydance.
The API is asynchronous:
- Submit generation request and get
task_id. - Poll task result endpoint until the task is finished.
When To Use
- The user wants a dance animation generated from an image and a driving video.
- The user can provide source URLs reachable by Media.io servers.
- The user wants task-based generation with polling.
When Not To Use
- The user asks for local file upload only (this API expects URL input).
- The user asks for non-Media.io providers.
- The user asks for real-time synchronous video output in one call.
Requirements
Environment Variables
| Variable | Required | Description |
|---|---|---|
MEDIAIO_API_KEY |
Yes | Media.io OpenAPI key, used in header X-API-KEY. |
Base Headers
Content-Type: application/jsonX-API-KEY: $MEDIAIO_API_KEY
Supported Endpoints
1) Query Credits
- Method:
POST - Endpoint:
https://openapi.media.io/user/credits - Body:
{} - Purpose: check available credits before generation.
2) Create Dance Video Task
- Method:
POST - Endpoint:
https://openapi.media.io/generation/effects/effects-video-babydance - Body:
{
"data": {
"image": "https://example.com/portrait.jpg",
"video": "https://example.com/dance.mp4"
}
}
- Required fields:
data.image(string URL)data.video(string URL)
3) Query Task Result
- Method:
POST - Endpoint:
https://openapi.media.io/generation/result/{task_id} - Body:
{} - Path parameter:
task_id(string, required)
Request and Response Contract
Common Success Envelope
{
"code": 0,
"msg": "",
"data": {},
"trace_id": "..."
}
Create Task Response
- On success,
data.task_idis returned.
Task Result Response
data.statuscan be one of the following values:waiting: queuedprocessing: runningcompleted: completed successfullyfailed: failedtimeout: timed out
data.reason: provides additional context (e.g.,successor error message)- When status is
completed:data.resultis an array of output objects with generated URLs- Each result object contains
val(internal path),preview(public HTTPS URL), andstatus(completion status)
Standard Invocation Flow
- Call
user/creditsto verify balance. - Call
effects-video-babydancewithdata.imageanddata.video. - Extract
task_id. - Poll
generation/result/{task_id}every 3 to 5 seconds. - Stop when status is
completedorfailed. - Return output URLs from
data.resultwhencompleted.
cURL Examples
Query Credits
curl --request POST \
--url https://openapi.media.io/user/credits \
--header 'Content-Type: application/json' \
--header "X-API-KEY: $MEDIAIO_API_KEY" \
--data '{}'
Create Dance Video Task
curl --request POST \
--url https://openapi.media.io/generation/effects/effects-video-babydance \
--header 'Content-Type: application/json' \
--header "X-API-KEY: $MEDIAIO_API_KEY" \
--data '{
"data": {
"image": "https://example.com/portrait.jpg",
"video": "https://example.com/dance.mp4"
}
}'
Query Task Result
curl --request POST \
--url https://openapi.media.io/generation/result/<task_id> \
--header 'Content-Type: application/json' \
--header "X-API-KEY: $MEDIAIO_API_KEY" \
--data '{}'
Successful Response Example
{
"code": 0,
"msg": "",
"data": {
"task_id": "effect-3dbdb8ca-1f5e-4b1c-9c08-43a4a9bb8e2b",
"status": "completed",
"reason": "success",
"result": [
{
"val": "aicloudtmp/550160908/3/202603/1/combo_tm_alg-20260317165022-802800-60eb3-dwt.mp4",
"preview": "https://url_to_generated_image.png",
"status": "completed"
}
]
},
"trace_id": "d63f54745ea24238bc6be4e6fe3d4937"
}
Response fields when status is completed:
data.task_id: unique task identifierdata.status:completedindicates successful completiondata.reason:successindicates no error occurreddata.result: array of output objects, each containing:val: internal file path of the generated assetpreview: publicly accessible HTTPS URL for the generated assetstatus:completedfor each result item
Error Handling Guidance
- Treat
code != 0as failure. - Typical authentication errors:
374004: not authenticated. Apply for an APP KEY at https://developer.media.io/.
- Typical request validation error:
490000: params error
- Typical billing/credits error:
490505: insufficient credits. Recharge before invoking generation APIs.
- Always include
trace_idin logs for troubleshooting.
Agent Behavior Requirements
- Validate that input contains non-empty
imageandvideoURLs before calling the create endpoint. - Do not claim immediate output after task creation; always poll by
task_id. - If credits are insufficient, return a clear message and stop instead of retry loops.
- Avoid exposing raw API keys in logs or responses.
Safety and Compliance Notes
- Only process user-provided or user-authorized media.
- Do not imply identity verification or biometric certainty from generated videos.
- Generated output is synthetic media and should be presented as edited content.
References
- Media.io platform: https://developer.media.io/
- API documentation: https://platform.media.io/docs/
