Image GenerationImagen
Imagen 4
Google's Imagen 4 flagship model with superior detail, typography, and style versatility.
POST /v2/images/generate — model: "imagen-4"
Google's Imagen 4 flagship model featuring enhanced text rendering, fine detail clarity for fabrics, water droplets, and fur, and support for various aspect ratios up to 2K resolution.
See Image Generation overview for common request fields, response format, and error codes.
Model-specific parameters
| Parameter | Type | Description |
|---|---|---|
imagenParams.aspect_ratio | string | Aspect ratio. Values: "1:1" (default), "9:16", "16:9", "3:4", "4:3" |
imagenParams.output_format | string | Output format. Values: "jpg" (default), "png" |
imagenParams.image_size | string | Image resolution. Values: "1K" (default), "2K" |
Credit cost
| Credits per generation |
|---|
| 7 |
Example result
Once the job is COMPLETED, the result object on GET /v2/jobs/:id looks like:
{
"images": [
"https://cdn2.apiframe.ai/images/a1b2c3d4-e5f6-7890-abcd-ef1234567890-1.png"
]
}See Result format for field details.
Code examples
curl -X POST https://api.apiframe.ai/v2/images/generate \
-H "X-API-Key: afk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A serene shallow pool among creek rocks with koi fish swimming under sunlight, lush aquatic plants visible beneath the surface",
"model": "imagen-4",
"imagenParams": {
"aspect_ratio": "16:9",
"image_size": "2K"
}
}'import requests
response = requests.post(
"https://api.apiframe.ai/v2/images/generate",
headers={
"X-API-Key": "afk_your_api_key_here",
"Content-Type": "application/json",
},
json={
"prompt": "A serene shallow pool among creek rocks with koi fish swimming under sunlight, lush aquatic plants visible beneath the surface",
"model": "imagen-4",
"imagenParams": {
"aspect_ratio": "16:9",
"image_size": "2K",
},
},
)
print(response.json())const response = await fetch("https://api.apiframe.ai/v2/images/generate", {
method: "POST",
headers: {
"X-API-Key": "afk_your_api_key_here",
"Content-Type": "application/json",
},
body: JSON.stringify({
prompt: "A serene shallow pool among creek rocks with koi fish swimming under sunlight, lush aquatic plants visible beneath the surface",
model: "imagen-4",
imagenParams: { aspect_ratio: "16:9", image_size: "2K" },
}),
});
console.log(await response.json());Try it
POST
/v2/images/generateTry it