Quickstart
Start from scratch and complete your first image-to-video task. Just follow the steps below in order.
1. Sign up and verify your email
Create an account on the sign-up page, then click the link in the verification email to verify your email address. If you didn't receive the verification email, click resend.
2. Trial credits
After signing in to the console, confirm on the page that your account has a paid credit balance, or that you have a trial credit grant that hasn't expired and still has credits remaining. If you have no usable credits, task creation will be rejected at the charging step. See Credits and Billing.
3. Create the matching type of API key
Go to the API Keys page and, depending on the credit source you confirmed in step 2, click "Create paid key" (uses your paid balance; requires at least one successful top-up) or "Create trial key" (uses a specific trial credit grant).
Copy and save the key right after it's created. You can also come back to the same page later and click "Show" to view it again. Don't put the key in front-end web code or commit it to version control.
4. Set environment variables
Store the API URL and key as environment variables; the examples below use them:
export YUYU_API_BASE_URL="https://yuyuvideo.com"
export YUYU_API_KEY="sk-live-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
5. Prepare an image
Images must be converted to a base64 data URI and placed in images. PNG, JPEG, and WebP are supported. There is currently no separate image upload API, so convert the image in your own code, for example:
echo "data:image/png;base64,$(base64 -w0 /path/to/photo.png)"
6. Create a video task
The example below uses YUYU_M1. The request must include these three headers:
X-Api-Key: Your API keyIdempotency-Key: A unique value of your choice. When you resend a request, it prevents creating duplicate tasks and being charged twice.Content-Type: application/json
YUYU_M1 videos are always 5 seconds long, but you still need to set duration to 5.
curl -X POST "$YUYU_API_BASE_URL/api/tasks/video-generation" \
-H "X-Api-Key: $YUYU_API_KEY" \
-H "Idempotency-Key: quickstart-demo-001" \
-H "Content-Type: application/json" \
-d '{
"model": "YUYU_M1",
"prompt": "A cat running across a sunlit meadow",
"images": ["data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..."],
"duration": 5
}'
On success, the API returns 201 Created with the task data. Only some fields are shown below, and the credits value is for reference only:
{
"public_id": "01K0ZC8QW3E5F1234567890ABC",
"status": 0,
"credits": 10
}
7. Note the public_id
public_id is the ID of this task. You'll use it later to check progress and download the video.
8. Check task progress
Query the task by public_id, checking periodically until the task finishes:
curl -H "X-Api-Key: $YUYU_API_KEY" \
"$YUYU_API_BASE_URL/api/tasks/01K0ZC8QW3E5F1234567890ABC"
When the task finishes, status will be one of the following values:
status |
Meaning |
|---|---|
20 |
Completed |
30 |
Failed |
40 |
Canceled |
Once the task is complete, files in the response lists the URLs of the files you can download.
9. Download the video
Download directly using the url provided in files; you don't need to build the URL yourself:
curl -H "X-Api-Key: $YUYU_API_KEY" \
"$YUYU_API_BASE_URL/api/tasks/01K0ZC8QW3E5F1234567890ABC/files/video" \
-o output.mp4
Receive notifications via webhook instead (optional)
If you don't want to keep checking progress, you can add callback_url when creating the task (it must be a publicly accessible https:// URL). When the task completes or fails, the system will notify that URL.
When you receive a notification, verify X-Signature using the webhook secret on the Webhook page to confirm the notification was sent by YUYU VIDEO. For the full format, see Callbacks (Webhook).
Next steps
- Authentication: API key types and rate limits
- Image to Video: Model comparison and full parameters
- Reference to Video: Generate entirely new scenes from reference images
- Text to Video: Generate videos from a text description alone, with no image
- Query Tasks and Download Results: Task fields, statuses, and file downloads
- Credits and Billing: Charging and refund rules
- Error Reference: Error code descriptions