POST /v1/media/images renders synchronously: the reply carries the finished files and what the render cost. There is no job to poll — an image is done before the request returns, so it is never a media_job. The same render is what an agent’s generate_image tool does; the catalogue is shared. Images are not model calls: the image catalogue is its own, and an image model is never an agent’s model.
The image generation object
string
Always
image_generation.string
The model that rendered, which is the one you named or the default it picked.
File[]
One file per rendered image,
n of them when the model produced that many. Each is published and carries source.type = image_generation.Generate images
POST /v1/media/images → 200 OK — scope agents:write, Idempotency-Key required.
string
required
What to render.
string
A model id from
GET /v1/media/models?kind=image. Omitted, the cheapest priced image model is used; an id the catalogue does not know is validation_failed.string[]
Up to 4 public
http(s) reference images for an edit or an image-to-image render. A private or loopback host is validation_failed.integer
How many images, 1–4. Default 1. Every one is filed — none is dropped.
string
Such as
16:9 or 1:1. Passed to the model as-is; a model that does not take one ignores it.integer
Repeat an earlier result, on models that honour a seed.
content_type on the file says which. Not on the request today: an explicit size or resolution, quality, output_format, a transparent background, more than 4 references or 4 outputs, and any per-model or per-provider passthrough. A body that carries one of them is validation_failed, not quietly dropped; ask for the field if you need it.
GET /v1/files/{id}?download=true.
Billing
A render is billed what it actually cost, once it has happened, on the media tier; nothing is quoted or held beforehand, because the catalogue publishes no price for most models and a picture costs cents. There is no balance check before the render: a low balance goes negative by the cost of the image rather than turning the request away. The debit settles under the request’s idempotency key, so a replayed request returns the same files and charges once. A render the model refuses or fails isprovider_error and is not billed.
In a session
An agent renders with thegenerate_image tool — the same route, the same catalogue, the same fields (prompt, model?, image_urls?, n?, aspect_ratio?, seed?) — and gets the file_ids back in the same turn, because the render is synchronous. Two differences from calling the route yourself:
- The model default is yours to set.
tools.configs.generate_image.config.modelson the agent names the model that runs when the agent does not choose one; with none pinned, the cheapest priced image model is used, as here. It is a default, not an allow-list — the agent may still name any id the catalogue publishes. - The bill lands on the agent. The debit carries the
session_idand settles against the agent’s budget as themediacomponent; a render through this route carries no session and settles against the organization.
Errors
Stock photos
GET /v1/media/stock — scope agents:read
Searches a stock photo library and returns up to count photos, each with a direct image URL at the size you asked for, a small preview, and the photographer credit the licence asks you to show. Free: a search is booked to the ledger as a search line at $0, so it shows up in a spend breakdown as a call that happened, not as one that was never priced.
string
required
What the photo should show. 1–200 characters.
number
default:"10"
How many photos to return, 1–30. There is no cursor:
count is the whole page.string
landscape, portrait or square.string
A dominant colour — a name such as
red, blue, brown, black, white, or a hex value such as #978E82.string
The image size
url points at: small, medium or large. Default large. Picks the rendition only — it does not narrow the results.The stock photo object
string
Always
stock_photo.string
The library’s own id for the photo. Opaque and unprefixed — it is not a Vetta resource id and cannot be fetched on its own; keep the photo by importing its
url as a file.number
Pixel width of the original.
number
Pixel height of the original.
width > height is a landscape photo.string
A direct image URL at the requested
size. Fetchable without a key.string
A small thumbnail, for picking before downloading.
string | null
A one-line description of the photo, when the library has one.
string | null
Who took it. The licence asks that this credit be shown wherever the photo is used.
string | null
The page to link the credit to. This is the one field that may point at the library’s own domain.
string | null
The photo’s average colour as a hex value.
Keeping a photo
A result is a URL, not a file. To hold the bytes as afil_ — so a session can attach it, or a page can serve it from your own storage — import url through Files; the imported file records where it came from as a URL import.
In a session
Agents reach the same search as thefind_stock_photo tool, which takes query, count and orientation. It is on by default with permission allow.