---
title: "Сгенерировать изображение"
method: POST
path: "/llm/generate-image"
tags: ["ИИ-модели"]
---

# Сгенерировать изображение

`POST /llm/generate-image`

Генерирует одно изображение, при необходимости уменьшает его до `max_width`, оптимизирует, сохраняет в S3 и возвращает идентификатор сохраненного результата. `n` принудительно равен 1; `stream` и `callback_url` задавать нельзя.

## Headers

- `X-Lang` 'ru' | 'kk' | 'en' | 'es'

## Request body

- LLMImageGenerationRequest
  - `model` string, required
  - `prompt` string — Обязателен при генерации без input_references
  - `n` integer
  - `max_width` integer — Максимальная ширина сохраненного изображения в пикселях
  - `input_references` unknown[]
    - unknown

## Response `200`

Сохраненное изображение

- LLMImageGenerationResponse
  - `image_id` string, uuid, required
  - `url` string, uri, required
  - `total_tokens` integer, required
  - `full_cost` string, required — Стоимость генерации с учетом комиссии

## Other responses

- `400` — Неправильный запрос
- `401` — Пользователь не авторизован
- `402` — Недостаточно средств у провайдера
- `403` — Доступ запрещен
- `429` — Превышен лимит на количество запросов
- `500` — Внутренняя ошибка сервера
- `503` — Сервис недоступен или отключен

## Changes

- **2026-08-05** `c22dfa568481` — 1 warning, 5 info
  - the `n` request property's max was set to `1.00`
  - added the new optional request property `max_width`
  - added the required property `full_cost` to the response with the `200` status
  - added the required property `image_id` to the response with the `200` status
  - …2 more
- **2026-08-03** `31c30b79e5b7` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/smartofood/apis/smartofood-admin-api/changes/llm/generate-image/post.md)

---

[API](https://skmtc.dev/smartofood/apis/smartofood-admin-api.md) · [All operations](https://skmtc.dev/smartofood/apis/smartofood-admin-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/smartofood/smartofood-admin-api/revisions/c22dfa568481/schema)
