Skip to main content

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.
// npm install @krea-ai/sdk
import { openAsBlob } from "node:fs";
import { Krea } from "@krea-ai/sdk";

const krea = new Krea({ apiKey: process.env.KREA_API_KEY });

// Option 1: Upload a local file and use the hosted asset URL
const file = await openAsBlob("./input-image.jpg", { type: "image/jpeg" });
const asset = await krea.assets.upload(file, {
  description: "Input image",
});
const imageUrl = asset.image_url;

// Option 2: Using image URL
// const imageUrl = "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.
// npm install @krea-ai/sdk
import { Krea } from "@krea-ai/sdk";

const krea = new Krea({ apiKey: process.env.KREA_API_KEY });

const job = await krea.video("kling/kling-2.5", {
  start_image: imageUrl,
  prompt: "gentle camera pan from left to right, subtle depth",
  duration: 5,
  aspect_ratio: "16:9"
});

console.log(`Job ID: ${job.job_id}`);
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.
// npm install @krea-ai/sdk
import { Krea } from "@krea-ai/sdk";

const krea = new Krea({ apiKey: process.env.KREA_API_KEY });

async function waitForVideo(jobId) {
  const completed = await krea.jobs.wait(jobId, { intervalMs: 5000 });
  return completed.result.urls[0];
}

const videoUrl = await waitForVideo(job.job_id);
console.log(`Video ready: ${videoUrl}`);
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": {
    "urls": ["https://gen.krea.ai/videos/your-video.mp4"]
  }
}
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.
ParameterTypeDescription
start_imagestringURL of the source image
promptstringDescription of desired motion and camera movement
durationnumberVideo length in seconds. Supported values depend on the model.
aspect_ratiostringVideo aspect ratio, such as 16:9, 9:16, or 1:1
end_imagestringOptional ending frame URL for supported models
modestringOptional quality mode for models that expose one
Motion Prompt Tips:
  • Describe camera movement (pan, zoom, dolly, tilt)
  • Specify motion direction and speed
  • Mention depth and parallax effects
  • Use restrained camera language for subtle animations
  • Use stronger action verbs for dramatic effects