import json
import os
import requests
payload = json.loads(r'''
{
"model": "wan2.7-videoedit",
"metadata": {
"input": {
"prompt": "Change the mug color to blue while preserving the original motion and white tabletop.",
"media": [
{
"type": "video",
"url": "https://example.com/source.mp4"
}
]
},
"parameters": {
"resolution": "720P",
"duration": 2,
"watermark": false
}
}
}
''')
response = requests.post(
"https://api.mixroute.ai/v1/video/generations",
headers={"Authorization": "Bearer " + os.environ["MIXROUTE_API_KEY"]},
json=payload,
timeout=120,
)
response.raise_for_status()
result = response.json()
task_id = result.get("task_id") or result.get("id")
if not task_id:
raise RuntimeError(result.get("message") or result)
print(task_id)