Saltar al contenido principal
POST
/
image
/
generate
/api/v1/image/generate
curl --request POST \
  --url https://api.venice.ai/api/v1/image/generate \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "grok-imagine-image",
  "prompt": "A beautiful sunset over a mountain range",
  "cfg_scale": 7.5,
  "embed_exif_metadata": false,
  "format": "webp",
  "height": 1024,
  "hide_watermark": false,
  "inpaint": "<unknown>",
  "lora_strength": 50,
  "negative_prompt": "Clouds, Rain, Snow",
  "return_binary": false,
  "variants": 3,
  "safe_mode": false,
  "seed": 123456789,
  "steps": 8,
  "style_preset": "3D Model",
  "aspect_ratio": "1:1",
  "resolution": "1K",
  "quality": "high",
  "enable_web_search": false,
  "width": 1024
}
'
{
  "id": "generate-image-1234567890",
  "images": [
    "<string>"
  ],
  "timing": {
    "inferenceDuration": 123,
    "inferencePreprocessingTime": 123,
    "inferenceQueueTime": 123,
    "total": 123
  },
  "request": "<unknown>"
}

Opciones de tamaño

Los modelos de imagen utilizan parámetros de tamaño específicos del modelo:
  • Los modelos basados en píxeles aceptan width y height, por ejemplo venice-sd35 y qwen-image.
  • Los modelos basados en relación de aspecto aceptan aspect_ratio, por ejemplo qwen-image-2.
  • Los modelos con niveles de resolución aceptan tanto aspect_ratio como resolution.
Por ejemplo, gpt-image-2, nano-banana-2 y nano-banana-pro admiten valores de resolution de 1K, 2K y 4K:
{
  "model": "gpt-image-2",
  "prompt": "a cinematic wide shot of Venice at sunset",
  "aspect_ratio": "16:9",
  "resolution": "4K",
  "format": "png"
}
El mismo patrón de tamaño por nivel de resolución también se aplica a los modelos Nano Banana:
{
  "model": "nano-banana-pro",
  "prompt": "a serene canal in venice at sunset",
  "aspect_ratio": "16:9",
  "resolution": "2K"
}
Para los modelos que aceptan relación de aspecto pero no exponen niveles de resolución, envía aspect_ratio sin resolution:
{
  "model": "qwen-image-2",
  "prompt": "a serene canal in venice at sunset",
  "aspect_ratio": "16:9"
}
Para los modelos que usan dimensiones directas en píxeles, envía width y height en su lugar:
{
  "model": "venice-sd35",
  "prompt": "a serene canal in venice at sunset",
  "width": 1024,
  "height": 1024
}
Consulta Modelos de imagen o el endpoint de Models para conocer las opciones de tamaño admitidas por cada modelo antes de mezclar campos de tamaño entre modelos.

Niveles de calidad

Algunos modelos aceptan un parámetro opcional quality (low, medium, high) que intercambia fidelidad visual por coste. Actualmente lo admite gpt-image-2; otros modelos ignoran el parámetro.
{
  "model": "gpt-image-2",
  "prompt": "a cinematic wide shot of Venice at sunset",
  "aspect_ratio": "16:9",
  "resolution": "2K",
  "quality": "medium"
}
Cuando omites quality, el modelo utiliza su nivel predeterminado (high para gpt-image-2). El precio depende de la combinación de resolution y quality: los precios por nivel para gpt-image-2 (1K/2K/4K × low/medium/high) se exponen en model_spec.pricing.quality en el endpoint de Models y se listan en la vista general de precios.
La facturación según la calidad es la predeterminada para todos los llamadores de la API y del SDK: no se requiere ninguna cabecera de activación. Las solicitudes que omiten quality se facturan al nivel predeterminado del modelo (high para gpt-image-2).

Colección de Postman

Para ver más ejemplos, consulta esta Colección de Postman.

Autorizaciones

Authorization
string
header
requerido

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Encabezados

Accept-Encoding
string

Supported compression encodings (gzip, br). Only applied when return_binary is false.

Ejemplo:

"gzip, br"

Cuerpo

application/json
model
string
requerido

The model to use for image generation.

Ejemplo:

"grok-imagine-image"

prompt
string
requerido

The description for the image. Character limit is model specific and is listed in the promptCharacterLimit setting in the model list endpoint.

Required string length: 1 - 7500
Ejemplo:

"A beautiful sunset over a mountain range"

cfg_scale
number

CFG scale parameter. Higher values lead to more adherence to the prompt.

Rango requerido: 0 < x <= 20
Ejemplo:

7.5

embed_exif_metadata
boolean
predeterminado:false

Embed prompt generation information into the image's EXIF metadata.

Ejemplo:

false

format
enum<string>
predeterminado:webp

The image format to return. WebP are smaller and optimized for web use. PNG are higher quality but larger in file size.

Opciones disponibles:
jpeg,
png,
webp
Ejemplo:

"webp"

height
integer
predeterminado:1024

Height of the generated image.

Rango requerido: 0 < x <= 1280
Ejemplo:

1024

hide_watermark
boolean
predeterminado:false

Whether to hide the Venice watermark. Venice may ignore this parameter for certain generated content.

Ejemplo:

false

inpaint
any | null
obsoleto

This feature is deprecated and was disabled on May 19th, 2025. A revised in-painting API will be launched in the near future.

lora_strength
integer

Lora strength for the model. Only applies if the model uses additional Loras.

Rango requerido: 0 <= x <= 100
Ejemplo:

50

negative_prompt
string

A description of what should not be in the image. Character limit is model specific and is listed in the promptCharacterLimit constraint in the model list endpoint.

Maximum string length: 7500
Ejemplo:

"Clouds, Rain, Snow"

return_binary
boolean
predeterminado:false

Whether to return binary image data instead of base64.

Ejemplo:

false

variants
integer

Number of images to generate (1–4). Only supported when return_binary is false.

Rango requerido: 1 <= x <= 4
Ejemplo:

3

safe_mode
boolean
predeterminado:true

Whether to use safe mode. If enabled, this will blur images that are classified as having adult content.

Ejemplo:

false

seed
integer
predeterminado:0

Random seed for generation. If not provided, a random seed will be used.

Rango requerido: -999999999 <= x <= 999999999
Ejemplo:

123456789

steps
integer
predeterminado:8

Number of inference steps. This model does not support steps - this field is ignored.

Ejemplo:

8

style_preset
string

An image style to apply to the image. Visit https://docs.venice.ai/api-reference/endpoint/image/styles for more details.

Ejemplo:

"3D Model"

aspect_ratio
string

Aspect ratio (utilized by certain image models including Nano Banana). Examples: "1:1", "16:9".

Ejemplo:

"1:1"

resolution
string

Resolution (utilized by certain image models including Nano Banana). Examples: "1K", "2K", "4K".

Ejemplo:

"1K"

quality
enum<string>

Output quality for supported models (e.g. GPT Image 2 / GPT Image 2 Edit). Higher values can increase the final request charge. See the model list for supported options.

Opciones disponibles:
low,
medium,
high
Ejemplo:

"high"

Enable web search for the image generation task. This will allow the model to use the latest information from the web to generate the image. Only supported by certain models. If web search is used, additional credits are getting charged.

Ejemplo:

false

width
integer
predeterminado:1024

Width of the generated image.

Rango requerido: 0 < x <= 1280
Ejemplo:

1024

Respuesta

Successfully generated image

id
string
requerido

The ID of the request.

Ejemplo:

"generate-image-1234567890"

images
string[]
requerido

Base64 encoded image data.

timing
object
requerido
request
any | null

The original request data sent to the API.