Endpoint
POST /v1/images/generations
Prerequisites
Start h2oGPT with image generation enabled and at least one image model pre-loaded:Request parameters
The image generation model to use. When empty or omitted, h2oGPT uses the first available loaded model. See supported models below.
Text description of the image to generate.
Number of images to generate.
Dimensions of the generated image in
"WxH" format. Accepted values depend on the model; "1024x1024" works for most.Quality preset. Accepted value:
"standard".How to return the image data.
"b64_json" returns a base64-encoded JSON string; "url" returns a data URI.Classifier-free guidance scale. Controls how closely the output follows the prompt. Defaults are model-dependent.
Number of denoising steps. Higher values increase quality at the cost of latency. Defaults are model-dependent.
Response
Unix timestamp of when the images were generated.
Array of generated image objects.
Examples
Supported models
The following model identifiers are recognized. Pass the identifier as themodel parameter or use it in --visible_image_models at startup.
| Model | Notes |
|---|---|
sdxl_turbo | Fast single-step generation. Good for rapid iteration. |
sdxl | Full SDXL pipeline. Higher quality, slower than sdxl_turbo. |
SD3 | Stable Diffusion 3. Requires a HuggingFace access token. |
playv2 | PlaygroundAI v2. |
flux | Flux diffusion model. |
Decoding the response
When usingresponse_format="b64_json":
response_format="url", the value is a data:image/jpg;base64,... URI that can be set directly as an <img> src attribute or decoded with base64.b64decode.