Skip to content

Image generation & editing

Norlen offers two image endpoints: generation (text → image) and editing (image + instruction → image). Both 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://app.norlen.io/api/v1/images/generations
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
FieldTypeRequiredDescription
modelstringyesqwen-image
promptstringyesDescription of the desired image
sizestringnoDimensions, e.g. 1024x1024 (default and recommended)
nintegernoNumber of images (default 1)
Terminal window
curl https://app.norlen.io/api/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://app.norlen.io/api/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)

There is no model field: editing uses the Qwen-Image-Edit model automatically.

Terminal window
curl https://app.norlen.io/api/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": "..." }] }.

Each plan includes a monthly image quota — it covers both generation and editing. Images beyond the quota cost $0.03 each, debited from your balance. See Pricing & quotas.