Image to image (image editing)
Generate or edit images from reference images with GPT Image2 through LLMEasy’s OpenAI-compatible API.
Documentation Index
Fetch the complete documentation index at: https://docs.llmeasy.ru/llms.txt
Use this file to discover all available pages before exploring further.
POST /v1/images/edits
The image-to-image endpoint uses a multipart/form-data request body. Upload one or more reference images and submit prompt and parameter fields as form fields.
https://www.llmeasy.ru/v1 as the Base URL. Pass your LLMEasy API Key through Authorization: Bearer YOUR_API_KEY.Recommended values
Send these fields explicitly in every request:image for a single reference image. Use repeated image[] fields for multiple reference images.
Single reference image
Multiple reference images
Python example
Recommended sizes
size | Ratio | Use case |
|---|---|---|
auto | Auto | Automatic size selection |
1024x1024 | 1:1 | Square images, avatars, covers, assets |
1536x1024 | 3:2 | Landscape posters, banners, scenes |
1024x1536 | 2:3 | Portrait mobile covers and posters |
1536x1152 | 4:3 | Standard landscape images, product images, content graphics |
1152x1536 | 3:4 | Standard portrait images, mobile covers, vertical posters |
2048x2048 | 1:1 | High-resolution square images |
2048x1152 | 16:9 | High-resolution landscape images |
3840x2160 | 16:9 | 4K landscape images |
2160x3840 | 9:16 | 4K portrait images |
size represents the expected aspect ratio and size tier. The actual returned pixels may be mapped or adjusted by the server. Use the decoded image dimensions instead of forcibly cropping the output to the requested value.
Save the image
A successful response follows the OpenAI-compatible image response shape:data[0].b64_json and save it as base64 image content. Always set output_format: "png" so you can save the decoded image as .png.
Response flow
This endpoint is synchronous. After sendingPOST /images/edits, keep the current HTTP request open until the server responds. When generation succeeds, the image content is returned in data[0].b64_json.
The endpoint does not return a task_id, and there is no separate status query or result download endpoint.
Related docs
Authorizations
Используйте API Key LLMEasy как bearer token. Не публикуйте API keys во frontend-коде, скриншотах, логах, тикетах или Git-репозиториях.
Body
Используйте фиксированное значение gpt-image-2.
gpt-image-2 "gpt-image-2"
Инструкция для редактирования изображения или генерации по reference image.
"На основе этого изображения создай более аккуратный квадратный key visual продукта, сохранив общий стиль основного объекта."
Поле для одной reference image. При одной reference image используйте image.
Поле для нескольких reference images. При нескольких reference images повторяйте image[].
Рекомендуется фиксировать значение 1. Для нескольких изображений отправляйте несколько отдельных запросов.
"1"
Размеры и соотношения сторон изображения. auto выбирает размер автоматически; 1024x1024 и 2048x2048 — 1:1; 1536x1024 — 3:2; 1024x1536 — 2:3; 1536x1152 — 4:3; 1152x1536 — 3:4; 2048x1152 и 3840x2160 — 16:9; 2160x3840 — 9:16. Фактический размер может быть сопоставлен или скорректирован сервером, поэтому клиенту следует ориентироваться на реальные размеры декодированного изображения.
auto, 1024x1024, 1536x1024, 1024x1536, 1536x1152, 1152x1536, 2048x2048, 2048x1152, 3840x2160, 2160x3840 "1024x1024"
Рекомендуется фиксировать b64_json.
b64_json "b64_json"
Рекомендуется фиксировать png. Не рассчитывайте, что jpeg или webp всегда вернутся напрямую в выбранном формате.
png "png"