Generate an image
UsePOST /v1/images/generations with Authorization: Bearer YOUR_API_KEY.
| Parameter | Required | Meaning |
|---|---|---|
model | Yes | Exact image-generation model ID. |
prompt | Yes | Description of the desired image, in English or Chinese. |
size | No | Output dimensions supported by the model. |
quality | No | Quality setting, where supported. |
style | No | Style setting, where supported. |
n | No | Requested number of images; the documented default is 1. |
Edit an image
UsePOST /v1/images/edits with the same authorization header. Common OpenAI-compatible models accept file uploads using multipart/form-data; some models use a JSON request with image URLs.
| Field | Required | Meaning |
|---|---|---|
model | Yes | Exact image-editing model ID. |
image | Yes | Original image; supported size and format depend on the model. |
prompt | Yes | Requested edit. |
mask | No | Optional transparency mask indicating the editable area. |