Image generation API
Image generation is compatible with the OpenAI Images protocol. Only image models (priced per image in the model catalog) can be used; the chat endpoints do not accept image models.
Generate images
POST https://api.admesh.ai/v1/images/generations
curl https://api.admesh.ai/v1/images/generations \
-H "Authorization: Bearer $ADMESH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "<model-id>",
"prompt": "A watercolor lighthouse on a cliff at dawn",
"n": 1
}'
Returns a standard OpenAI Images response; each item in data is one image (url or b64_json, depending on the model).
Request fields
| Field | Description |
|---|---|
model |
Required, image model ID |
prompt |
Required, text prompt |
n |
Number of images, positive integer, default 1, at most 10 per request |
size, etc. |
Other OpenAI Images parameters are passed through where the model supports them |
stream is not supported.
Billing
- On submit, "images × price per image" is put on hold; with insufficient balance you get
402 insufficient_balance. - On completion you are billed for the images actually returned (never more than
n) and the rest of the hold is released; tokens are not billed. - Failed generations are not billed.