API документация

API для реселлеров: генерация изображений и видео.

Auth
Bearer token
Orders
Unified format
Upload
Temp uploads
Results
Stable order links
Authentication

All requests must include your API key in the Authorization header.

HTTP Header
Authorization: Bearer YOUR_API_KEY
Keep your API key private. Do not expose it in frontend code or public repositories.
Base URL
Production
https://pluragen.com/api/v1
Available Endpoints
GET /balance
GET /models
POST /upload
GET /upload/status
GET /upload/preview/{token}
POST /orders
GET /orders/{id}
POST /orders/{id}/cancel
GET /prompts
1. Get Balance
GET /balance
cURL
curl -X GET "https://pluragen.com/api/v1/balance" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json"
Response
{
  "success": true,
  "balance_usd": "124.50"
}
2. Get Models
GET /models

Returns the list of available models, supported media rules, prompt behavior, and model-specific option schema for reseller integration.

Field Description
id Model ID used when creating orders.
name Human-readable model name.
type General model category such as image, video, upscale, or remove_bg.
price_usd Price per generation in USD.
fields Allowed request fields for this model.
prompt.mode Prompt behavior: required, optional, or ignored.
media.required Whether any uploaded media is required.
media.max_count Total maximum number of uploaded files allowed for the model.
media.accepted Allowed media file extensions.
media.inputs List of supported media inputs. Each input contains key, required, min, max, and accepted.
options_schema List of model-specific options that can be sent inside options when creating an order. Each item may include key, type, label, required, default, options, min, max, step, placeholder, and help.
Example Response
{
  "success": true,
  "models": [
    {
      "id": 20,
      "name": "Nano Banana",
      "type": "image",
      "price_usd": "0.05",
      "fields": ["prompt", "aspect_ratio", "output_format", "media"],
      "prompt": {
        "mode": "required"
      },
      "media": {
        "required": false,
        "max_count": 6,
        "accepted": ["jpg", "jpeg", "png", "webp"],
        "inputs": [
          {
            "key": "image",
            "required": false,
            "min": 0,
            "max": 6,
            "accepted": ["jpg", "jpeg", "png", "webp"]
          }
        ]
      },
      "options_schema": [
        {
          "key": "aspect_ratio",
          "type": "select",
          "label": "Aspect Ratio",
          "required": false,
          "default": "match_input_image",
          "options": [
            { "value": "match_input_image", "label": "match_input_image" },
            { "value": "1:1", "label": "1:1" },
            { "value": "16:9", "label": "16:9" },
            { "value": "9:16", "label": "9:16" }
          ]
        },
        {
          "key": "output_format",
          "type": "select",
          "label": "Output Format",
          "required": false,
          "default": "png",
          "options": [
            { "value": "jpg", "label": "jpg" },
            { "value": "png", "label": "png" }
          ]
        }
      ]
    }
  ]
}
3. Upload File
POST /upload

Upload media first, then use returned tmp_path inside the order request. Some files such as HEIC and HEIF may be processed asynchronously and return processing before they become ready.

cURL
curl -X POST "https://pluragen.com/api/v1/upload" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json" \
  -F "file=@/path/to/image.jpg"
Response Example: ready
{
  "success": true,
  "upload": {
    "tmp_path": "tmp/c13d0de5-0795-4c38-b54d-feef2f544b1a",
    "status": "ready",
    "url": "https://pluragen.com/api/v1/upload/preview/c13d0de5-0795-4c38-b54d-feef2f544b1a",
    "original_name": "image.jpg",
    "mime_type": "image/jpeg",
    "size": 2388636,
    "error": null
  }
}
Response Example: processing
{
  "success": true,
  "upload": {
    "tmp_path": "tmp/d81d1ea9-59ec-4223-a489-6b07612020dd",
    "status": "processing",
    "url": null,
    "original_name": "IMG_9508.HEIC",
    "mime_type": "image/heic",
    "size": 3733427,
    "error": null
  }
}
Upload returns a temporary file reference in tmp_path. Use this value in /orders. If upload status is processing, wait until it becomes ready before creating the order. The url field is a temporary authenticated preview URL and should only be used for previewing the uploaded file.
Accepted formats: JPG, JPEG, PNG, WEBP, GIF, HEIC, HEIF, MP4, MOV, WEBM. Maximum file size: 300 MB. Temporary uploads expire after 24 hours. Create the order before expiration.
4. Check Upload Status
GET /upload/status

Check temporary upload status using tmp_path. This is especially useful for HEIC/HEIF files that may require asynchronous conversion before becoming ready.

cURL
curl -G "https://pluragen.com/api/v1/upload/status" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json" \
  --data-urlencode "tmp_path=tmp/d81d1ea9-59ec-4223-a489-6b07612020dd"
Response
{
  "success": true,
  "upload": {
    "tmp_path": "tmp/d81d1ea9-59ec-4223-a489-6b07612020dd",
    "status": "ready",
    "url": "https://pluragen.com/api/v1/upload/preview/d81d1ea9-59ec-4223-a489-6b07612020dd",
    "original_name": "IMG_9508.HEIC",
    "mime_type": "image/png",
    "size": 22588415,
    "error": null
  }
}
5. Preview Uploaded File
GET /upload/preview/{token}

Returns the uploaded temporary file for preview. This URL requires the same API token used for upload access. Use it only for previewing uploaded media. Use tmp_path when creating orders.

cURL
curl -X GET "https://pluragen.com/api/v1/upload/preview/c13d0de5-0795-4c38-b54d-feef2f544b1a" \
  -H "Authorization: Bearer YOUR_API_KEY"
Preview URLs are temporary and authenticated. They are not intended to be used as permanent public file links.
Seedance: расчёт цены
POST/orders/quote

options.resolution: 480p (по умолчанию), 720p или 1080p. Тариф зависит от выбранного качества. Передавайте одинаковое значение при расчёте и создании заказа; после смены качества получите новый расчёт. Без этого параметра сохраняется 480p. Каталожная стартовая цена указана для 480p.

Для моделей с pricing.quote_required=true сначала загрузите файлы, дождитесь готовности и рассчитайте цену. Расчёт бесплатный, действует 10 минут и включает реселлерскую скидку. Затем отправьте те же параметры в POST /orders, добавив quote_id и заголовок Idempotency-Key. Один расчёт создаёт не более одного заказа.

Без файлов - генерация по тексту; одно фото без видео - первый кадр; несколько фото - референсы; с видео - видеореференс. Файлы необязательны. media.image: до 6 фото, media.video: одно видео MP4/MOV длительностью 2-30 секунд. Готовые HEIC/HEIF автоматически конвертируются в PNG.

options.duration: целое число 4-30, по умолчанию 4. С видео не передавайте длительность: она рассчитывается как округлённая вверх длина исходника, минимум 4. Другая явно переданная длительность отклоняется. Фото: 301-5999 px по каждой стороне, соотношение сторон больше 0,4 и меньше 2,5, до 30 MB. Видео: до 200 MB, 24-60 кадров/с, 409600-927408 пикселей в кадре, соотношение сторон 0,4-2,5.

Цена: без видео - секунды результата × тариф; с видео - (округлённые вверх секунды исходника + секунды результата) × тариф. Расчёт учитывает вашу скидку. price_usd из каталога - стартовая цена за 4 секунды без исходного видео, точная сумма находится в quote.price_usd. Запрос без расчёта вернёт price_quote_required; изменённые данные или тариф - price_quote_changed; истёкший расчёт - price_quote_expired. Заказ при этих ошибках не создаётся.

POST /api/v1/orders/quote
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json

{
  "model_id": 123,
  "prompt": "Animate the photo with a slow camera movement.",
  "media": {"image": ["tmp/your-ready-upload.png"]},
  "options": {"duration": 4, "aspect_ratio": "adaptive", "resolution": "480p"}
}

123 - пример; возьмите актуальный model_id из GET /models. Для генерации отправляйте исходные параметры и quote_id, не весь ответ расчёта.

Разрешение изображений

Для моделей с pricing.type = per_image_resolution можно передать options.resolution. Допустимые значения и значение по умолчанию указаны в options_schema ответа GET /api/v1/models. Без этого параметра сохраняются текущие настройки по умолчанию. quote_id не требуется.

pricing.resolutions содержит цену каждого разрешения: price_usd уже учитывает скидку вашего API-аккаунта, base_price_usd указан до скидки. Основной price_usd модели относится к pricing.default_resolution. Пример: "options": {"resolution": "2K", "aspect_ratio": "1:1"}. Перед заказом запрашивайте актуальные цены. В Gpt Image 2.5 пропорции 27:16, 16:27, 9:8 и 8:9 совместимы только с 1K, если доступны в настройках модели.

В Seedream 5.0 Pro цена также зависит от количества фото в media.image: первое входит в стоимость. pricing.prices_by_image_count содержит готовые итоговые суммы для каждого resolution и image_count, уже со скидкой. Выбирайте сумму из этой таблицы, не складывайте округлённые надбавки. Без фото используйте image_count = 0. По умолчанию 1K; доступны 1K и 2K, до 10 фото и промпт от 4 до 5000 символов. Без фото создаётся изображение по тексту, с фото автоматически используется редактирование.

Wan 3.0

Обязателен расчёт через POST /orders/quote. Передайте model_id, prompt и необязательные options: duration (целое число 4-30, по умолчанию 4), resolution (480p по умолчанию, 720p или 1080p), aspect_ratio (adaptive, 1:1, 16:9, 9:16, 4:3). Звук включён. Другие параметры не поддерживаются.

Файлы передаются готовыми временными загрузками в media.image (до 6 фото) и media.video (одно видео). Фото: JPG, PNG без прозрачности, WebP, HEIC/HEIF с конвертацией; до 20 МБ, стороны 240-8000 пикселей. Видео: MP4/MOV, 1-15 секунд, до 100 МБ, стороны 240-4096 пикселей. Соотношение сторон исходных файлов: от 1:8 до 8:1.

Без файлов создаётся видео по тексту. Одно фото без видео становится первым кадром; несколько фото или фото с видео используются как референсы. В промпте: Image1, Image2, Video1; обозначения @image1 и [Image1] также нормализуются. Рекомендуется английский промпт.

С видео не передавайте options.duration: длительность результата равна длине исходника, округлённой вверх до целой секунды, но не меньше 4 секунд. Сумма длительностей исходника и результата не превышает 30 секунд. Цена включает каждую начатую секунду исходника и выбранные секунды результата; зависит от качества и учитывает реселлерскую скидку. Каталог показывает цену «от» за 4 секунды в 480p без видео. Точная сумма - quote.price_usd.

Для запуска отправьте те же параметры в POST /orders, добавив quote_id и заголовок Idempotency-Key. Расчёт действует 10 минут, создаёт не более одного заказа и требует обновления при изменении параметров, файлов или скидки. Расчёт не запускает генерацию и не списывает баланс.

Kling 3.0 Omni

Создание видео с персонажами по фото. Нужны промпт (до 3072 символов) и от 1 до 7 фотографий. Сначала загрузите файлы через API загрузки и передайте их идентификаторы в media.image массивом. JPG, PNG, HEIC/HEIF (конвертируются в PNG): до 50 МБ на фото, обе стороны от 300 пикселей, соотношение сторон от 0.4 до 2.5.

options.duration: целое число от 4 до 15, по умолчанию 4. options.aspect_ratio: 1:1, 16:9 или 9:16, по умолчанию 16:9. options.resolution: 720p (по умолчанию) или 1080p; тариф зависит от качества. Звук задаёт администрация; скрытые параметры не передавайте. Актуальные доступные параметры смотрите в GET /models.

Получите расчёт через POST /orders/quote, затем отправьте те же параметры в POST /orders с полученным quote_id и заголовком Idempotency-Key. Расчёт действителен 10 минут, учитывает вашу скидку и не списывает деньги. Изменили фото, промпт или настройки - получите новый расчёт. Цена в каталоге указана за минимальные 4 секунды; списание соответствует подтверждённому расчёту.

Фото используются как референсы даже при загрузке одного файла. Порядок фото сохраняется: указывайте в промпте, например, «человек с первого фото». Видео, элементы персонажей и редактор отдельных сцен в этой модели не принимаются.

Kling V3 Motion Control

Для этой модели теперь обязателен расчёт через POST /orders/quote. Передайте model_id, необязательный prompt и готовые загрузки в media.image и media.video (по одному файлу). Фото обязательно, видео MP4/MOV: 3-30 секунд, до 100 МБ. Ограничения фото смотрите в каталоге модели.

Длительность определяется по видео. Необязательный options.resolution: 720p (по умолчанию) или 1080p. Тариф зависит от выбранного качества. Передавайте одинаковое значение при расчёте и создании заказа; после смены качества получите новый расчёт. Без этого параметра сохраняется 720p. options.duration, mode и character_orientation не принимаются: ориентация задаётся по видео. Цена считается за каждую начатую секунду ролика один раз, без добавления длительности исходника второй раз; учитывается реселлерская скидка. Каталог показывает минимальную цену за 3 секунды в 720p, точная сумма - quote.price_usd.

Затем отправьте те же параметры в POST /orders, добавив quote_id и Idempotency-Key. Расчёт действует 10 минут. Один расчёт создаёт не более одного заказа. Старые запросы без quote_id возвращают price_quote_required без заказа и списания. Изменённый или истёкший расчёт нужно получить заново.

6. Create Order
POST /orders

Create a generation order using the selected model_id. Use prompt.mode, media.inputs, and options_schema from /models to determine which fields and options are supported for the selected model.

Field Required Description
model_id Yes Model ID from /models.
prompt Depends on model Text prompt. Check prompt.mode in /models.
media Depends on model Object keyed by values from media.inputs[].key. Each key contains an array of temporary upload paths returned by /upload.
options No Model-specific options. Read supported keys and values from options_schema in /models.
Headers
Authorization: Bearer YOUR_API_KEY
Accept: application/json
Content-Type: application/json
Idempotency-Key: UNIQUE_REQUEST_KEY
Use a unique Idempotency-Key for each new order request. Reusing the same key with the same request data returns the original order. Reusing the same key with different request data returns an idempotency_conflict error. Idempotency keys are scoped per API token.
Request Example: single media input
{
  "model_id": 20,
  "prompt": "ultra realistic portrait of a woman, soft cinematic light",
  "media": {
    "image": ["tmp/c13d0de5-0795-4c38-b54d-feef2f544b1a"]
  },
  "options": {
    "aspect_ratio": "1:1",
    "output_format": "png"
  }
}
Request Example: multi image input
{
  "model_id": 20,
  "prompt": "test multi images",
  "media": {
    "image": [
      "tmp/8eb547bf-5dd7-439e-8b6f-4e7055d2b6cc",
      "tmp/c0432f4e-ade1-4ee2-ae93-78a17db596b1",
      "tmp/8720667b-af67-4615-88f4-275803fe0d20"
    ]
  }
}
Request Example: role-based media
{
  "model_id": 3,
  "prompt": "cinematic portrait",
  "media": {
    "character_image": ["tmp/11111111-2222-3333-4444-555555555555"],
    "target_image": ["tmp/66666666-7777-8888-9999-000000000000"]
  }
}
Request Example: prompt-only model
{
  "model_id": 5,
  "prompt": "a futuristic city at sunset",
  "options": {
    "aspect_ratio": "16:9",
    "output_format": "jpg"
  }
}
Request Example: no prompt required
{
  "model_id": 7,
  "media": {
    "image": ["tmp/c13d0de5-0795-4c38-b54d-feef2f544b1a"]
  },
  "options": {
    "upscale_factor": "x2"
  }
}
Response
{
  "success": true,
  "order": {
    "id": "ord_123",
    "model_id": 20,
    "status": "queued",
    "cost_usd": "0.05",
    "result": [],
    "expires_at": null,
    "error": null
  }
}
Media keys are model-specific. Always read /models first and use the keys returned in media.inputs.
Model-specific generation settings must be sent inside options. Always read options_schema from /models before sending values such as aspect_ratio, output_format, upscale_factor, or other model options.
Orders accept only ready uploads. If a file is still processing, check its state via /upload/status and retry after it becomes ready.
If prompt.mode is ignored, you can omit the prompt field entirely.
7. Get Order
GET /orders/{id}

Returns the current order state, cost, result URLs, expiration time for completed files, and error if generation failed.

Response Example
{
  "success": true,
  "order": {
    "id": "ord_123",
    "model_id": 20,
    "status": "completed",
    "cost_usd": "0.05",
    "result": [
      "https://pluragen.com/g/AbC123xYz..."
    ],
    "expires_at": "2026-04-15T12:00:00Z",
    "error": null
  }
}
Status Description
queued Order was created and is waiting to start.
processing Generation is in progress.
completed Generation finished successfully.
failed Generation failed.
cancelled Generation was cancelled.
API uses simplified status values. Internal processing states are not exposed.
Result URLs returned inside the order remain stable in the API response. If the generated file expires later, the URL may return 404, but the order response itself does not change.
8. Cancel Order
POST /orders/{id}/cancel

Cancel an eligible active order. Check can_cancel in the order response. Some models do not support cancellation once processing begins. An unavailable cancellation returns HTTP 409 with cannot_cancel. Cancellation may take a few seconds to be fully confirmed. You may need to poll /orders/{id} to get the final status.

cURL
curl -X POST "https://pluragen.com/api/v1/orders/ord_123/cancel" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json"
Successful Response
{
  "success": true,
  "order": {
    "id": "ord_123",
    "model_id": 20,
    "status": "cancelled",
    "cost_usd": "0.05",
    "result": [],
    "expires_at": null,
    "error": null
  }
}
Response Example: cannot cancel
{
  "success": false,
  "error": {
    "code": "cannot_cancel",
    "message": "Order cannot be cancelled"
  },
  "order": {
    "id": "ord_123",
    "model_id": 20,
    "status": "completed",
    "cost_usd": "0.05",
    "result": [
      "https://pluragen.com/g/AbC123xYz..."
    ],
    "expires_at": "2026-04-15T12:00:00Z",
    "error": null
  }
}
Response Example: not ready
{
  "success": false,
  "error": {
    "code": "not_ready",
    "message": "Generation not started yet. Try again shortly."
  },
  "order": {
    "id": "ord_123",
    "model_id": 20,
    "status": "queued",
    "cost_usd": "0.05",
    "result": [],
    "expires_at": null,
    "error": null
  }
}
Response Example: cancel pending
{
  "success": false,
  "error": {
    "code": "cancel_pending",
    "message": "Cancellation in progress"
  },
  "order": {
    "id": "ord_123",
    "model_id": 20,
    "status": "processing",
    "cost_usd": "0.05",
    "result": [],
    "expires_at": null,
    "error": null
  }
}
If cancellation is already confirmed, the order status becomes cancelled. If the order is already completed, failed, or otherwise no longer active, the API returns 409.
9. Prompt Library

Returns a paginated list of AI prompts from the prompt library.
Access requirement: available to accounts with a total deposit of $50 or more. Access is granted automatically on first request once the threshold is met.

GET /prompts
Parameter Type Required Description
type string No image or video
category string No Category slug, e.g. zhenskie, portraits, fantasy
search string No Search by title or prompt text (RU & EN)
per_page integer No Results per page. Default: 20, max: 100
page integer No Page number. Default: 1
cURL
curl -X GET "https://pluragen.com/api/v1/prompts?type=image&category=zhenskie&per_page=20" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json"
Response
{
  "success": true,
  "data": [
    {
      "id": 123,
      "type": {
        "key": "image",
        "name_ru": "Изображение",
        "name_en": "Image"
      },
      "category": {
        "key": "zhenskie",
        "name_ru": "Женские",
        "name_en": "Female"
      },
      "title_ru": "Женский портрет",
      "title_en": null,
      "prompt_ru": "Фотореалистичный портрет...",
      "prompt_en": null,
      "preview_url": "https://pluragen.com/prompts/123/preview"
    }
  ],
  "links": {
    "first": "https://pluragen.com/api/v1/prompts?page=1",
    "last": "https://pluragen.com/api/v1/prompts?page=132",
    "prev": null,
    "next": "https://pluragen.com/api/v1/prompts?page=2"
  },
  "meta": {
    "current_page": 1,
    "last_page": 132,
    "per_page": 20,
    "total": 2630
  }
}
Fields title_ru, title_en, prompt_ru, prompt_en may be null if the prompt only has one language version. Always check both fields on the client side.
403 — Access denied
{
  "success": false,
  "error": {
    "code": "deposit_required",
    "message": "Access to prompt library requires a minimum total deposit of $50.",
    "required": 50,
    "deposited": 12.50
  }
}
10. Error Format
Standard Error Response
{
  "success": false,
  "error": {
    "code": "validation_error",
    "message": "Invalid request data"
  }
}
Upload-related endpoints may return specific error codes such as upload_processing, file_expired, and file_not_found when a temporary upload is not ready or is no longer available.
Code Meaning
unauthorized API key missing or invalid.
model_not_found Selected model does not exist or is disabled.
order_not_found Order not found or does not belong to current API key owner.
cannot_cancel The order is already finished or otherwise cannot be cancelled.
not_ready Cancellation is not available at this stage. Check the order status before retrying.
cancel_pending Cancellation was requested but is not yet confirmed.
cancel_failed Cancellation is temporarily unavailable. Check the order status before retrying.
file_not_found Temporary uploaded file not found.
file_expired Temporary uploaded file expired.
upload_processing Temporary uploaded file is still processing and is not ready to be used in an order yet.
validation_error Request data is invalid or unsupported for the selected model.
prompt_required The selected model requires a prompt.
media_required The selected model requires uploaded media.
too_many_media Too many files were sent for the selected media input.
invalid_media_type Uploaded file type is not supported for the selected model or media input.
insufficient_balance Not enough balance to create the order.
too_many_active_orders You have too many active orders. Wait for some to complete before creating new ones.
server_busy Server is temporarily under high load. Try again shortly.
idempotency_conflict Same idempotency key was already used with different request data.
internal_error Unexpected internal error.
11. HTTP Status Codes
Status Meaning
200 Success.
201 Resource created.
400 Bad request body or invalid JSON.
401 Unauthorized.
404 Resource not found.
422 Validation or business rule error.
429 Too many requests or too many active orders.
500 Internal server error.
503 Service temporarily unavailable due to high load.
Get started