YUYU_M3 Text to Image

YUYU_M3 generates a brand-new image from a text description (prompt) only; no images are needed. Use aspect_ratio to choose the image size from 6 ratios, up to 1024×1024.

POST /api/tasks/image-generation
X-Api-Key: sk-live-xxxx
Content-Type: application/json
Idempotency-Key: optional, see below

Full example

curl -X POST https://yuyuvideo.com/api/tasks/image-generation \
  -H "X-Api-Key: sk-live-xxxx" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order-20260716-00045" \
  -d '{
    "model": "YUYU_M3",
    "prompt": "beautiful woman, cinematic lighting",
    "aspect_ratio": "1:1",
    "payload": { "external_order_id": "order-20260716-00045" },
    "callback_url": "https://example.com/webhooks/yuyu-image"
  }'

On success, you get 201 Created and the task data. At this point the task is still queued and files is empty. credits is the number of credits charged for this task; the number in the example is for reference only:

{
  "public_id": "01K1M2N3P4Q5R6S7T8V9W0XY15",
  "type": 2,
  "status": 0,
  "credits": 10,
  "params": {
    "model": "YUYU_M3",
    "prompt": "beautiful woman, cinematic lighting",
    "aspect_ratio": "1:1",
    "payload": { "external_order_id": "order-20260716-00045" },
    "callback_url": "https://example.com/webhooks/yuyu-image"
  },
  "error_code": null,
  "error_message": null,
  "created_at": "2026-07-16T08:00:00.000000Z",
  "finished_at": null,
  "files_expire_at": null,
  "files_expired": false,
  "files": []
}

To check progress and download the image, see Query Tasks and Download Results.

Parameters

Field Type Required Description
model string Yes Set to YUYU_M3
prompt string Yes Image description, up to 10000 characters
images — No No images needed; including it returns 422
aspect_ratio string No Image aspect ratio; actual size (width×height) in parentheses: 1:1 (1024×1024), 9:16 (576×1024, portrait), 16:9 (1024×576, landscape), 3:4 (768×1024), 4:3 (1024×768), 2:3 (688×1024). If omitted, the size is the model's default
seed integer No Random seed; must be an integer of 0 or greater
resolution — No Not supported; use aspect_ratio instead. Including it returns 422
payload object No Custom data, such as your order number. The system never reads or modifies it, and returns it as-is in task queries and webhook notifications
callback_url string No URL to notify when the task finishes. Must start with https://, up to 2000 characters. See Callbacks (Webhook)

Specifying a model that doesn't exist returns 422: Unknown model alias: {model}.

Including any parameter not listed in the table (except age_declared; see Pre-generation Age Check) returns 422; it is not ignored.

Idempotency-Key

Prevents duplicate tasks. Pass a custom string in this header; we recommend a unique value from your system, such as an order number:

Idempotency-Key: order-20260711-00045

If you send repeated requests with the same API key and the same Idempotency-Key within a short time, only one task is created and credits are charged only once. Subsequent duplicate requests return 200 OK with the original task.

Without this header, every request creates a new task.

Errors

Status code Cause Response
422 Invalid parameters, e.g. a missing required field, wrong type, or an aspect_ratio that isn't one of the allowed values The errors field lists the error for each field
422 model doesn't exist { "message": "Unknown model alias: {model}" }
402 Insufficient credits { "message": "Insufficient credits to complete this charge." }
429 Too many queued image tasks { "message": "Too many pending tasks of this type; please retry later." }. Use the Retry-After response header to decide when to retry

For charging rules, see Credits and Billing.