Images
Omrouter supports image generation and image editing. Choose an image model on the Pricing page. If the API key has a model restriction, choose an image model allowed for that key.
Generate an image
Section titled “Generate an image”POST /v1/images/generationsAuthorization: Bearer OMROUTER_API_KEYContent-Type: application/jsonRequest body
Section titled “Request body”| Field | Type | Required | Description |
|---|---|---|---|
model |
string | Yes | Image model name shown on the Pricing page. |
prompt |
string | Yes | Description of the image to generate. |
n |
integer | No | Number of images. Availability and limits depend on the model. |
size |
string | No | Requested dimensions supported by the model. |
quality |
string | No | Model-specific quality setting. |
response_format |
string | No | Response representation supported by the model. |
Example
Section titled “Example”curl --silent --show-error \ 'https://omrouter.com/v1/images/generations' \ --header "Authorization: Bearer $OMROUTER_API_KEY" \ --header 'Content-Type: application/json' \ --data "{ \"model\": \"$OMROUTER_MODEL_ID\", \"prompt\": \"A simple product icon on a plain background\", \"n\": 1 }"Responses commonly contain a data array with an image URL or encoded image content. The selected model and response_format determine the exact format.
Edit an image
Section titled “Edit an image”Image editing uses POST /v1/images/edits. Upload the original image and, when the model supports it, a mask. Field names, file formats, and size limits depend on the selected model.