Pular para o conteúdo 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>"
}

Opções de dimensionamento

Os modelos de imagem usam parâmetros de dimensionamento específicos por modelo:
  • Modelos baseados em pixels aceitam width e height, por exemplo venice-sd35 e qwen-image.
  • Modelos baseados em proporção de aspecto aceitam aspect_ratio, por exemplo qwen-image-2.
  • Modelos com níveis de resolução aceitam tanto aspect_ratio quanto resolution.
Por exemplo, gpt-image-2, nano-banana-2 e nano-banana-pro suportam valores de resolution de 1K, 2K e 4K:
{
  "model": "gpt-image-2",
  "prompt": "a cinematic wide shot of Venice at sunset",
  "aspect_ratio": "16:9",
  "resolution": "4K",
  "format": "png"
}
O mesmo padrão de dimensionamento por nível de resolução também se aplica aos modelos Nano Banana:
{
  "model": "nano-banana-pro",
  "prompt": "a serene canal in venice at sunset",
  "aspect_ratio": "16:9",
  "resolution": "2K"
}
Para modelos que aceitam proporção de aspecto, mas não expõem níveis de resolução, envie aspect_ratio sem resolution:
{
  "model": "qwen-image-2",
  "prompt": "a serene canal in venice at sunset",
  "aspect_ratio": "16:9"
}
Para modelos que usam dimensões diretas em pixels, envie width e height em vez disso:
{
  "model": "venice-sd35",
  "prompt": "a serene canal in venice at sunset",
  "width": 1024,
  "height": 1024
}
Consulte Modelos de imagem ou o endpoint de Modelos para conhecer as opções de dimensionamento suportadas de cada modelo antes de misturar campos de dimensionamento entre modelos.

Níveis de qualidade

Alguns modelos aceitam um parâmetro opcional quality (low, medium, high) que troca fidelidade visual por custo. Atualmente suportado por gpt-image-2; outros modelos ignoram o parâmetro.
{
  "model": "gpt-image-2",
  "prompt": "a cinematic wide shot of Venice at sunset",
  "aspect_ratio": "16:9",
  "resolution": "2K",
  "quality": "medium"
}
Quando você omite quality, o modelo usa seu nível padrão (high para gpt-image-2). O preço depende da combinação de resolution e quality — os preços por nível para gpt-image-2 (1K/2K/4K × low/medium/high) são expostos em model_spec.pricing.quality no endpoint de Modelos e listados na visão geral de preços.
Preços baseados em qualidade são o padrão para todas as chamadas de API e SDK — não é necessário cabeçalho de opt-in. Requisições que omitem quality são cobradas pelo nível padrão do modelo (high para gpt-image-2).

Coleção do Postman

Para exemplos adicionais, consulte esta coleção do Postman.

Autorizações

Authorization
string
header
obrigatório

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

Cabeçalhos

Accept-Encoding
string

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

Exemplo:

"gzip, br"

Corpo

application/json
model
string
obrigatório

The model to use for image generation.

Exemplo:

"grok-imagine-image"

prompt
string
obrigatório

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
Exemplo:

"A beautiful sunset over a mountain range"

cfg_scale
number

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

Intervalo obrigatório: 0 < x <= 20
Exemplo:

7.5

embed_exif_metadata
boolean
padrão:false

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

Exemplo:

false

format
enum<string>
padrão:webp

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

Opções disponíveis:
jpeg,
png,
webp
Exemplo:

"webp"

height
integer
padrão:1024

Height of the generated image.

Intervalo obrigatório: 0 < x <= 1280
Exemplo:

1024

hide_watermark
boolean
padrão:false

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

Exemplo:

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.

Intervalo obrigatório: 0 <= x <= 100
Exemplo:

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
Exemplo:

"Clouds, Rain, Snow"

return_binary
boolean
padrão:false

Whether to return binary image data instead of base64.

Exemplo:

false

variants
integer

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

Intervalo obrigatório: 1 <= x <= 4
Exemplo:

3

safe_mode
boolean
padrão:true

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

Exemplo:

false

seed
integer
padrão:0

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

Intervalo obrigatório: -999999999 <= x <= 999999999
Exemplo:

123456789

steps
integer
padrão:8

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

Exemplo:

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.

Exemplo:

"3D Model"

aspect_ratio
string

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

Exemplo:

"1:1"

resolution
string

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

Exemplo:

"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.

Opções disponíveis:
low,
medium,
high
Exemplo:

"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.

Exemplo:

false

width
integer
padrão:1024

Width of the generated image.

Intervalo obrigatório: 0 < x <= 1280
Exemplo:

1024

Resposta

Successfully generated image

id
string
obrigatório

The ID of the request.

Exemplo:

"generate-image-1234567890"

images
string[]
obrigatório

Base64 encoded image data.

timing
object
obrigatório
request
any | null

The original request data sent to the API.