# Images


# 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.05 / 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

```
$ 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..."}
  ]
}
```

Generation is not instant — expect tens of seconds per image. 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.06 per edit (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. |  |

    curl

```
$ 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
```

Edits are faster than full generations — seconds-scale rather than
    tens of seconds.

## 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.

      &larr; Embeddings
      Speech & music &rarr;



Source: https://axforge.ai/docs/images/
