/v1/images/generationsImage Generation
Generate images from text prompts using DALL-E, Flux, Stable Diffusion, and other image models.
Available Models
| Model | Provider | Sizes | Features |
|---|---|---|---|
dall-e-3 | OpenAI | 1024×1024, 1024×1792, 1792×1024 | HDPrompt Revision |
dall-e-2 | OpenAI | 256×256, 512×512, 1024×1024 | Multi-image |
flux-1.1-pro | Black Forest Labs | 1024×1024, 1024×768, 768×1024 | Photorealistic |
flux-dev | Black Forest Labs | 1024×1024, 1024×768 | Fast |
stable-diffusion-xl | Stability AI | 1024×1024, 1152×896, 896×1152 | Multi-image |
ideogram-v2 | Ideogram | 1024×1024 | Text-in-Image |
Basic Usage
Generate an image with a text prompt:
const response = await client.images.generate({
model: 'dall-e-3',
prompt: 'A serene mountain landscape at sunset, digital art style',
size: '1024x1024',
quality: 'hd',
n: 1
});
console.log(response.data[0].url);Request Body
{
"model": "dall-e-3", // Required: Image model ID
"prompt": "A beautiful...", // Required: Text description
"n": 1, // Optional: Number of images (1-4)
"size": "1024x1024", // Optional: Image dimensions
"quality": "standard", // Optional: "standard" or "hd"
"style": "vivid", // Optional: "vivid" or "natural"
"response_format": "url" // Optional: "url" or "b64_json"
}Parameters
| Parameter | Type | Description |
|---|---|---|
modelRequired | string | Image model ID (e.g., "dall-e-3", "flux-1.1-pro") |
promptRequired | string | Text description of the desired image (max 4000 chars) |
n | integer | Number of images (1-4). DALL-E 3 only supports n=1. |
size | string | Image dimensions. Options vary by model. |
quality | string | "standard" or "hd". HD costs more but higher quality. |
style | string | "vivid" (hyper-real) or "natural" (more realistic). DALL-E 3 only. |
response_format | string | "url" (default) or "b64_json" for base64 data |
Response
{
"created": 1706123456,
"data": [
{
"url": "https://...", // Image URL (expires in 1 hour)
"revised_prompt": "A beautiful..." // DALL-E 3 revised prompt
}
]
}Note: Image URLs expire after 1 hour. Download and store images if you need them longer.
Model Examples
Flux 1.1 Pro
Excellent for photorealistic images and complex scenes:
const response = await client.images.generate({
model: 'flux-1.1-pro',
prompt: 'Cyberpunk cityscape with neon lights and flying cars',
size: '1024x1024',
n: 1
});
// Download the image
const imageUrl = response.data[0].url;Stable Diffusion XL
Generate multiple variations at once:
const response = await client.images.generate({
model: 'stable-diffusion-xl',
prompt: 'A majestic lion in the savanna, photorealistic, 8k',
size: '1024x1024',
n: 4 // Generate multiple variations
});
response.data.forEach((image, i) => {
console.log(`Image ${i + 1}: ${image.url}`);
});Base64 Response Format
Use response_format: "b64_json" to get image data directly instead of a URL:
const response = await client.images.generate({
model: 'dall-e-3',
prompt: 'Abstract art with vibrant colors',
response_format: 'b64_json',
size: '1024x1024'
});
// Decode and save base64 image
const imageData = response.data[0].b64_json;
const buffer = Buffer.from(imageData, 'base64');
fs.writeFileSync('image.png', buffer);Prompt Tips
Be Specific
Instead of "a dog", try "a golden retriever puppy sitting in a sunny meadow, professional photography, shallow depth of field".
Include Art Style
Specify the style: "oil painting", "digital art", "watercolor", "photorealistic", "anime style", "3D render".
Add Lighting & Mood
Describe lighting: "golden hour", "dramatic shadows", "neon lights", "soft ambient lighting".
Use Quality Modifiers
Add quality keywords: "8k", "highly detailed", "award-winning", "masterpiece", "trending on artstation".
cURL Example
curl https://api.llmhub.one/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $LLMHUB_API_KEY" \
-d '{
"model": "dall-e-3",
"prompt": "A futuristic robot in a garden",
"size": "1024x1024",
"quality": "hd",
"n": 1
}'Pricing
Image generation is priced per image. Costs vary by model, size, and quality:
| Model | Size | Quality | Price/Image |
|---|---|---|---|
| DALL-E 3 | 1024×1024 | Standard | €0.040 |
| DALL-E 3 | 1024×1024 | HD | €0.080 |
| Flux 1.1 Pro | 1024×1024 | — | €0.040 |

