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
| Field | Value |
|---|---|
prompt | required, up to 4000 characters |
n | 1 to 4 |
size | WIDTHxHEIGHT or auto. Defaults to 1024x1024 |
| — width and height | 256 to 1536 each |
| — divisibility | both must be multiples of 16 |
| — aspect ratio | between 1:3 and 3:1 |
| reference images | first 4 used on /v1/images/edits, extras silently dropped |
response_format | url (default) or b64_json |
stream | not supported |
| returned format | JPEG |
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:
| Field | What it does |
|---|---|
seed | fixes the sampling seed. The same prompt, size and seed return a byte-identical image |
guidance | how closely the model follows the prompt |
enhance_prompt | rewrites your prompt with a language model before generating. Off by default on the API |
Known issues
flux-2-kleindoes not appear inGET /v1/models. That endpoint lists the language, embedding and speech models; the image registry is separate. An unknown image model comes back asmodel_not_foundfrom the images endpoint itself.- Streaming is rejected outright, rather than ignored:
Streaming is not supported for image generation on this API.