Skip to navigation

Image Generation

No image models are listed on HyperFlow HI today. This page documents the endpoint for when they join the catalog: check the Marketplace or GET /v1/models for models with "mode": "image".

HyperFlow HI generates images through the OpenAI Images API: POST /v1/images/generations to create images from a prompt, and POST /v1/images/edits to change an image you send.

Find an image model

  • On the Marketplace, pick the Image type. Each model’s page lists its price.
  • From the API, GET /v1/models lists the models you can call; image models have "mode": "image".
curl https://api.hi.hyperflow.fun/v1/models \
-H "Authorization: Bearer $HYPERFLOW_API_KEY"

Generate an image

The samples use the OpenAI SDK set up as in the Quickstart, plus import base64 in Python and import fs from 'node:fs' in TypeScript.

curl https://api.hi.hyperflow.fun/v1/images/generations \
-H "Authorization: Bearer $HYPERFLOW_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "google/gemini-2.5-flash-image",
"prompt": "A paper boat on a calm lake, soft morning light",
"n": 1
}'

The samples use google/gemini-2.5-flash-image; any model with "mode": "image" works the same way. size and quality are listed under Options; send them only if the model offers them.

Edit an image

POST /v1/images/edits takes one or more images and a prompt describing the change. Add a mask (a PNG the same size as the image) whose transparent areas mark where to edit. It’s sent as a form upload, like OpenAI’s.

curl https://api.hi.hyperflow.fun/v1/images/edits \
-H "Authorization: Bearer $HYPERFLOW_API_KEY" \
-F model="google/gemini-2.5-flash-image" \
-F image=@room.png \
-F mask=@window-mask.png \
-F prompt="Add a tall green plant by the window"

Options

ParameterGenerateEditNotes
model✓✓Required
prompt✓✓Required. What to draw, or what to change
image✓Required. The image or images to edit
mask✓Transparent areas mark where to edit
n✓✓How many images. Each model has its own maximum
size✓✓Such as 1024x1024, on models that offer it. Defaults to the model’s default
quality✓✓Such as low, medium or high, on models that offer it. Defaults to the model’s default
background✓✓auto, transparent or opaque, on models that support it
output_format✓✓png, jpeg or webp, on models that support it
style✓vivid or natural, on models that support it

Any other field is removed before the request reaches the model.

Sizes, qualities and counts

size, quality and n go to the model as you send them, and the model decides what it accepts. A value it doesn’t offer is rejected with a 400, and a rejected request isn’t charged. You’re held for n images and never get more than n.

Response

Every image comes back inline as base64, in data[].b64_json:

{
"created": 1782886429,
"data": [
{ "b64_json": "iVBORw0KGgo..." }
],
"usage": { "input_tokens": 14, "output_tokens": 4160, "total_tokens": 4174 }
}
  • Images are never returned as links, so response_format has no effect. Decode each image and save it.
  • usage appears for models billed by tokens.

Best practices

  • Be specific. Subject, setting, style, lighting and framing all help: “a ceramic mug on an oak desk, top-down, soft window light” beats “a mug”.
  • Start small. Settle the prompt with one image at the model’s defaults, then add size or quality if the model offers them.
  • Ask for one image at a time while exploring. n multiplies the cost.

Troubleshooting

400 “The model rejected the request”. The model doesn’t offer the size, quality, n or another option you sent. Leave them out to get the model’s defaults, then change one at a time.

400 ”… is not available right now”. The model can’t be used at the moment. Try another image model.

422. The model answered without an image, for example because it declined the prompt. Rephrase it, or try another image model.

404. The model id is wrong, or it isn’t an image model. Check GET /v1/models.

402. The request is held for every image you ask for; lower n, or top up.

Billing

Each image model is priced one of two ways, shown on its page:

  • Per image. A request is held for n images at the model’s per-image price.
  • By tokens, for models that charge for the prompt and the image’s tokens. A request is held for its prompt plus a reserve for each image.

Either way, you’re charged what the model actually made, and the rest of the hold is released.