VidoCraft API

Quickstart

Submit your first generation task in a few minutes with a free test key.

  1. Create a Test API key in Settings → API Keys.
  2. Submit your first task with the request below (no credits needed with a test key).
  3. Use the returned taskId to check the status every 5 seconds. A sandbox task completes in about 35 seconds.
  4. Swap in a Live key and a real model id to generate for real.
curl https://vidocraft.com/api/v1/generations \
  -X POST \
  -H "Authorization: Bearer sk_test_xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "text-to-image:c9vuwv34uj9w",
    "input": {
      "prompt": "a lighthouse on a cliff at golden hour, cinematic",
      "aspect_ratio": "16:9"
    }
  }'

The examples stop when the task completes, fails, or is canceled, or if a request returns an HTTP error. If a status check returns HTTP 429, wait the number of seconds in Retry-After before querying the same taskId again.

#!/usr/bin/env bash
set -euo pipefail
# Requires jq. KEY=sk_live_… or sk_test_…
TASK_ID=$(curl -fsS https://vidocraft.com/api/v1/generations \
  -X POST \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"text-to-image:c9vuwv34uj9w","input":{"prompt":"a lighthouse on a cliff"}}' \
  | jq -er .taskId)

while true; do
  sleep 5
  STATUS=$(curl -fsS https://vidocraft.com/api/v1/tasks/$TASK_ID \
    -H "Authorization: Bearer $KEY")
  case $(echo "$STATUS" | jq -r .status) in
    completed) echo "$STATUS" | jq -r '.data.results[]'; break ;;
    failed|canceled) echo "$STATUS" | jq -r .failed_reason; exit 1 ;;
  esac
done