API reference
Images
Generate and edit images.
On this page
POST/v1/images/generations
Creates images from a prompt.
Auth: API key, or pay per request under https://api.usdf.fi/x402
| Name | Type | Required | Description |
|---|---|---|---|
model | string | Yes | An image model id. |
prompt | string | Yes | What to draw. |
n | integer | No | How many images. |
size | string | No | Width by height, for example 1024x1024. |
response_format | string | No | b64_json or url. |
POST /v1/images/generations
curl
curl -X POST https://api.usdf.fi/v1/images/generations \
-H "Authorization: Bearer $USDF_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "<image model>",
"prompt": "A lighthouse at dawn, watercolor",
"n": 1,
"size": "1024x1024",
"response_format": "b64_json"
}'Response, trimmed
{
"created": …,
"data": [{ "b64_json": "…" }],
"model": "<image model>",
"receipt": { "request_id": "<request_id>", "cost": { … }, … }
}POST/v1/images/edits
Changes an uploaded image as the prompt describes. Sent as multipart form data.
Auth: API key, or pay per request under https://api.usdf.fi/x402
| Name | Type | Required | Description |
|---|---|---|---|
model | string | Yes | An image model that supports edits. |
prompt | string | Yes | The change to make. |
image | file | Yes | The image to edit. |
POST /v1/images/edits
curl
curl -X POST https://api.usdf.fi/v1/images/edits \ -H "Authorization: Bearer $USDF_API_KEY" \ -F model=<image model> \ -F prompt="The same scene at night" \ -F image=@input.png
Foundry documentation