Image generation on Venice is synchronous. Send a prompt to /image/generate and receive your image in the same response, either as base64 inside JSON or as raw binary when return_binary is true.
Endpoints
| Endpoint | Purpose | When to use |
|---|
POST /image/generate | Native Venice image generation API | Use this for full feature support |
GET /image/styles | List available style presets | Use this before sending style_preset |
POST /images/generations | OpenAI-compatible image generation API | Use this when migrating existing OpenAI image clients |
Step 1: Send a generation request
Request:
POST https://api.venice.ai/api/v1/image/generate
Authorization: Bearer $VENICE_API_KEY
Content-Type: application/json
{
"model": "qwen-image-2",
"prompt": "A cinematic photo of a gondola passing through a narrow Venice canal at blue hour, warm window lights reflecting on the water",
"negative_prompt": "blurry, low quality, distorted anatomy, text, watermark",
"width": 1024,
"height": 1024,
"format": "webp"
}
Response (200):
{
"id": "generate-image-1234567890",
"images": [
"UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoQABAAPm..."
],
"timing": {
"inferenceDuration": 1840,
"inferencePreprocessingTime": 22,
"inferenceQueueTime": 31,
"total": 1893
}
}
The images array contains base64-encoded image data. Decode the first item to save or display it. timing.total is the full request duration in milliseconds.
Step 2: Decode and save the image
import base64
import os
import requests
response = requests.post(
"https://api.venice.ai/api/v1/image/generate",
headers={
"Authorization": f"Bearer {os.environ['VENICE_API_KEY']}",
"Content-Type": "application/json",
},
json={
"model": "qwen-image-2",
"prompt": "A cinematic photo of a gondola passing through a narrow Venice canal at blue hour, warm window lights reflecting on the water",
"width": 1024,
"height": 1024,
"format": "webp",
},
)
data = response.json()
image_bytes = base64.b64decode(data["images"][0])
with open("output.webp", "wb") as f:
f.write(image_bytes)
print(f"Saved image from request {data['id']}")
Step 3: Return binary instead of JSON (optional)
If you want the response body to be the image file itself, set return_binary: true. This is useful when you want to stream or save the image directly without base64 decoding.
curl https://api.venice.ai/api/v1/image/generate \
-H "Authorization: Bearer $VENICE_API_KEY" \
-H "Content-Type: application/json" \
-o output.png \
-d '{
"model": "qwen-image-2",
"prompt": "Minimalist poster of a moonlit Venetian bridge in deep blue tones",
"format": "png",
"return_binary": true
}'
When return_binary is true, the response body is raw image/jpeg, image/png, or image/webp data based on the format you requested.
variants is only supported when return_binary is false.
Step 4: List available image styles (optional)
If you want to use style_preset, first fetch the available styles from /image/styles:
curl https://api.venice.ai/api/v1/image/styles \
-H "Authorization: Bearer $VENICE_API_KEY"
Response (200):
[
"3D Model",
"Analog Film",
"Anime",
"Cinematic",
"Digital Art"
]
Then pass one of those values into your generation request:
{
"model": "qwen-image-2",
"prompt": "A futuristic Venice skyline at sunrise",
"style_preset": "Cinematic"
}
Use the styles endpoint when you want exact preset names instead of guessing them.
Request Parameters
| Parameter | Type | Required | Default | Description |
|---|
model | string | Yes | - | Model ID to use for generation |
prompt | string | Yes | - | What to generate |
negative_prompt | string | No | - | What to avoid in the image |
width | integer | No | 1024 | Output width in pixels |
height | integer | No | 1024 | Output height in pixels |
format | string | No | webp | Output format: jpeg, png, or webp |
variants | integer | No | 1 | Number of images to generate (1-4), only when return_binary is false |
return_binary | boolean | No | false | Return raw image bytes instead of base64 JSON |
safe_mode | boolean | No | true | Blur adult content when enabled |
seed | integer | No | random | Reuse the same seed for more consistent iterations |
cfg_scale | number | No | model-dependent | Higher values push the model to follow the prompt more closely |
style_preset | string | No | - | Apply a preset style from Image Styles |
aspect_ratio | string | Conditional | - | Used by models that support ratio-based sizing |
resolution | string | Conditional | - | Used by models that support resolution tiers such as 1K, 2K, or 4K |
enable_web_search | boolean | Conditional | false | Allows supported models to use current web information; adds extra cost |
Validation is model-specific. Check Image Models and the Models API before relying on a parameter across multiple models.
Model-specific options
High-resolution generation
Some image models support aspect_ratio and resolution instead of simple width and height. For example:
{
"model": "nano-banana-2",
"prompt": "Editorial product photo of a luxury watch on black marble, dramatic studio lighting",
"aspect_ratio": "16:9",
"resolution": "2K"
}
Use Image Models to see which models support higher resolutions and how they are priced.
Style presets
If the selected model supports it, style_preset lets you steer the output without rewriting your whole prompt. You can fetch valid preset names from Image Styles:
{
"model": "qwen-image-2",
"prompt": "A futuristic Venice skyline at sunrise",
"style_preset": "3D Model"
}
See Image Styles for the current style list.
OpenAI-compatible endpoint
If you’re already using OpenAI image SDKs or existing DALL-E integrations, Venice also supports POST /images/generations. It offers a simpler request format, but fewer features than the native Venice endpoint.
Request:
{
"model": "qwen-image-2",
"prompt": "A clean isometric illustration of an AI control room",
"size": "1024x1024",
"response_format": "b64_json"
}
Use the OpenAI-compatible route for faster migrations. Use /image/generate when you need Venice-specific options such as cfg_scale, style_preset, variants, or binary responses.
Prompting tips
- Start with the subject, then add medium, lighting, composition, and mood.
- Put must-avoid details in
negative_prompt instead of overloading the main prompt.
- Reuse
seed when iterating so you can compare prompt changes without fully changing the composition.
- Keep sizing model-aware. Some models work best with
width/height, while others expect aspect_ratio and resolution.
- Use
variants during exploration, then switch back to a single output once you’ve locked in the direction.
Errors
| Status | Meaning | Action |
|---|
400 | Invalid request parameters | Check field names, types, and model-specific constraints |
401 | Authentication failed or model requires a higher access tier | Check your API key and model access |
402 | Insufficient balance | Add credits at venice.ai/settings/api |
415 | Invalid content type | Send JSON with Content-Type: application/json |
429 | Rate limit exceeded | Retry with backoff |
500 | Inference processing failed | Retry the request |
503 | Model at capacity | Retry after a short delay |
When Safe Venice is enabled, inspect response headers such as x-venice-is-blurred and x-venice-is-content-violation if you need to detect moderation outcomes programmatically.
Available Models
See Image Models for the current model list, pricing, and feature support.