퀵스타트
Submit your first generation task in a few minutes with a free test key.
- 설정 → API 키에서 테스트 API 키를 만듭니다.
- 아래 요청으로 첫 번째 작업을 제출하십시오 (테스트 키와 함께 크레딧이 필요하지 않음).
- 반환된 것을 사용
taskId5초마다 상태를 확인합니다. 샌드박스 작업이 약 35초 만에 완료됩니다. - 라이브 키와 실제 모델 ID를 스왑하여 실제로 생성합니다.
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"
}
}'작업이 완료되거나 실패하거나 취소되거나 요청이 HTTP 오류를 반환하는 경우 예제가 중지됩니다. 상태 확인이 HTTP 429를 반환하면 초 수를 기다립니다. Retry-After동일한 쿼리하기 전에 taskId다시.
#!/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