Docs

Images

Helmcode serves two image models through the OpenAI-compatible image endpoints, so the OpenAI SDKs work against them by changing the base URL: flux-2-klein (default; text-to-image and image-to-image with references) and qwen-image-2.1 (text-to-image).

Generate

curl https://api.helmcode.com/v1/images/generations \
  -H "Authorization: Bearer $HELMCODE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "a lighthouse at dusk, long exposure",
    "size": "1024x1024",
    "n": 1
  }'

Python

from openai import OpenAI

client = OpenAI(
    base_url="https://api.helmcode.com/v1",
    api_key="sk-hke_your-key-here",
)

img = client.images.generate(
    model="flux-2-klein",
    prompt="a lighthouse at dusk, long exposure",
    size="1024x1024",
)
print(img.data[0].url)

model is optional: omitted, it resolves to flux-2-klein.

modeltext→imagereferences / editssize range
flux-2-kleinyesup to 4 on /v1/images/edits256–1536
qwen-image-2.1yesno512–1280

The live catalog is also queryable: GET /v1/images/models with your API key (or GET /api/images/models from a console session) returns every image model with its supports_edits flag.

Edit

Send one or more reference images as multipart and the model works from them. The field is image, repeated (or image[]). This endpoint is flux-2-klein only: qwen-image-2.1 is text-to-image and rejects reference images with a 400:

curl https://api.helmcode.com/v1/images/edits \
  -H "Authorization: Bearer $HELMCODE_API_KEY" \
  -F image=@photo.png \
  -F prompt="same composition, at night" \
  -F size=1024x1024

Only the first 4 reference images are used. Sending more is not an error and nothing tells you: the extras are dropped before the request leaves us. mask is rejected outright, with mask is not supported for this model.

Limits

FieldValue
promptrequired, up to 4000 characters
n1 to 4
sizeWIDTHxHEIGHT or auto. Defaults to 1024x1024
— width and height256 to 1536 each
— divisibilityboth must be multiples of 16
— aspect ratiobetween 1:3 and 3:1
reference imagesfirst 4 used on /v1/images/edits, extras silently dropped
response_formaturl (default) or b64_json
streamnot supported
returned formatJPEG

A url is presigned and valid for one hour; the link carries its own X-Amz-Expires=3600 if you want to check. If you need to keep the image, download it inside that window or ask for b64_json and write the bytes yourself.

The size rules are checked before anything is generated, and the errors name the rule they broke:

n must be between 1 and 4 for model 'flux-2-klein'.
size width and height must both be divisible by 16.
size width and height must each be between 256 and 1536 for model 'flux-2-klein'.
size aspect ratio must be between 1:3 and 3:1.

Beyond the OpenAI fields

Three extras, sent through extra_body on the OpenAI SDKs or as plain fields on a raw request:

FieldWhat it does
seedfixes the sampling seed, an integer in 0..2147483647. The same prompt, size and seed return a byte-identical image
guidancehow closely the model follows the prompt (flux-2-klein only)
enhance_promptrewrites your prompt with a language model before generating. Off by default on the API

Known issues

  • Image models do not appear in GET /v1/models. That endpoint lists the language, embedding and speech models; the image registry lives in GET /api/images/models instead. An unknown image model comes back as model_not_found from the images endpoint itself.
  • Streaming is rejected outright, rather than ignored: Streaming is not supported for image generation on this API.