Skip to main content
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

EndpointPurposeWhen to use
POST /image/generateNative Venice image generation APIUse this for full feature support
GET /image/stylesList available style presetsUse this before sending style_preset
POST /images/generationsOpenAI-compatible image generation APIUse 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

ParameterTypeRequiredDefaultDescription
modelstringYes-Model ID to use for generation
promptstringYes-What to generate
negative_promptstringNo-What to avoid in the image
widthintegerNo1024Output width in pixels
heightintegerNo1024Output height in pixels
formatstringNowebpOutput format: jpeg, png, or webp
variantsintegerNo1Number of images to generate (1-4), only when return_binary is false
return_binarybooleanNofalseReturn raw image bytes instead of base64 JSON
safe_modebooleanNotrueBlur adult content when enabled
seedintegerNorandomReuse the same seed for more consistent iterations
cfg_scalenumberNomodel-dependentHigher values push the model to follow the prompt more closely
style_presetstringNo-Apply a preset style from Image Styles
aspect_ratiostringConditional-Used by models that support ratio-based sizing
resolutionstringConditional-Used by models that support resolution tiers such as 1K, 2K, or 4K
enable_web_searchbooleanConditionalfalseAllows 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

  1. Start with the subject, then add medium, lighting, composition, and mood.
  2. Put must-avoid details in negative_prompt instead of overloading the main prompt.
  3. Reuse seed when iterating so you can compare prompt changes without fully changing the composition.
  4. Keep sizing model-aware. Some models work best with width/height, while others expect aspect_ratio and resolution.
  5. Use variants during exploration, then switch back to a single output once you’ve locked in the direction.

Errors

StatusMeaningAction
400Invalid request parametersCheck field names, types, and model-specific constraints
401Authentication failed or model requires a higher access tierCheck your API key and model access
402Insufficient balanceAdd credits at venice.ai/settings/api
415Invalid content typeSend JSON with Content-Type: application/json
429Rate limit exceededRetry with backoff
500Inference processing failedRetry the request
503Model at capacityRetry 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.