Skip to content
On this page

Inference

Images

Generate, edit, and vary images. Billed per image plus the network fee.

All three image endpoints are [OI]-compatible and use the same auth and balance gates as chat. Uploads are capped by the global 10 MB body limit.

Generate

POST/v1/images/generationsAPI key
curl -X POST https://api.relayrouter.org/v1/images/generations \
-H "Authorization: Bearer $RELAY_API_KEY" \
-H 'content-type: application/json' \
-d '{
"model": "image-model",
"prompt": "a minimal black and white poster",
"n": 1
}'

n is clamped to 1–10. The response is the upstream JSON (typically a list of URLs or base64 data) passed through unchanged.

Edit and vary

EndpointBodyResponse
POST /v1/images/editsmultipartimage, optional mask, prompt, model.
POST /v1/images/variationsmultipartimage, model.
curl -X POST https://api.relayrouter.org/v1/images/edits \
-H "Authorization: Bearer $RELAY_API_KEY" \
-F prompt="make it monochrome" \
-F model=image-model

Billing

Image calls are billed per generated image using the model's image_micro, plus the network fee. The exact charge is always in usage_logs.cost_micro; use /usage rather than recomputing media prices client-side.

/api/v1/images/generations, /edits, and /variations are aliases of the same handlers.