Image API (Image Generation)
The Image API provides powerful AI image generation, editing, and analysis capabilities, supporting text-to-image generation, image variation creation, image editing, and more.
Endpoint
POST https://aiapi.services/v1/images/generationsAuthentication
All requests must include your API key in the HTTP header:
Authorization: Bearer YOUR_API_KEYSupported Models
Imagen 4.0 Series
imagen-4.0-ultra-generate-001- Imagen 4.0 Ultra, highest quality image generationimagen-4.0-generate-001- Imagen 4.0 standard version, high-quality image generationimagen-4.0-fast-generate-001- Imagen 4.0 fast version, optimized generation speed
Imagen 3.0 Series
imagen-3.0-generate-002- Imagen 3.0 standard version (v2), mature and stable image generationimagen-3.0-fast-generate-001- Imagen 3.0 fast version, rapid image generation
See Available Models for complete model list.
Request Parameters
Required Parameters
| Parameter | Type | Description |
|---|---|---|
prompt | string | Image description text, describing the image you want to generate in detail |
model | string | Model ID to use, e.g., imagen-4.0-generate-001 |
Optional Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
n | integer | 1 | Number of images to generate (1-10) |
size | string | 1024x1024 | Image size, supports 256x256, 512x512, 1024x1024, 1024x1792, 1792x1024 |
quality | string | standard | Image quality: standard or hd |
style | string | vivid | Image style: vivid or natural |
response_format | string | url | Return format: url or b64_json |
user | string | - | Unique identifier for end user |
Code Examples
cURL
curl https://aiapi.services/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "imagen-4.0-generate-001",
"prompt": "A cute orange cat sitting on a windowsill watching the rain outside, watercolor style",
"n": 1,
"size": "1024x1024",
"quality": "hd"
}'Response Format
Standard Response
{
"created": 1702548600,
"data": [
{
"url": "https://oaidalleapiprodscus.blob.core.windows.net/private/...",
"revised_prompt": "A watercolor painting depicting an adorable orange cat sitting on a windowsill, gazing at the rain outside. Raindrops form beautiful patterns on the glass..."
}
]
}Base64 Response (response_format: “b64_json”)
{
"created": 1702548600,
"data": [
{
"b64_json": "iVBORw0KGgoAAAANSUhEUgAA...",
"revised_prompt": "A watercolor painting..."
}
]
}Response Field Descriptions
| Field | Type | Description |
|---|---|---|
created | integer | Creation timestamp |
data | array | Array of generated images |
data[].url | string | Image URL (valid for 24 hours) |
data[].b64_json | string | Base64-encoded image data |
data[].revised_prompt | string | Model-optimized prompt |
Related Resources
- Authentication - Learn how to get and use API keys
- Available Models - View all supported models and pricing
- Usage Query - Query API usage and quota
- Embeddings API - Text embedding vector generation
- Audio API - Speech recognition and text-to-speech
Last updated on