Skip to main content

AI Image Generation

POST /v1/ai/image

Generate images from text prompts using DALL-E 3, Flux, or Stable Diffusion. Generated images can be used directly in video timelines or downloaded standalone.

Models

ModelSpeedQualityCostBest For
fluxFast (3-5s)High$0.14Product shots, marketing, general purpose
stable-diffusionFast (2-4s)Good$0.14Artistic styles, illustrations, concept art
dall-e-3Medium (8-15s)Highest$0.18Photorealism, complex scenes, text in images

Request

FieldTypeRequiredDescription
promptstringYesText description of the desired image
modelstringNodall-e-3, flux, stable-diffusion (default: flux)
widthnumberNoWidth in pixels (default: 1024)
heightnumberNoHeight in pixels (default: 1024)
stylestringNonatural, vivid, artistic (default: natural)
negative_promptstringNoWhat to exclude from the image (Flux and SD only)

Examples

curl

curl -X POST https://api.vidiking.com/v1/ai/image \
-H "Authorization: Bearer $VIDIKING_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A modern office workspace with a laptop showing analytics dashboards, soft natural lighting, minimalist design",
"model": "flux",
"width": 1920,
"height": 1080,
"style": "natural"
}'

Node.js

const image = await client.ai.generateImage({
prompt: 'A modern office workspace with a laptop showing analytics dashboards, soft natural lighting',
model: 'flux',
width: 1920,
height: 1080,
style: 'natural',
});

console.log('Image URL:', image.url);

Python

image = client.ai.generate_image(
prompt="A modern office workspace with a laptop showing analytics dashboards, soft natural lighting",
model="flux",
width=1920,
height=1080,
style="natural",
)

print("Image URL:", image.url)

Response

{
"id": "img_abc123",
"url": "https://cdn.vidiking.com/ai/img_abc123.png",
"model": "flux",
"width": 1920,
"height": 1080,
"credits_used": 5,
"created_at": "2025-01-15T10:30:00Z"
}

Using Generated Images in Video

Generate an image and use it directly in a timeline.

// Generate background image
const bg = await client.ai.generateImage({
prompt: 'Abstract gradient background in blue and purple tones',
model: 'flux',
width: 1920,
height: 1080,
});

// Use in a video render
const { jobId } = await client.render({
timeline: {
tracks: [
{
clips: [
{
asset: { type: 'title', text: 'Welcome', style: 'minimal', size: 'large' },
start: 0,
length: 5,
},
],
},
{
clips: [
{
asset: { type: 'image', src: bg.url },
start: 0,
length: 5,
},
],
},
],
},
output: { format: 'mp4', resolution: 'hd' },
});

Model Comparison

DALL-E 3

Best for photorealistic images and complex scenes. Handles text rendering in images well. Slower and more expensive but highest quality.

curl -X POST https://api.vidiking.com/v1/ai/image \
-H "Authorization: Bearer $VIDIKING_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A neon sign that reads OPEN 24/7 in a rainy city street at night",
"model": "dall-e-3",
"width": 1024,
"height": 1024,
"style": "vivid"
}'

Flux

Best general-purpose model. Fast, high quality, and cost effective. Good at following detailed prompts.

curl -X POST https://api.vidiking.com/v1/ai/image \
-H "Authorization: Bearer $VIDIKING_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Professional headshot of a confident business person, studio lighting, neutral background",
"model": "flux",
"width": 1024,
"height": 1024
}'

Stable Diffusion

Best for artistic and stylized images. Supports negative prompts for fine control.

curl -X POST https://api.vidiking.com/v1/ai/image \
-H "Authorization: Bearer $VIDIKING_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Watercolor painting of a coastal village at sunset, vibrant colors",
"model": "stable-diffusion",
"width": 1024,
"height": 1024,
"style": "artistic",
"negative_prompt": "blurry, low quality, distorted"
}'

Supported Sizes

Aspect RatioDimensions
1:1512x512, 1024x1024
16:91024x576, 1920x1080
9:16576x1024, 1080x1920
4:31024x768
3:4768x1024