Image Generation

Generate image from image

Generates an edited image from a source image and a text prompt using an image-to-image model. Supply the source image with image_url (an uploaded S3 filename from Get image upload URL, or a reachable URL). This operation is asynchronous: the response returns a job_id with status queued. Poll Get image result until the status is completed to retrieve the result. Requires an image-to-image model; text-to-image models return a modality.incompatible error.

post/images/edits

Request

  • Base URL: https://console.hyperstack.cloud/ai/api/v1
  • URL: https://console.hyperstack.cloud/ai/api/v1/images/edits
  • Auth: API key in header api_key

Request body

modelstring required

ID of the image-to-image model to use, such as FLUX.1-Kontext-dev. Use the model_name from List base models; the model must support the image-to-image modality.

promptstring required

Text description of the edit to apply to the source image.

image_urlstring

URL or S3 filename of the source image to edit. Pass the filename returned by Get image upload URL after uploading, or a publicly reachable image URL.

image_urlsstring[]

Multiple source images to edit, as URLs or S3 filenames returned by Get image upload URL. Use instead of image_url when the model accepts several inputs.

negative_promptstring

Text describing what to exclude from the result.

image_sizestring

Output image size, as an aspect-ratio preset or an explicit WIDTHxHEIGHT value.

num_imagesinteger

Number of images to generate.

num_inference_stepsinteger

Number of denoising steps. Higher values can improve quality at the cost of speed.

guidance_scalenumber

How closely the result follows the prompt. Higher values follow the prompt more strictly.

output_format'png' | 'jpeg' | 'webp'

Format of the returned image.

presetstring

Named quality or style preset, when supported by the model.

Response

Accepted

job_idinteger

Identifier of the asynchronous image job. Poll Get image result to retrieve the result.

statusstring

Initial job status, such as queued.

Changes

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