DocumentationAccess MethodsOpenAI Images

OpenAI Images

Image generation and editing via the OpenAI Images protocol.

Endpoint

Text-to-imagePOST /v1/images/generations
Image editPOST /v1/images/edits

Authentication

HeaderAuthorization: Bearer YOUR_API_KEY

Specify the configured image model via the model field in the request body.

Text-to-image curl example

curl
curl https://your-router-domain.com/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"YOUR_IMAGE_MODEL","prompt":"a cat sitting on a sofa","n":1,"size":"1024x1024"}'

Image edit curl example (multipart)

curl
curl https://your-router-domain.com/v1/images/edits \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F model="YOUR_IMAGE_MODEL" \
  -F prompt="add a red hat" \
  -F image="@/path/to/source.png"
Response format

Response follows the native OpenAI Images structure, with a created timestamp and a data array where each item contains a url field. For base64, add "response_format":"b64_json" — the result is in data[].b64_json.

Gemini APIGemini Images