Docs

Images

Helmcode generates images with flux-2-klein through the OpenAI-compatible image endpoints, so the OpenAI SDKs work against it by changing the base URL.

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, which is the only image model served today.

Edit

Send one or more reference images as multipart and the model works from them. The field is image, repeated (or image[]):

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. The same prompt, size and seed return a byte-identical image
guidancehow closely the model follows the prompt
enhance_promptrewrites your prompt with a language model before generating. Off by default on the API

Known issues

  • flux-2-klein does not appear in GET /v1/models. That endpoint lists the language, embedding and speech models; the image registry is separate. 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.