image-gen.v1

docs/capabilities/image-gen.v1.md · wiki index

image-gen.v1

Status: v1. A published shape is frozen by spec.md section 20.1. Capability key: image-gen Route: POST /image/generate

Parts in

kindrolerequiredmeaning
textpromptyes, one or morea description of the image to make.
imagereferencenoan image whose content guides the job.

Parameters

The plugin validates these. A parameter that is not in this table is ignored, not an error (R26). A default of catalogue means the model entry in the catalogue gives the value. A default of none means the plugin chooses.

nametypedefaultmeaning
sizestringcataloguethe image size, as <width>x<height>
stepsuintcataloguethe number of denoise steps
guidancefloatcataloguehow closely the job follows the prompt
seeduintnonea fixed seed for a repeatable job

Channels out

channelmimepayload
imageimage/pngone whole image
progressapplication/json{stage, pct} during generation

Terminal metadata

done.meta is vocabulary-defined. The core stores it and never reads it. done without meta means {}.

keytypemeaning
modelstringthe served name that ran the job
widthuintthe width of the produced image, in pixels
heightuintthe height of the produced image, in pixels

These keys are present when outcome is completed. They are absent when the outcome is cancelled or expired.

Request

POST /image/generate
{
  "model": "<served-name>",
  "input": [
    {"kind": "text", "role": "prompt", "text": "a cold machine room at night"},
    {"kind": "image", "role": "reference", "mime": "image/png", "inline": "<png bytes>"}
  ],
  "params": {"size": "1024x1024", "steps": 28, "guidance": 4.5, "seed": 7},
  "stream": true
}

Response, no stream

{"job": "019...", "outcome": "completed",
 "image": {"mime": "image/png", "inline": "<png bytes>"},
 "usage": {"images": 1, "pixels": 1048576},
 "meta": {"model": "<served-name>", "width": 1024, "height": 1024}}

Stream

Image bytes travel in the done frame. The stream carries progress only.

event  ch=progress {"stage": "denoise", "pct": 0.4}
event  ch=progress {"stage": "denoise", "pct": 0.9}
done   outcome=completed usage={"images":1,"pixels":1048576}
       artifacts=[{"channel":"image","mime":"image/png","inline":"<png bytes>"}]
       meta={"model":"<served-name>","width":1024,"height":1024}

Rules

  1. At least one text part with role prompt is required. A request with no such part is invalid_part.
  2. A text part with a role other than prompt is invalid_part.
  3. An image part must carry role reference. An image part with another role is invalid_part.
  4. An audio, video, tokens, or json part is invalid_part.
  5. One job produces exactly one image. A job with zero or two image artifacts is failed.
  6. The mime of the image artifact is always image/png. It is a constant, not a parameter.
  7. An event frame never carries image bytes. The image is one artifact in done.
  8. meta.width and meta.height are the pixel size of the produced image.
  9. size names a size that the plugin declares. An undeclared value gives a refusal that names size.
  10. The image size equals the size value that the job used.
  11. usage.images is 1 when the outcome is completed. It counts one image.
  12. usage.pixels equals meta.width multiplied by meta.height.
  13. A progress event carries {stage, pct}. pct stays between 0 and 1 and never decreases.
  14. Two jobs with the same seed and the same input make the same image bytes.
  15. seed is absent from the terminal metadata. The plugin never reports it.
  16. No event follows a cancel. The terminal frame is done with outcome = cancelled.
  17. The plugin emits image and progress. It emits no other channel for this job.