> ## Documentation Index
> Fetch the complete documentation index at: https://docs.elumenta.ru/llms.txt
> Use this file to discover all available pages before exploring further.

# AI-инструменты

> Upscale, Face Swap, Remove BG, Style Transfer, Colorize, InPaint, OCR — доступны на Starter

Все AI-инструменты доступны на тарифе **Starter** (подписка не нужна). Стоимость: 1–3 токена.

## Доступные инструменты

| Slug             | Название       | Токены | Описание                              |
| ---------------- | -------------- | ------ | ------------------------------------- |
| `upscale`        | Upscale ESRGAN | 1      | Увеличение изображения в 2×/4×        |
| `face-swap`      | Face Swap      | 1      | Замена лица между двумя изображениями |
| `remove-bg`      | Remove BG      | 1      | Удаление фона с изображения           |
| `style-transfer` | Style Transfer | 1      | Перенос художественного стиля         |
| `colorize`       | Colorize       | 1      | Раскраска чёрно-белых фото            |
| `inpaint`        | InPaint Edit   | 3      | Редактирование выбранной области      |
| `text-ocr`       | Text OCR       | 1      | Извлечение текста из изображений      |

## Формат запроса

Инструменты используют тот же эндпоинт `POST /api/v2/generate`. Передайте слаг инструмента в `model`, URL изображения в `params`:

```bash theme={null}
curl -X POST https://elumenta.ru/api/v2/generate \
  -H "Authorization: Bearer nb_ВАШ_КЛЮЧ" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "remove-bg",
    "prompt": "remove background",
    "params": {
      "image_url": "https://example.com/photo.jpg"
    }
  }'
```

## Примеры

```python theme={null}
import requests

# Удаление фона
res = requests.post(
    "https://elumenta.ru/api/v2/generate",
    headers={"Authorization": "Bearer nb_ВАШ_КЛЮЧ"},
    json={
        "model": "remove-bg",
        "prompt": "remove background",
        "params": {"image_url": "https://example.com/portrait.jpg"}
    }
)
print(res.json()["result_url"])

# Апскейл 4x
res = requests.post(
    "https://elumenta.ru/api/v2/generate",
    headers={"Authorization": "Bearer nb_ВАШ_КЛЮЧ"},
    json={
        "model": "upscale",
        "prompt": "upscale",
        "params": {"image_url": "https://example.com/photo.jpg", "scale": 4}
    }
)
print(res.json()["result_url"])

# OCR — извлечь текст
res = requests.post(
    "https://elumenta.ru/api/v2/generate",
    headers={"Authorization": "Bearer nb_ВАШ_КЛЮЧ"},
    json={
        "model": "text-ocr",
        "prompt": "extract text",
        "params": {"image_url": "https://example.com/document.jpg"}
    }
)
print(res.json()["result_text"])
```

## Ответ

```json theme={null}
{
  "id": 18530,
  "status": "completed",
  "model_slug": "remove-bg",
  "result_url": "https://storage.elumenta.ru/generations/18530.png",
  "tokens_spent": 1,
  "processing_ms": 2140
}
```

<Tip>
  Все инструменты обрабатываются синхронно — опрос статуса не нужен, в ответе всегда `status: completed`.
</Tip>
