---
title: "Create a generation task"
description: "Submit an asynchronous image generation task with the v1 parameters. The response returns the task ID with a waiting status; fetch the task to read its outputs."
canonical: "https://platform.pixai.art/en/docs/api/task/createGenerationTask"
last-updated: "2026-11-02"
---

# Create a generation task

Submit an asynchronous image generation task with the v1 parameters. The response returns the task ID with a waiting status; fetch the task to read its outputs.



## POST https://api.pixai.art/v1/task

Authentication: send your API key as `Authorization: Bearer <API key>`.

Machine-readable OpenAPI spec: https://platform.pixai.art/openapi-spec.yaml

### Request body (`application/json`)

- `parameters` (object, required)
  The schema fully defines the parameters allowed for the image generation tasks we currently support.
  You can learn about the specific functions of some parameters by searching for the term "stable diffusion glossary."
- `parameters.prompts` (string, optional)
  What you want to see in the generated image.
  The prompt is a short sentence or a few words that describe the content of the image.

  We support partial "attention" or "emphasis" in prompts with round brackets like A1111 WebUI or ComfyUI. But Square brackets and curly braces are not supported.
  Length: 0 to 4096 characters.
  Example: `"1girl, green hair, solo, standing, flower, pantyhose, long hair, bowtie, ahoge, mole under mouth, single braid, very long hair, blush, mole, bow, school uniform, braid"`.
- `parameters.modelId` (string, optional)
  The modelId is the unique identifier for a specific model version in the PixAI Model Market. It's taken from the model version's URL.

  How to find modelId:
  1. Open the model page on PixAI.
  2. Click the model version you'd like to use.
  3. Copy the last path segment of the URL — that's the modelId.

  Example URL: `https://pixai.art/model/<id>-<slug>/<modelVersionId>` → modelId is `<modelVersionId>`.

  We don't enforce a hard rate limit. However, overall system performance depends on available compute resources. During peak hours, requests may be queued and generation times may fluctuate normally. For fast, high-quality generation, start with the [Recommended Models](https://platform.pixai.art/en/docs/references/models#recommended-models).
  Example: `"1811528826405408057"`.
- `parameters.width` (integer, optional)
  Output width in pixels for text-to-image, works with `height` to set aspect ratio .

  Each model has a list of preset resolutions, choosing one of those to yield the best quality.
  See the [Supported Resolutions](https://platform.pixai.art/en/docs/references/supported-resolutions) for details.
  Range: 512 to 1280.
  Example: `768`.
- `parameters.height` (integer, optional)
  Output height in pixels for text-to-image, works with `width` to set aspect ratio .
  Each model has a list of preset resolutions, choosing one of those to yield the best quality. See the [Supported Resolutions](https://platform.pixai.art/en/docs/references/supported-resolutions) for details.
  Range: 512 to 1280.
  Example: `1280`.
- `parameters.lora` (object, optional)
  Apply one or more LoRA adapters to the base model. LoRA (Low-Rank Adaptation) lets you fine-tune output style/content without retraining the full model.

  Format: a JSON object where each key is a LoRA model version ID from the Model Market, and each value is that LoRA's weight (0.0–1.0).

  How to find LoRA version ID:
  1. Open the LoRA model page on PixAI.
  2. Click the LoRA version you'd like to use.
  3. Copy the last path segment of the URL — that's the LoRA version ID.

  Example URL: `https://pixai.art/model/<loraModelId>/<loraVersionId>` → LoRA version ID is `<loraVersionId>`.


  Notes:
  - You can combine multiple LoRAs (max 10).  
  - LoRA compatibility and best practices may vary by base model; see
    the LoRA's model page for guidance.
  Example: `{"1744880666293972790":0.7}`.
- `parameters.batchSize` (number, optional)
  The number of images to generate in one task.
  Range: 1 to 4.
  Example: `4`.
- `parameters.inferenceProfile` (string, optional)
  The inference profile controlling generation behavior (speed/quality tradeoff).
  - `lite`: Fastest, basic quality.
  - `standard`: Balanced speed and quality (default).
  - `pro`: Higher quality, slower.
  - `ultra`: Highest quality, slowest.

  The enum reflects currently known profiles for the DIT 26A model type and may expand over time.
  Use `GET /model/{modelId}/version/{versionId}/inference-profiles` to query profiles available for a specific model version.
  Some profiles require membership. If a profile defines a step range (`minSteps`/`maxSteps`), `samplingSteps` must fall within it.
  Note: Only available for the **Tsubaki.2** and **Tsubaki.3** model families.
  Allowed values: `lite`, `standard`, `pro`, `ultra`.
  Example: `"standard"`.
- `parameters.modelStyle` (object (one of the variants below), optional)
  Specifies the style applied during image generation. The style influences how the model
  renders the output. It can be provided in three ways.
  - `key`: Use a pre-defined style key ID associated with the model.
  - `custom`: Pass a custom style string directly.
  - `styleKeyRef`: Reference a stored style key by its reference ID.
  Note: Only available for the **Tsubaki.2** and **Tsubaki.3** model families.
  - Variant 1:
    - `parameters.modelStyle.type` (string, required)
      Allowed values: `key`.
    - `parameters.modelStyle.keyId` (string, required)
      The ID of a pre-defined style key. Resolution of this key is performed in the context
      of the selected `modelId`; available keys therefore depend on the chosen model version.
      You can query the available style keys via the `GET /generationModel/{modelVersionId}/style-keys` endpoint.

      Currently known `keyId` values for the DIT 26A (`mmdit26amodel`) model type:
      - `low-saturation-expressive-eyes` — Muted & Transparent
      - `colored-pencil-grain` — Chromatic Pencil
      - `grey-blocks-lineless` — Grey Wash
      - `oil-watercolor-blend` — Water-Infused Oil
      - `hard-line-monochrome-accent` — Mono-Chic
      - `korean-style` — Polished Manhwa
      - `lineart-watercolor-airy` — Soft Glow Line
      - `minimal-flat-color` — Minimal Flat
      - `luminous-retro-impasto` — Luminous Impasto
      - `anime-watercolor-impasto` — Watercolor Glow
      - `high-contrast-retro-vivid` — Neon Vivid
      - `flat-anime-pastel` — Pastel Flat
      - `paper-watercolor` — Light Watercolor
      - `classic-japanese` — Classic Anime
      - `retro-tv-anime` — 90s Retro-Cell
      - `poster-graffiti` — Neon Poster
      - `clean-flat-illustration` — Clean Flat-Illustration
      - `art-crayon` — Art Crayon
      - `painterly-doodle` — Textured Doodle
      - `retro-comic-fusion` — Retro Fusion
      - `pencil-sketch` — Pencil Sketch
      - `chibi` — Chibi
      - `retro-oil-glamour` — Retro Glossy
      - `modern-oil-glamour` — Modern Lustrous
      - `bold-line-soft-color` — Bold Line Soft
      - `glossy-glass-anime` — Glassy Anime
      - `moe-pastel` — Moe Pastel
      - `semi-realistic` — Semi-Real
      - `cool-warm-oil-contrast` — Clash Impasto
  - Variant 2:
    - `parameters.modelStyle.type` (string, required)
      Allowed values: `custom`.
    - `parameters.modelStyle.custom` (string, required)
      A raw style prompt string injected directly as a prefix to the generation prompt.
      This is an advanced option — incorrect values may degrade output quality.
  - Variant 3:
    - `parameters.modelStyle.type` (string, required)
      Allowed values: `styleKeyRef`.
    - `parameters.modelStyle.refId` (string, required)
      The reference ID of a stored style key entry (created via the `styleKeyRef` API).
      Useful for reusing a previously saved custom style across multiple tasks.
- `parameters.enableTile` (boolean, optional)
  Applies ControlNet Tile during i2i upscaling to enhance detail.
  Only effective if both mediaUrl is provided and upscale > 1.
  Note: Enabling this field will incur additional charges.
  Default: `false`.
- `parameters.upscale` (number, optional)
  Values >1 enable Hires Fix to upscale your final image. 
  Effective cap is chosen to keep the longest side stays <= 2048px.
  Models may enforce limits on maximum upscale, defaults to 1(not enabled).
  Note: Enabling this field will incur additional charges.
- `parameters.upscaleSampler` (string, optional)
  Sampling method for the Hires Fix stage when upscale is enabled.
  Allowed methdos vary by model, refer to [Models](https://platform.pixai.art/en/docs/references/models) for details, or check the model's page on PixAI.
  Note: Enabling this field will incur additional charges.
- `parameters.enableADetailer` (boolean, optional)
  Applies face-fix after generation. Availability depends on model compatibility,
  see the PixAI Image Generation page for the selected model to view the available options.
  Note: Enabling this field will incur additional charges.
  Default: `false`.
- `parameters.promptHelper` (object, optional)
  Note: Enabling this field will incur additional charges.
- `parameters.promptHelper.enable` (boolean, optional)
  Enable built-in prompt helper to rewrite prompts before generation.
- `callbackUrl` (string, optional)
  The URL to receive the task status update.
  The callback URL should be a public URL that can be accessed by our server.
  We will send a POST request to the callback URL with the task status update.

Example:

```json
{
  "parameters": {
    "prompts": "1girl, green hair, solo, standing",
    "modelId": "1983308862240288769",
    "width": 768,
    "height": 1280,
    "batchSize": 4
  }
}
```

### Example (cURL)

```bash
curl -X POST https://api.pixai.art/v1/task \
  -H "Authorization: Bearer $PIXAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "parameters": {
      "prompts": "1girl, green hair, solo, standing",
      "modelId": "1983308862240288769",
      "width": 768,
      "height": 1280,
      "batchSize": 4
    }
  }'
```

### Responses

- `200`
  Task submitted successfully.

  Example Response:
  ```json
  {
    "id": "1943547603237249965",
    "status": "waiting",
    "createdAt": "2025-11-07T14:54:35.000Z",
    "updatedAt": "2025-11-07T14:54:35.000Z",
    "outputs": { "mediaIds": [], "mediaUrls": [] }
  }
  ```
  Body fields:
  - `id` (string, required)
    The unique identifier for the task.
  - `status` (string, required)
    The status of the task.
    Allowed values: `waiting`, `running`, `completed`, `cancelled`, `failed`.
  - `createdAt` (string, required)
    The time the task was created.
  - `updatedAt` (string, required)
    The time the task was last updated.
  - `startedAt` (string, optional)
    The time the task was started.
  - `endAt` (string, optional)
    The time the task was finished.
  - `outputs` (object, optional)
    The outputs of the task.
  - `outputs.mediaIds` (string[], optional)
    The media IDs generated by the task. You can use these IDs to fetch detailed information about the generated media.

    The images you generate are usually not permanently retained. You need to retrieve your images as soon as possible.
  - `outputs.mediaUrls` ((string | null)[], optional)
    The public URL of the images generated by the task.

    The images you generate are usually not permanently retained. You need to retrieve your images as soon as possible.
    If an image is not available, it MAY be replaced by null in the array.
  - `mediaSafetyLevel` (string, optional)
    Content-safety verdict of the generated images, derived from the task's media safety score.

    Absent whenever that score is unavailable — not moderated yet, no scorable media, or moderation failed — so a completed task may still omit it. Absence does not imply safe, and polling is not guaranteed to make it appear.
    Allowed values: `nsfw`, `safe`.
  - `textSafetyLevel` (string, optional)
    Content-safety verdict of the prompt text, derived from the task's text safety score.

    Absent whenever that score is unavailable — not moderated yet, no prompt to score, or moderation failed — so a completed task may still omit it. Absence does not imply safe, and polling is not guaranteed to make it appear.
    Allowed values: `nsfw`, `safe`.
- `422`
  Validation exception
- `429`
  Too many requests
