Skip to main content

Generation API

Generation endpoints create asynchronous image-processing jobs.

Workflow

  1. Client requests available tools.
  2. Client sends a generation request with selected tool.
  3. API validates auth, payload, and limits.
  4. Job is queued for AI workers.
  5. Worker processes request and stores result.
  6. Client polls by history_item_id for final status.

Available Tools

Before generation, request the current tool list:

GET /generation/tools
Authorization: Bearer <api_key>

Example response:

[
{
"group_tool": "fashion",
"tool": "lego_clothes",
"title": "Lego Clothes"
},
{
"group_tool": "fashion",
"tool": "mamasfit",
"title": "MamasFit"
},
{
"group_tool": "fashion",
"tool": "lengerie",
"title": "Lengerie"
},
{
"group_tool": "fashion",
"tool": "fashion_card",
"title": "Fashion Card"
},
{
"group_tool": "fashion",
"tool": "fashion_swap",
"title": "Fashion Swap"
},
{
"group_tool": "fashion",
"tool": "fashion_swap_half",
"title": "Fashion Swap Half"
},
{
"group_tool": "interior",
"tool": "furniture",
"title": "Furniture"
},
{
"group_tool": "textile",
"tool": "fabric",
"title": "Fabric"
},
{
"group_tool": "default",
"tool": "default",
"title": "Default"
}
]

Use the tool value from this list in generation payload fields.

Example:

Generation Types

For selected tool, fetch available generation types:

GET /generation/generationTypes?tool=fashion_swap
Authorization: Bearer <api_key>

Example:

Generation Endpoint

Primary generation endpoint:

POST /generation/generate_image_v2/

Request Example

POST /generation/generate_image_v2/
Authorization: Bearer <api_key>
Content-Type: multipart/form-data
tool=fashion_swap
clothes=@clothes.png
person=@person.png

The value of tool should come from GET /generation/tools.

Example:

Initial Response

{
"preview_image": "image/generation_result/image_2.webp",
"stock_image": "image/generation_result/image_3.png",
"history_item_id": "gfd41688fhgf"
}

Status Model

StatusMeaning
pendingAccepted and queued
completeResult is ready
errorProcessing ended with an error

Polling for Completion

GET /user/generation-history/{id}
Authorization: Bearer <api_key>
{
"status": "complete",
"preview_url": "/image/generation_result/preview.webp",
"stock_url": "/image/generation_result/stock.png"
}

Example:

Integration Notes

  • Refresh tools cache periodically by calling GET /generation/tools.
  • Use idempotency on the client side when retrying failed submissions.
  • Poll with backoff (for example 2s, 4s, 8s) to reduce load.
  • Treat output_url as externally accessible media and apply your own retention policy.
  • Validate real required fields against your OpenAPI schema at http://localhost:8000/docs.