Generate and retrieve media including AI-generated images, AI-generated videos, and stock images. Use this skill for all visual content creation and retrieval.
Generate custom images, videos, and retrieve stock images for your application.
Generate custom images from text descriptions using AI image generation. Waits for generation to complete before returning.
Parameters:
images (list, required): A list of image request objects. This wrapper is always required — even for a single image, pass images: [{ ... }]. Up to 10 images can be generated in a single call. Each dict should have:
prompt (required): Text description of the desired imageoutputPath: File path must end in .png — this is the only accepted format. .jpg, .jpeg, .webp, and other extensions will cause an error. Defaults to attached_assets/generated_images/{summary}.pngaspectRatio: Optional, defaults to "1:1". Options: "1:1", "3:4", "4:3", "9:16", "16:9"negativePrompt: Optional, description of what should NOT appearsummary: Optional, short 4-5 word description for default filenameremoveBackground: Optional, defaults to Falseoverwrite (bool, default True): Whether to overwrite existing filesReturns: Dict with images list (each with filePath and description) and optional failures list
Common Mistakes:
// WRONG — flat params without images array (causes "images field required" error)
await generateImage({ prompt: "A mountain landscape", outputPath: "hero.png" });
// CORRECT — always wrap in images: [...], even for a single image
await generateImage({ images: [{ prompt: "A mountain landscape", outputPath: "hero.png" }] });
// WRONG — .jpg extension is not supported (causes "outputPath must end with .png" error)
await generateImage({ images: [{ prompt: "A cityscape", outputPath: "city.jpg" }] });
// CORRECT — only .png is accepted
await generateImage({ images: [{ prompt: "A cityscape", outputPath: "city.png" }] });
Examples:
// Single image
const result = await generateImage({
images: [
{
prompt: "A serene mountain landscape at sunset with snow-capped peaks",
outputPath: "src/assets/images/hero.png",
aspectRatio: "16:9",
negativePrompt: "blurry, low quality",
}
]
});
console.log(`Image saved to: ${result.images[0].filePath}`);
// Multiple images at once
const result = await generateImage({
images: [
{ prompt: "A red apple", outputPath: "assets/apple.png" },
{ prompt: "A yellow banana", outputPath: "assets/banana.png" },
{ prompt: "An orange", outputPath: "assets/orange.png", removeBackground: true },
]
});
for (const img of result.images) {
console.log(`Generated: ${img.filePath}`);
}
Generate images asynchronously in the background. Returns immediately with a workflow ID.
Parameters:
images (list, required): Same format as generateImageoverwrite (bool, default True): Whether to overwrite existing filesReturns: Dict with workflowId, workflowAlias, status, and imagePaths
Example:
const result = await generateImageAsync({
images: [
{ prompt: "A complex detailed illustration", outputPath: "assets/illustration.png" },
]
});
console.log(`Started workflow: ${result.workflowAlias}`);
console.log(`Images will be saved to: ${result.imagePaths}`);
Generate short video clips from text descriptions using AI video generation.
Parameters:
prompt (str, required): Detailed text description of the desired videosummary (str, default "generated_video"): Short description for the filenameaspectRatio (str, default "16:9"): "16:9" (landscape) or "9:16" (portrait)resolution (str, default "720p"): "720p" or "1080p"durationSeconds (int, default 6): 4, 6, or 8 secondsnegativePrompt (str, optional): Description of what should NOT appearpersonGeneration (str, optional): "dont_allow" or "allow_adult" for controlling peopleReturns: Dict with filePath and description keys
Example:
const result = await generateVideo({
prompt: "A cat playing with a ball of yarn, cute and playful, natural lighting",
summary: "playful cat",
aspectRatio: "16:9",
durationSeconds: 6
});
console.log(`Video saved to: ${result.filePath}`);
Retrieve stock images matching a description from a stock image provider.
Parameters:
description (str, required): Text description of desired stock image(s)summary (str, default "stock_image"): Short description for the filenamelimit (int, default 1): Number of images to retrieve (1-10)orientation (str, default "horizontal"): "horizontal", "vertical", or "all"Returns: Dict with filePaths list and query string
Example:
const result = await stockImage({
description: "modern office with natural lighting",
summary: "office background",
limit: 3,
orientation: "horizontal"
});
for (const path of result.filePaths) {
console.log(`Stock image saved to: ${path}`);
}
generateImageAsync when images are not needed immediatelyattached_assets/generated_images/attached_assets/generated_videos/attached_assets/stock_images/