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
| Model | Speed | Quality | Cost | Best For |
|---|---|---|---|---|
flux | Fast (3-5s) | High | $0.14 | Product shots, marketing, general purpose |
stable-diffusion | Fast (2-4s) | Good | $0.14 | Artistic styles, illustrations, concept art |
dall-e-3 | Medium (8-15s) | Highest | $0.18 | Photorealism, complex scenes, text in images |
Request
| Field | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | Text description of the desired image |
model | string | No | dall-e-3, flux, stable-diffusion (default: flux) |
width | number | No | Width in pixels (default: 1024) |
height | number | No | Height in pixels (default: 1024) |
style | string | No | natural, vivid, artistic (default: natural) |
negative_prompt | string | No | What 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 Ratio | Dimensions |
|---|---|
| 1:1 | 512x512, 1024x1024 |
| 16:9 | 1024x576, 1920x1080 |
| 9:16 | 576x1024, 1080x1920 |
| 4:3 | 1024x768 |
| 3:4 | 768x1024 |