OpenAI API image generation endpoint {#ovmsdocsrestapiimage_generation}

May 21, 2026 · View on GitHub

API Reference

OpenVINO Model Server includes now the images/generations endpoint using OpenAI API. It is used to execute text2image task with OpenVINO GenAI pipeline. Please see the OpenAI API Reference for more information on the API. The endpoint is exposed via a path:

http://server_name:port/v3/images/generations

Request body must be in JSON format, and the request must have Content-Type: application/json header.

Example request

curl http://localhost:8000/v3/images/generations \
  -H "Content-Type: application/json" \
  -d '{
    "model": "black-forest-labs/FLUX.1-schnell",
    "prompt": "three cats",
    "num_inference_steps": 10,
    "size": "512x512"
  }'| jq -r '.data[0].b64_json' | base64 --decode > output.png

Example response

{
  "data": [
    {
      "b64_json": "..."
    }
  ]
}

Request

ParamOpenVINO Model ServerOpenAI /images/generations APITypeDescription
modelstring (required)Name of the model to use. Name assigned to a MediaPipe graph configured to schedule generation using desired embedding model. Note: This can also be omitted to fall back to URI based routing. Read more on routing topic TODO
promptstring (required)A text description of the desired image(s).
sizestring or null (default: auto)The size of the generated images. Must be in WxH format, example: 1024x768. Default model W/H will be used when using auto.
ninteger or null (default: 1)A number of images to generate. If you want to generate multiple images for the same combination of generation parameters and text prompts, you can use this parameter for better performance as internally computations will be performed with batch for Unet / Transformer models and text embeddings tensors will also be computed only once.
backgroundstring or null (default: auto)Allows to set transparency for the background of the generated image(s). Not supported for now.
streamboolean or null (default: false)Generate the image in streaming mode. Not supported for now.
stylestring or null (default: vivid)The style of the generated images. Recognized OpenAI settings, but not supported: vivid, natural.
moderationstring (default: auto)Control the content-moderation level for images generated by endpoint. Either low or auto. Not supported for now.
output_compressioninteger or null (default: 100)The compression level (0-100%) for the generated images. Not supported for now.
output_formatstring or nullThe format in which the generated images are returned. Not supported for now.
partial_imagesinteger or nullThe number of partial images to generate. This parameter is used for streaming responses that return partial images. Value must be between 0 and 3. When set to 0, the response will be a single image sent in one streaming event. Not supported for now.
qualitystring or null (default: auto)Quality of the image that will be generated. Recognized OpenAI qualities, but currently not supported: auto, high, medium, low, hd, standard
response_format⚠️string or null (default: b64_json)The format of the images in output. Recognized options: b64_json or url. Only b64_json is supported for now (default).
userstring (optional)A unique identifier representing your end-user that allows to detect abuse. Not supported for now.

Parameters supported via extra_body field

ParamOpenVINO Model ServerOpenAI /images/generations APITypeDescription
prompt_2string (optional)Prompt 2 for models which have at least two text encoders (SDXL/SD3/FLUX).
prompt_3string (optional)Prompt 3 for models which have at least three text encoders (SD3).
negative_promptstring (optional)Negative prompt for models which support negative prompt (SD/SDXL/SD3).
negative_prompt_2string (optional)Negative prompt 2 for models which support negative prompt (SDXL/SD3).
negative_prompt_3string (optional)Negative prompt 3 for models which support negative prompt (SD3).
num_images_per_promptinteger (default: 1)The same as base parameter n.
num_inference_stepsinteger (default: 50)Defines denoising iteration count. Higher values increase quality and generation time, lower values generate faster with less detail.
guidance_scalefloat (optional)Guidance scale parameter which controls how model sticks to text embeddings generated by text encoders within a pipeline. Higher value of guidance scale moves image generation towards text embeddings, but resulting image will be less natural and more augmented.
strengthfloat (optional) min: 0.0, max: 1.0Only for image editing endpoints. Indicates extent to transform the reference image. Must be between 0 and 1. image is used as a starting point and more noise is added the higher the strength. The number of denoising steps depends on the amount of noise initially added. When strength is 1, added noise is maximum and the denoising process runs for the full number of iterations specified in num_inference_steps. A value of 1 essentially ignores image parameter.
rng_seedinteger (optional)Seed for random generator.
max_sequence_lengthinteger (optional)This parameters limits max sequence length for T5 encoder for SD3 and FLUX models. T5 tokenizer output is padded with pad tokens to 'max_sequence_length' within a pipeline. So, for better performance, you can specify this parameter to lower value to speed-up T5 encoder inference as well as inference of transformer denoising model. For optimal performance it can be set to a number of tokens for prompt_3 / negative_prompt_3 for SD3 or prompt_2 for FLUX.
lora_alphasobject (optional)A JSON object mapping LoRA adapter aliases to alpha overrides for the active adapter(s). Adapter selection is driven by the model field (model name routing). This field only overrides the alphas of adapters already activated by model name routing — it does not independently select adapters. Aliases must match adapters registered via --source_loras at server start. Example: {"pokemon": 0.5} (when model is "pokemon" or a composite containing it). See LoRA Adapters documentation.

Response

ParamOpenVINO Model ServerOpenAI /images/generations APITypeDescription
dataarrayA list of generated images.
data.b64_jsonstringThe base64-encoded JSON of the generated image.
data.urlstringThe URL of the generated image if response_format is set to url. Unsupported for now.
data.revised_promptstringThe revised prompt that was used to generate the image. Unsupported for now.
usagedictionaryInfo about assessed tokens. Unsupported for now.
createdstringThe Unix timestamp (in seconds) of when the image was created. Unsupported for now.

Currently unsupported endpoints:

  • images/variations

Error handling

Endpoint can raise an error related to incorrect request in the following conditions:

  • Incorrect format of any of the fields based on the schema
  • Tokenized prompt exceeds the maximum length of the model context.
  • Model does not support requested width and height
  • Administrator defined min/max parameter value requirements are not met

References

End to end demo with image generation endpoint

Code snippets