Image

/api/v1/image/generate

Generate an image based on input parameters

Authentication: This endpoint accepts either a Bearer API key or a SIGN-IN-WITH-X header for x402 wallet-based authentication. The legacy X-Sign-In-With-X header is also accepted during migration. When using x402, a 402 Payment Required response indicates insufficient balance and includes top-up instructions.

post/api/v1/image/generate

Request

  • Base URL: https://api.venice.ai
  • URL: https://api.venice.ai/api/v1/image/generate
  • Auth: one of:
    • HTTP bearer
    • API key in header SIGN-IN-WITH-X

Headers

Accept-Encodingstring
Example:gzip, br

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

Request body

anon_user_idstring

Optional identifier for the API customer's end user. Combined with the Venice user id when attributing the request to upstream providers. Distinct from the discarded OpenAI user field. Must be printable ASCII and must not contain ||.

cfg_scalenumber

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

embed_exif_metadataboolean

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

format'jpeg' | 'png' | 'webp'

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

heightinteger

Height of the generated image.

hide_watermarkboolean

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

inpaintunknown
lora_strengthinteger

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

modelstring required

The model to use for image generation.

negative_promptstring

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.

promptstring required

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

return_binaryboolean

Whether to return binary image data instead of base64.

variantsinteger

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

safe_modeboolean

Whether to blur images classified as adult content. Defaults to true. Set to false to receive unblurred output. No Pro subscription is required, and the mature filter setting in the Venice app does not affect this. The x-venice-is-blurred response header reports whether the returned image was blurred.

seedinteger

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

stepsinteger

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

style_presetstring

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

aspect_ratiostring

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

resolutionstring

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

quality'low' | 'medium' | 'high'

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.

enable_web_searchboolean

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.

disable_prompt_optimization_thinkingboolean

Skip the model's prompt-optimization thinking step for faster generation. Only supported by models with supportsOptimizePromptThinking; ignored by others. Omit to use the model default.

enhance_promptboolean

Rewrite the prompt before generation to add clarifying visual detail. Additional credits are charged when a rewrite is generated. Adds up to ~30 seconds before generation starts. When enhancement is applied, the final prompt is returned URL-encoded in the x-venice-enhanced-prompt response header. Defaults to false.

widthinteger

Width of the generated image.

Example request

{
  "anon_user_id": "end-user-123",
  "cfg_scale": 7.5,
  "format": "webp",
  "height": 1024,
  "lora_strength": 50,
  "model": "grok-imagine-image",
  "negative_prompt": "Clouds, Rain, Snow",
  "prompt": "A beautiful sunset over a mountain range",
  "variants": 3,
  "seed": 123456789,
  "steps": 8,
  "style_preset": "3D Model",
  "aspect_ratio": "1:1",
  "resolution": "1K",
  "quality": "high",
  "width": 1024,
  "style_references": [
    {
      "image": "https://example.com/style-reference.png",
      "strength": 0.5
    }
  ]
}

Response

Successfully generated image

idstring required

The ID of the request.

imagesstring[] required

Base64 encoded image data.

requestunknown

Example response

{
  "id": "generate-image-1234567890"
}

Changes

No recorded changes to this operation across all 1 revision of this API.