Skip to main content
POST
/
v1
/
images
/
edits
curl 'https://www.llmeasy.ru/v1/images/edits' \
  -H 'Authorization: Bearer sk-***REDACTED***' \
  -F 'model=gpt-image-2' \
  -F 'prompt=На основе этого изображения создай более аккуратный квадратный key visual продукта, сохранив общий стиль основного объекта.' \
  -F 'n=1' \
  -F 'size=1024x1024' \
  -F 'response_format=b64_json' \
  -F 'output_format=png' \
  -F 'image=@reference.png'
{
  "created": 1710000000,
  "data": [
    {
      "b64_json": "iVBORw0KGgoAAAANSUhEUgAA...(truncated)"
    }
  ]
}

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.
Use https://www.llmeasy.ru/v1 as the Base URL. Pass your LLMEasy API Key through Authorization: Bearer YOUR_API_KEY.
You can fill in form fields and upload reference images in the Playground on the right side of the page, then send the request directly to https://www.llmeasy.ru/v1/images/edits.
Do not use a regular JSON body for image-to-image requests. Submit text fields and file fields with multipart/form-data.
Send these fields explicitly in every request:
model=gpt-image-2
n=1
response_format=b64_json
output_format=png
Use image for a single reference image. Use repeated image[] fields for multiple reference images.

Single reference image

curl 'https://www.llmeasy.ru/v1/images/edits' \
  -H 'Authorization: Bearer sk-***REDACTED***' \
  -F 'model=gpt-image-2' \
  -F 'prompt=Use this reference image to create a more polished square product hero image while keeping the main style consistent.' \
  -F 'n=1' \
  -F 'size=1024x1024' \
  -F 'response_format=b64_json' \
  -F 'output_format=png' \
  -F 'image=@reference.png'

Multiple reference images

curl 'https://www.llmeasy.ru/v1/images/edits' \
  -H 'Authorization: Bearer sk-***REDACTED***' \
  -F 'model=gpt-image-2' \
  -F 'prompt=Combine these reference images into one consistent promotional poster.' \
  -F 'n=1' \
  -F 'size=1024x1024' \
  -F 'response_format=b64_json' \
  -F 'output_format=png' \
  -F 'image[]=@reference-1.png' \
  -F 'image[]=@reference-2.jpg' \
  -F 'image[]=@reference-3.png'

Python example

import requests

url = "https://www.llmeasy.ru/v1/images/edits"
headers = {
    "Authorization": "Bearer sk-***REDACTED***",
}

data = {
    "model": "gpt-image-2",
    "prompt": "Use this reference image to create a more polished square product hero image while keeping the main style consistent.",
    "n": "1",
    "size": "1024x1024",
    "response_format": "b64_json",
    "output_format": "png",
}

with open("reference.png", "rb") as image_file:
    files = {
        "image": ("reference.png", image_file, "image/png"),
    }
    response = requests.post(url, headers=headers, data=data, files=files, timeout=300)

response.raise_for_status()
result = response.json()
b64_json = result["data"][0]["b64_json"]
sizeRatioUse case
autoAutoAutomatic size selection
1024x10241:1Square images, avatars, covers, assets
1536x10243:2Landscape posters, banners, scenes
1024x15362:3Portrait mobile covers and posters
1536x11524:3Standard landscape images, product images, content graphics
1152x15363:4Standard portrait images, mobile covers, vertical posters
2048x20481:1High-resolution square images
2048x115216:9High-resolution landscape images
3840x216016:94K landscape images
2160x38409:164K 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:
{
  "created": 1710000000,
  "data": [
    {
      "b64_json": "iVBORw0KGgoAAAANSUhEUgAA...(truncated)"
    }
  ]
}
Read 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 sending POST /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.

Authorizations

Authorization
string
header
required

Используйте API Key LLMEasy как bearer token. Не публикуйте API keys во frontend-коде, скриншотах, логах, тикетах или Git-репозиториях.

Body

multipart/form-data
model
enum<string>
default:gpt-image-2
required

Используйте фиксированное значение gpt-image-2.

Available options:
gpt-image-2
Example:

"gpt-image-2"

prompt
string
required

Инструкция для редактирования изображения или генерации по reference image.

Example:

"На основе этого изображения создай более аккуратный квадратный key visual продукта, сохранив общий стиль основного объекта."

image
file

Поле для одной reference image. При одной reference image используйте image.

image[]
file[]

Поле для нескольких reference images. При нескольких reference images повторяйте image[].

n
default:1

Рекомендуется фиксировать значение 1. Для нескольких изображений отправляйте несколько отдельных запросов.

Example:

"1"

size
enum<string>
default:1024x1024

Размеры и соотношения сторон изображения. auto выбирает размер автоматически; 1024x1024 и 2048x2048 — 1:1; 1536x1024 — 3:2; 1024x1536 — 2:3; 1536x1152 — 4:3; 1152x1536 — 3:4; 2048x1152 и 3840x2160 — 16:9; 2160x3840 — 9:16. Фактический размер может быть сопоставлен или скорректирован сервером, поэтому клиенту следует ориентироваться на реальные размеры декодированного изображения.

Available options:
auto,
1024x1024,
1536x1024,
1024x1536,
1536x1152,
1152x1536,
2048x2048,
2048x1152,
3840x2160,
2160x3840
Example:

"1024x1024"

response_format
enum<string>
default:b64_json

Рекомендуется фиксировать b64_json.

Available options:
b64_json
Example:

"b64_json"

output_format
enum<string>
default:png

Рекомендуется фиксировать png. Не рассчитывайте, что jpeg или webp всегда вернутся напрямую в выбранном формате.

Available options:
png
Example:

"png"

Response

Результат генерации изображения.

OpenAI-совместимый ответ с изображением. Клиентам следует читать data[0].b64_json и учитывать возможные дополнительные поля, например revised_prompt.

created
integer
Example:

1710000000

data
object[]