Skip to content

Image generation & editing

Norlen offers three image endpoints: generation (text → image), editing (image + instruction → image) and composition (2–3 references + prompt → new image). All return the image in base64 and follow the spirit of OpenAI’s images API.

Generates an image from a text prompt. Follows OpenAI’s images/generations format.

POST https://api.norlen.io/v1/images/generations
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
FieldTypeRequiredDescription
modelstringyesqwen-image (default) or flux (FLUX.1 Kontext — sharper text, subject-preserving edits)
promptstringyesDescription of the desired image
sizestringnoDimensions, e.g. 1024x1024 (default and recommended)
nintegernoNumber of images (default 1)
Terminal window
curl https://api.norlen.io/v1/images/generations \
-H "Authorization: Bearer $NORLEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen-image",
"prompt": "A brass compass on a nautical chart, studio lighting",
"size": "1024x1024"
}'
{
"created": 1750000000,
"data": [
{ "b64_json": "iVBORw0KGgoAAAANSUhEUgAA..." }
]
}

The image comes in data[0].b64_json (base64-encoded PNG). Decode and save it, or display it with data:image/png;base64,<...>.

Edit an existing image by instruction — describe the change and Norlen applies it while preserving the rest of the scene (Qwen-Image-Edit model). Follows the spirit of OpenAI’s images/edits.

POST https://api.norlen.io/v1/images/edits
Authorization: Bearer YOUR_API_KEY

It accepts two input formats:

  • multipart/form-data (like the OpenAI SDK): an image file field plus a prompt with the instruction.
  • JSON: { "image": "<base64 or data URL>", "prompt": "..." }.
FieldTypeRequiredDescription
imagefile | stringyesThe image to edit — a file (multipart) or base64/data URL (JSON). Max ~10MB
promptstringyesThe edit instruction, e.g. “make the apple blue”. Up to 2000 characters
nintegernoNumber of variations (1–4, default 1)

Optional model field: qwen-image (default, Qwen-Image-Edit) or flux (FLUX.1 Kontext — better subject preservation).

Terminal window
curl https://api.norlen.io/v1/images/edits \
-H "Authorization: Bearer $NORLEN_API_KEY" \
-F image=@photo.png \
-F prompt="make the apple blue"

The response has the same shape as generation: { "created": ..., "data": [{ "b64_json": "..." }] }.

Composition (combine references → new image)

Section titled “Composition (combine references → new image)”

Send 2 to 3 reference images along with a prompt and get back a new image that combines elements from the references following your description — e.g. the person from one image holding the product from another, or a character placed inside a scene. Uses the Qwen-Image-Edit 2509 (multi-image) model.

POST https://api.norlen.io/v1/images/compose
Authorization: Bearer YOUR_API_KEY

Accepts two input formats:

  • multipart/form-data: repeat the image field for each reference (2–3×) + prompt.
  • JSON: { "images": ["<base64 or data URL>", ...], "prompt": "...", "size": "1024x1024" }.

In the prompt, refer to the images by upload order — “image 1”, “image 2”…

FieldTypeRequiredDescription
image / imagesfile[] | string[]yes2 to 3 references — repeated image fields (multipart) or an images array (JSON). Max ~10MB each
promptstringyesHow to combine the references. Up to 2000 chars
sizestringnoOutput dimensions, e.g. 1024x1024 (default)
nintegernoNumber of images (1–4, default 1)
Terminal window
curl https://api.norlen.io/v1/images/compose \
-H "Authorization: Bearer $NORLEN_API_KEY" \
-F image=@person.png \
-F image=@product.png \
-F prompt="the person from image 1 holding the product from image 2, studio light" \
-F size=1024x1024

The response has the same shape: { "created": ..., "data": [{ "b64_json": "..." }] }.

Each plan includes a monthly image quota — it covers generation, editing and composition (each call counts as one image). Images beyond the quota cost $0.03 each, debited from your balance. See Pricing & quotas.