Image generation & editing
Two endpoints, two models. ERNIE Image Turbo generates new images — including dense, accurate in-image text. FLUX.2 Klein edits an existing image from an instruction. Both return base64 PNG in the OpenAI images shape.
Generation
POST /v1/images/generations — model
ernie-image-turbo, €0.02 / image.
| Parameter | Meaning |
|---|---|
| prompt | What to draw. ERNIE follows text-in-image instructions well — quote the exact wording you want rendered. |
| size | "WxH", e.g. "1024x1024" — up to 2048 per side |
| seed | Optional. Same seed + same prompt reproduces the image. |
| n | Optional. Number of images, up to 4. |
$ curl https://api.axforge.ai/v1/images/generations \
-H "Authorization: Bearer $AXFORGE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "ernie-image-turbo",
"prompt": "Poster reading GRAND OPENING in bold red serif on cream paper",
"size": "1024x1024",
"seed": 7,
"n": 1
}' | jq -r '.data[0].b64_json' | base64 -d > poster.png
The response carries the PNG in data[].b64_json:
{
"data": [
{"b64_json": "iVBORw0KGgoAAAANSUhEUg..."}
]
}
A 1024×1024 generation takes ~32 s — measured on our production DGX Spark node, 2026-08. Set your client timeout accordingly.
Editing
POST /v1/images/edits — model flux2-klein-4b.
Send the source image plus an instruction; get the edited image back as
base64 PNG. €0.02 per image (launch pricing).
| Parameter | Meaning |
|---|---|
| prompt | The edit instruction, e.g. "make the sky overcast" |
| image | The source image, as base64 or a data URL. Use images for several sources. |
| n | Optional. Number of variants. |
$ IMG=$(base64 -w0 photo.png)
$ curl https://api.axforge.ai/v1/images/edits \
-H "Authorization: Bearer $AXFORGE_API_KEY" \
-H "Content-Type: application/json" \
-d "{
\"model\": \"flux2-klein-4b\",
\"prompt\": \"Make the sky overcast\",
\"image\": \"data:image/png;base64,$IMG\"
}" | jq -r '.data[0].b64_json' | base64 -d > edited.png
An edit takes ~8 s — measured on our production DGX Spark node, 2026-08.
Changing text inside an image
Regenerate, don't edit. To change words inside an
image, re-run /v1/images/generations with
ernie-image-turbo and the new wording — reuse your
seed to keep the composition close. ERNIE renders dense
in-image text accurately; instruction editors like FLUX mangle
letterforms.