Popular Models
Image-to-video generation combines your input image with motion generation. The output maintains visual consistency with your source image while adding realistic motion.
Step 1: Prepare Your Image
First, you need to provide the source image. You can either upload a file or reference a URL.
import requests
import base64
API_BASE = "https://api.krea.ai"
API_TOKEN = "YOUR_API_TOKEN"
# Option 1: Using base64 encoded image
with open("input_image.jpg", "rb") as image_file:
encoded_image = base64.b64encode(image_file.read()).decode('utf-8')
# Option 2: Using image URL
image_url = "https://example.com/input-image.jpg"
Step 2: Generate the Video
Make a POST request to /generate/video/kling/kling-2.5 with your image and motion parameters.
curl -X POST https://api.krea.ai/generate/video/kling/kling-2.5 \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"image_url": "https://example.com/input-image.jpg",
"prompt": "gentle camera pan from left to right, subtle depth",
"duration": 5,
"motion_strength": 0.7,
"fps": 24
}'
Replace with your API TokenTo replace the YOUR_API_TOKEN placeholder in the above examples, you’ll need to generate an API token in krea.ai/settings/api-tokens. Follow the instructions on the API Keys & Billing page if you need help.
Example Response
{
"job_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "queued",
"created_at": "2025-01-15T10:30:00.000Z",
"estimated_time": "60-120 seconds"
}
Step 3: Poll for Results
Poll /jobs/{job_id} every 5 seconds to check the video generation progress.
curl -X GET https://api.krea.ai/jobs/YOUR_JOB_ID \
-H "Authorization: Bearer YOUR_API_TOKEN"
Example Completed Response
{
"job_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "completed",
"created_at": "2025-01-15T10:30:00.000Z",
"completed_at": "2025-01-15T10:31:45.000Z",
"result": {
"video_url": "https://krea.ai/generations/your-video.mp4",
"thumbnail_url": "https://krea.ai/generations/your-video-thumb.jpg",
"duration": 5.0,
"width": 1280,
"height": 720,
"fps": 24
}
}
Webhooks available!Set up webhooks to receive notifications when jobs complete. See the Webhooks guide to get started.
Common Parameters
For a list of detailed parameters for all models, see the Model APIs page.
| Parameter | Type | Description |
|---|
image_url | string | URL of the source image |
prompt | string | Description of desired motion and camera movement |
duration | number | Video length in seconds (3-10) |
motion_strength | number | Intensity of motion (0.0-1.0) |
fps | number | Frames per second (12, 24, or 30) |
seed | number | Random seed for reproducible results |
loop | boolean | Create seamless looping video |
Motion Prompt Tips:
- Describe camera movement (pan, zoom, dolly, tilt)
- Specify motion direction and speed
- Mention depth and parallax effects
- Use lower motion_strength (0.3-0.5) for subtle animations
- Use higher motion_strength (0.7-1.0) for dramatic effects