---
title: "Initiate an Asynchronous request to generate images"
method: POST
path: "/v2/generate/async"
tags: ["v2"]
---

# Initiate an Asynchronous request to generate images

`POST /v2/generate/async`

This endpoint will immediately return with the UUID of the request for generation.
This endpoint will always be accepted, even if there are no workers available currently to fulfill this request.
Perhaps some will appear in the next 10 minutes.
Asynchronous requests live for 10 minutes before being considered stale and being deleted.

## Headers

- `apikey` string, required
- `Client-Agent` string
- `X-Fields` string, mask

## Request body

- GenerationInputStable
  - `prompt` string, required — The prompt which will be sent to Stable Diffusion to generate an image.
  - `params` ModelGenerationInputStable
    - `sampler_name` 'k_euler' | 'lcm' | 'k_euler_a' | 'k_dpmpp_2s_a' | 'DDIM' | 'dpmsolver' | 'k_lms' | 'k_dpm_fast' | 'k_dpmpp_sde' | 'k_dpm_2' | 'k_dpm_2_a' | 'k_dpm_adaptive' | 'k_heun' | 'k_dpmpp_2m'
    - `cfg_scale` number
    - `denoising_strength` number
    - `seed` string — The seed to use to generate this request. You can pass text as well as numbers.
    - `height` integer — The height of the image to generate.
    - `width` integer — The width of the image to generate.
    - `seed_variation` integer — If passed with multiple n, the provided seed will be incremented every time by this value.
    - `post_processing` string[]
    - `karras` boolean — Set to True to enable karras noise scheduling tweaks.
    - `tiling` boolean — Set to True to create images that stitch together seamlessly.
    - `hires_fix` boolean — Set to True to process the image at base resolution before upscaling and re-processing.
    - `clip_skip` integer — The number of CLIP language processor layers to skip.
    - `control_type` 'canny' | 'hed' | 'depth' | 'normal' | 'openpose' | 'seg' | 'scribble' | 'fakescribbles' | 'hough'
    - `image_is_control` boolean — Set to True if the image submitted is a pre-generated control map for ControlNet use.
    - `return_control_map` boolean — Set to True if you want the ControlNet map returned instead of a generated image.
    - `facefixer_strength` number
    - `loras` ModelPayloadLorasStable[]
      - `name` string, required — The exact name or CivitAI Model Page ID of the LoRa. If is_version is true, this should be the CivitAI version ID.
      - `model` number — The strength of the LoRa to apply to the SD model.
      - `clip` number — The strength of the LoRa to apply to the clip model.
      - `inject_trigger` string — If set, will try to discover a trigger for this LoRa which matches or is similar to this string and inject it into the prompt. If 'any' is specified it will be pick the first trigger.
      - `is_version` boolean — If true, will consider the LoRa ID as a CivitAI version ID and search accordingly. Ensure the name is an integer.
    - `tis` ModelPayloadTextualInversionsStable[]
      - `name` string, required — The exact name or CivitAI ID of the Textual Inversion.
      - `inject_ti` 'prompt' | 'negprompt' — If set, Will automatically add this TI filename to the prompt or negative prompt accordingly using the provided strength. If this is set to None, then the user will have to manually add the embed to the prompt themselves.
      - `strength` number — The strength with which to apply the TI to the prompt. Only used when inject_ti is not None
    - `special` ModelSpecialPayloadStable
      - `*` object
    - `steps` integer
    - `n` integer — The amount of images to generate.
  - `nsfw` boolean — Set to true if this request is NSFW. This will skip workers which censor images.
  - `trusted_workers` boolean — When true, only trusted workers will serve this request. When False, Evaluating workers will also be used which can increase speed but adds more risk!
  - `slow_workers` boolean — When True, allows slower workers to pick up this request. Disabling this incurs an extra kudos cost.
  - `censor_nsfw` boolean — If the request is SFW, and the worker accidentally generates NSFW, it will send back a censored image.
  - `workers` string[]
  - `worker_blacklist` boolean — If true, the worker list will be treated as a blacklist instead of a whitelist.
  - `models` string[]
  - `source_image` string — The Base64-encoded webp to use for img2img.
  - `source_processing` 'img2img' | 'inpainting' | 'outpainting' | 'remix' — If source_image is provided, specifies how to process it.
  - `source_mask` string — If source_processing is set to 'inpainting' or 'outpainting', this parameter can be optionally provided as the Base64-encoded webp mask of the areas to inpaint. If this arg is not passed, the inpainting/outpainting mask has to be embedded as alpha channel.
  - `extra_source_images` ExtraSourceImage[]
    - `image` string — The Base64-encoded webp to use for further processing.
    - `strength` number — Optional field, determining the strength to use for the processing
  - `r2` boolean — If True, the image will be sent via cloudflare r2 download link.
  - `shared` boolean — If True, The image will be shared with LAION for improving their dataset. This will also reduce your kudos consumption by 2. For anonymous users, this is always True.
  - `replacement_filter` boolean — If enabled, suspicious prompts are sanitized through a string replacement filter instead.
  - `dry_run` boolean — When true, the endpoint will simply return the cost of the request in kudos and exit.
  - `proxied_account` string — If using a service account as a proxy, provide this value to identify the actual account from which this request is coming from.
  - `disable_batching` boolean — When true, This request will not use batching. This will allow you to retrieve accurate seeds. Feature is restricted to Trusted users and Patreons.
  - `allow_downgrade` boolean — When true and the request requires upfront kudos and the account does not have enough The request will be downgraded in steps and resolution so that it does not need upfront kudos.
  - `webhook` string — Provide a URL where the AI Horde will send a POST call after each delivered generation. The request will include the details of the job as well as the request ID.

## Response `202`

Generation Queued

- RequestAsync
  - `id` string — The UUID of the request. Use this to retrieve the request status in the future.
  - `kudos` number — The expected kudos consumption for this request.
  - `message` string — Any extra information from the horde about this request.
  - `warnings` RequestSingleWarning[]
    - `code` 'NoAvailableWorker' | 'ClipSkipMismatch' | 'StepsTooFew' | 'StepsTooMany' | 'CfgScaleMismatch' | 'CfgScaleTooSmall' | 'CfgScaleTooLarge' | 'SamplerMismatch' | 'SchedulerMismatch' — A unique identifier for this warning.
    - `message` string — Something that you should be aware about this request, in plain text.

## Other responses

- `400` — Validation Error
- `401` — Invalid API Key
- `429` — Too Many Prompts
- `503` — Maintenance Mode

---

[API](https://skmtc.net/haidra-org/apis/ai-horde.md) · [All operations](https://skmtc.net/haidra-org/apis/ai-horde/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/haidra-org/ai-horde/versions/dfeb0bedd935/schema)
