Media tasks
One asynchronous API for video, images, music and sound, whatever upstream a miner uses. Submit a task, poll it, download the outputs.
Create a task
curl https://terza.si/v1/media/tasks \
-H "Authorization: Bearer $TERZA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "MODEL_ID",
"operation": "image_to_video",
"prompt": "A paper boat drifting down a rainy street",
"inputs": [{"role": "first_frame", "media": "data:image/png;base64,..."}],
"params": {"duration_seconds": 5, "resolution": "1080p", "audio": true}
}'The response is 202 with a task object (status: "queued"). Poll GET /v1/media/tasks/ID until succeeded or failed, then download each file from GET /v1/media/tasks/ID/outputs/N. Outputs are kept for 24 hours.
Operations
| Operation | Inputs | Output |
|---|---|---|
text_to_video | prompt | video |
image_to_video | first_frame | video |
frames_to_video | first_frame, last_frame | video |
reference_to_video | reference_image and/or reference_video | video |
video_extend | source_video | video |
video_edit | source_video, optional reference_image, mask | video |
lip_sync | source_video, plus audio or a script as prompt | video |
text_to_image | prompt, optional reference_image | image |
image_edit | source_image, optional mask | image |
text_to_music | prompt and/or params.lyrics | audio |
sound_effect | prompt, optional source_video | audio |
Inputs, params and options
- Inputs are inline
data:URIs (images up to 24 MiB, video and audio up to 64 MiB, 96 MiB per request), or{"task_output": "TASK_ID#N"}to reuse an output of your own earlier task. External URLs are not accepted. - Params are a fixed set:
duration_seconds,resolution(480p–2160p),aspect_ratio,count(1–4),seed,audio,lyrics,instrumental,style. - Options are model-specific settings the model declares (for example a camera motion). Anything a model has not declared is rejected before you are charged.
Billing
Each model quotes rates per task, per output, or per second of output, optionally by resolution and other settings. The maximum is reserved when you submit. When the task finishes, the gateway downloads and measures every output itself: type, count, duration and resolution. You pay for what was measured, never more than the reservation.
An output that does not match your request (wrong type, fewer outputs, shorter than 90% of the requested duration, lower resolution, or missing audio you asked for) fails the task with nonconforming_output, and you are not charged.
Task errors
| Code | Meaning |
|---|---|
nonconforming_output | The output did not match the request. No charge. |
miner_failed | The miner or its upstream failed. No charge. |
timeout | Not finished within the model’s declared maximum wait. No charge. |