Hướng dẫn nền tảng

Video generation

Submit text-to-video or image-to-video jobs, poll their status, and download the final file.

Prepare the model and inputs

Filter the Models and pricing page by Video. Confirm whether the model supports text-to-video, image-to-video, duration, and size. Image-to-video models usually need a publicly reachable image URL or a file upload supported by that model.

Video jobs are asynchronous A successful create response means the job was accepted. Keep polling until it completes or fails.

Create a video job

The video API uses a job-based flow. Include at least model and prompt; use image_url, seconds, and size only when the model lists support for them.

bash
curl https://api.moloop.io/v1/videos \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "YOUR_VIDEO_MODEL_ID",
    "prompt": "A slow camera move across a quiet mountain lake at dawn",
    "seconds": "5",
    "size": "1280x720"
  }'

For image-to-video, put the image in the image_url or file field required by the model. Do not place large files in JSON as Base64 unless the model documentation explicitly requires it.

Poll and download

Save the job ID from the create response and poll at the interval returned by the service. Common states include queued, in_progress, completed, and failed; use the actual response as the authority.

bash
curl "https://api.moloop.io/v1/videos/YOUR_VIDEO_ID" \
  -H "Authorization: Bearer YOUR_API_KEY"

# 完成后下载视频文件
curl "https://api.moloop.io/v1/videos/YOUR_VIDEO_ID/content" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --output generated-video.mp4
  1. Request content only after completed; do not download while the job is still running.

  2. After downloading, verify the HTTP status, Content-Type, and file size before storing the object.

  3. For failed jobs, retain the error and job ID, then create a new job after correcting the inputs.

Duration, size, and billing

ItemGuidance
DurationTest prompts with short clips first; longer clips usually cost more.
SizeUse sizes supported by the model instead of guessing from the player ratio.
ConcurrencySet a per-account job limit and back off on 429 responses.
BillingVideo is commonly charged by duration, size, or job. The model catalog and logs are authoritative.

Troubleshooting

  1. 400: check that the model supports the video endpoint and that seconds, size, and image format are valid.

  2. 404: confirm you are using the job ID returned by create and did not duplicate the path.

  3. A job stays queued: lower concurrency, retain the job ID, and inspect upstream status in request logs.

  4. Download fails: wait for completed and retry content, and make sure the client does not parse the binary response as JSON.