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

# Initiate an Asynchronous request to generate text

`POST /v2/generate/text/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 20 minutes.
Asynchronous requests live for 20 minutes before being considered stale and being deleted.

## Headers

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

## Request body

- GenerationInputKobold
  - `prompt` string — The prompt which will be sent to KoboldAI to generate text.
  - `params` ModelGenerationInputKobold
    - `n` integer
    - `frmtadsnsp` boolean — Input formatting option. When enabled, adds a leading space to your input if there is no trailing whitespace at the end of the previous action.
    - `frmtrmblln` boolean — Output formatting option. When enabled, replaces all occurrences of two or more consecutive newlines in the output with one newline.
    - `frmtrmspch` boolean — Output formatting option. When enabled, removes #/@%}{+=~|\^<> from the output.
    - `frmttriminc` boolean — Output formatting option. When enabled, removes some characters from the end of the output such that the output doesn't end in the middle of a sentence. If the output is less than one sentence long, does nothing.
    - `max_context_length` integer — Maximum number of tokens to send to the model.
    - `max_length` integer — Number of tokens to generate.
    - `rep_pen` number — Base repetition penalty value.
    - `rep_pen_range` integer — Repetition penalty range.
    - `rep_pen_slope` number — Repetition penalty slope.
    - `singleline` boolean — Output formatting option. When enabled, removes everything after the first line of the output, including the newline.
    - `temperature` number — Temperature value.
    - `tfs` number — Tail free sampling value.
    - `top_a` number — Top-a sampling value.
    - `top_k` integer — Top-k sampling value.
    - `top_p` number — Top-p sampling value.
    - `typical` number — Typical sampling value.
    - `sampler_order` integer[]
    - `use_default_badwordsids` boolean — When True, uses the default KoboldAI bad word IDs.
    - `stop_sequence` string[]
    - `min_p` number — Min-p sampling value.
    - `smoothing_factor` number — Quadratic sampling value.
    - `dynatemp_range` number — Dynamic temperature range value.
    - `dynatemp_exponent` number — Dynamic temperature exponent value.
  - `softprompt` string — Specify which softpompt needs to be used to service this request.
  - `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.
  - `workers` string[]
  - `worker_blacklist` boolean — If true, the worker list will be treated as a blacklist instead of a whitelist.
  - `models` string[]
  - `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.
  - `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
  - `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 max context and max tokens 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)
