packages/cloud-frontend/content/api/images.mdx
import { Callout, Tabs } from "@/docs/components";
Generate high-quality images from text prompts using state-of-the-art AI models.
Create images from text descriptions.
<Tabs items={['cURL', 'JavaScript', 'Python']}> <Tabs.Tab>
curl -X POST "https://elizacloud.ai/api/v1/generate-image" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A serene mountain landscape at sunset",
"model": "google/gemini-2.5-flash-image",
"aspectRatio": "1:1",
"numImages": 1
}'
</Tabs.Tab> <Tabs.Tab>
const response = await fetch('https://elizacloud.ai/api/v1/generate-image', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
prompt: 'A serene mountain landscape at sunset',
model: 'google/gemini-2.5-flash-image',
aspectRatio: '1:1',
numImages: 1,
}),
});
const data = await response.json();
console.log(data.images[0].url);
</Tabs.Tab> <Tabs.Tab>
import requests
response = requests.post(
'https://elizacloud.ai/api/v1/generate-image',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
json={
'prompt': 'A serene mountain landscape at sunset',
'model': 'google/gemini-2.5-flash-image',
'aspectRatio': '1:1',
'numImages': 1,
}
)
data = response.json()
print(data['images'][0]['url'])
</Tabs.Tab> </Tabs>
| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | string | ✓ | Description of the image to generate |
model | string | Model to use. Default: google/gemini-2.5-flash-image | |
aspectRatio | string | Output aspect ratio. Default: 1:1 | |
numImages | integer | Number of images (1-4). Default: 1 | |
stylePreset | string | Style preset to apply (see below) | |
sourceImage | string | Base64 data URL for image-to-image generation |
| Aspect Ratio | Description |
|---|---|
1:1 | Square (default) |
16:9 | Wide landscape |
9:16 | Tall portrait |
4:3 | Standard landscape |
3:4 | Standard portrait |
21:9 | Ultra-wide cinematic |
9:21 | Ultra-tall vertical |
| Preset | Description |
|---|---|
none | No style modification (default) |
photographic | Realistic lighting and details |
digital-art | Vibrant colors, modern aesthetics |
comic-book | Bold lines, dramatic shading |
fantasy-art | Magical and ethereal elements |
analog-film | Film grain and vintage tones |
neon-punk | Cyberpunk style with neon colors |
isometric | Isometric perspective |
low-poly | Low-poly 3D style |
origami | Paper-folding style |
line-art | Clean line art with minimal shading |
cinematic | Dramatic lighting and composition |
3d-model | High-quality 3D rendered appearance |
{
"images": [
{
"url": "https://your-storage.vercel-storage.com/images/abc123.webp",
"text": "Optional text response from the model",
"mimeType": "image/webp",
"fileSize": 102400
}
],
"numImages": 1
}
Model availability changes with provider catalogs and deployment configuration.
Use /api/v1/models, the API Explorer, or the generated OpenAPI reference for
the current image model list and defaults.
Transform existing images by providing a sourceImage parameter:
const response = await fetch("https://elizacloud.ai/api/v1/generate-image", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
prompt: "Transform this into a watercolor painting",
sourceImage: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...",
model: "google/gemini-2.5-flash-image",
}),
});
The sourceImage must be a base64-encoded data URL with the format data:{mimeType};base64,{base64Data}.
Good prompts include subject, style, lighting, and composition details:
{
"prompt": "A golden retriever puppy playing in autumn leaves, golden hour lighting, shallow depth of field, professional photography"
}
Apply consistent styling using the stylePreset parameter:
{
"prompt": "Portrait of a woman in natural lighting",
"stylePreset": "photographic",
"aspectRatio": "3:4"
}
Enhance your prompts with these style modifiers:
| Category | Keywords |
|---|---|
| Photography | professional photo, DSLR, 35mm film, macro, portrait |
| Art Styles | oil painting, watercolor, digital art, concept art, anime |
| Lighting | golden hour, studio lighting, dramatic shadows, soft light |
| Quality | highly detailed, 8K, masterpiece, award winning |
| Code | Error | Solution |
|---|---|---|
| 400 | Invalid prompt | Check prompt is non-empty string |
| 400 | Invalid model | Use a supported model from the list above |
| 402 | Insufficient credits | Add credits to your account |
| 429 | Rate limited | Wait and retry with exponential backoff |
| 500 | Generation failed | Retry, or try a different model |
{
"error": "Insufficient credits for image generation",
"required": 0.02
}
Generate multiple images in a single request (up to 4):
curl -X POST "https://elizacloud.ai/api/v1/generate-image" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Cyberpunk cityscape at night",
"model": "google/gemini-2.5-flash-image",
"numImages": 4,
"aspectRatio": "16:9"
}'
Each image in the batch is generated with the style preset applied.