async_
ImageGenerateAsyncResponse
Bases: HordeResponseBaseModel, JobResponseMixin, ResponseRequiringFollowUpMixin, ContainsMessageResponseMixin
The expected cost of the requested job and any warnings generated by the server.
A typical warning is that the request is not currently possible. You may want to handle certain
warnings in your application. See :class:horde_sdk.ai_horde_api.apimodels.base.SingleWarningEntry for more
information.
Represents the data returned from the /v2/generate/async endpoint with http status code 202.
v2 API Model: RequestAsync
Source code in horde_sdk/ai_horde_api/apimodels/generate/async_.py
warnings
class-attribute
instance-attribute
Any warnings that were generated by the server or a serving worker.
model_config
class-attribute
instance-attribute
message
class-attribute
instance-attribute
A message from the API. This is typically an error or warning message, but may also be informational.
time_constructed
property
The time the model was constructed (in epoch time).
validate_warnings
Log any warnings that were generated by the server or a serving worker.
Source code in horde_sdk/ai_horde_api/apimodels/generate/async_.py
get_follow_up_returned_params
get_follow_up_default_request_type
classmethod
get_follow_up_request_types
classmethod
get_follow_up_request_types() -> (
list[
type[
ImageGenerateCheckRequest
| ImageGenerateStatusRequest
]
]
)
Source code in horde_sdk/ai_horde_api/apimodels/generate/async_.py
get_follow_up_failure_cleanup_request_type
classmethod
get_api_model_name
classmethod
__hash__
__eq__
get_follow_up_extra_params
Return any additional information required from this response to submit a follow up request.
Source code in horde_sdk/generic_api/apimodels.py
get_follow_up_all_params
Return the required inf from this response to submit any follow up requests warranted from this response.
Note that this dict uses the alias field names (as seen on the API), not the python field names.
get_follow_up_failure_cleanup_params is not included.
This is used for context management.
Returns:
-
list[dict[str, object]]–list[dict[str, object]]: A list of dicts of parameter names and values for each follow up request.
Source code in horde_sdk/generic_api/apimodels.py
get_follow_up_failure_cleanup_params
Return any extra information required from this response to clean up after a failed follow up request.
Note that this dict uses the alias field names (as seen on the API), not the python field names.
This is used for context management.
Source code in horde_sdk/generic_api/apimodels.py
get_follow_up_failure_cleanup_request
Return the request for this response to clean up after a failed follow up request.
Source code in horde_sdk/generic_api/apimodels.py
ignore_failure
Return if the object is in a state which doesn't require failure follow up.
does_target_request_follow_up
Return whether the target_request would follow up on this request.
Parameters:
-
target_request(HordeRequest) –The request to check if it would follow up on this request.
Returns:
-
bool(bool) –Whether the
target_requestwould follow up on this request.
Source code in horde_sdk/generic_api/apimodels.py
validate_id
Ensure that the job ID is not empty.
Source code in horde_sdk/ai_horde_api/apimodels/base.py
get_sensitive_fields
classmethod
get_extra_fields_to_exclude_from_log
Return an additional set of fields to exclude from the log_safe_model_dump method.
log_safe_model_dump
Return a dict of the model's fields, with any sensitive fields redacted.
Source code in horde_sdk/generic_api/apimodels.py
ImageGenerateAsyncDryRunResponse
Bases: HordeResponseBaseModel
Request the expected cost of the job without actually starting the job.
Represents the data returned from the /v2/generate/async endpoint with http status code 200.
v2 API Model: _ANONYMOUS_MODEL
Source code in horde_sdk/ai_horde_api/apimodels/generate/async_.py
time_constructed
property
The time the model was constructed (in epoch time).
model_config
class-attribute
instance-attribute
get_api_model_name
classmethod
get_sensitive_fields
classmethod
get_extra_fields_to_exclude_from_log
Return an additional set of fields to exclude from the log_safe_model_dump method.
log_safe_model_dump
Return a dict of the model's fields, with any sensitive fields redacted.
Source code in horde_sdk/generic_api/apimodels.py
ImageGenerationInputPayload
Bases: ImageGenerateParamMixin
Represents the 'params' field in the /v2/generate/async endpoint.
v2 API Model: ModelGenerationInputStable
Source code in horde_sdk/ai_horde_api/apimodels/generate/async_.py
steps
class-attribute
instance-attribute
The number of image generation steps to perform.
n
class-attribute
instance-attribute
The number of images to generate. Defaults to 1, maximum is 20.
model_config
class-attribute
instance-attribute
model_config = (
ConfigDict(frozen=True, extra="allow")
if not getenv("TESTS_ONGOING")
else ConfigDict(frozen=True, extra="forbid")
)
height
class-attribute
instance-attribute
The desired output image height.
width
class-attribute
instance-attribute
The desired output image width.
sampler_name
class-attribute
instance-attribute
The sampler to use for this generation. Defaults to KNOWN_IMAGE_SAMPLERS.k_lms.
karras
class-attribute
instance-attribute
Set to True if you want to use the Karras scheduling.
cfg_scale
class-attribute
instance-attribute
The cfg_scale to use for this generation. Defaults to 7.5.
denoising_strength
class-attribute
instance-attribute
The denoising strength to use for this generation. Defaults to 1.
clip_skip
class-attribute
instance-attribute
The number of clip layers to skip.
post_processing
class-attribute
instance-attribute
post_processing: list[
str
| KNOWN_UPSCALERS
| KNOWN_FACEFIXERS
| KNOWN_MISC_POST_PROCESSORS
] = Field(default_factory=list)
A list of post-processing models to use.
post_processing_order
class-attribute
instance-attribute
The order in which to apply post-processing models. Applying upscalers or removing backgrounds before facefixers costs less kudos.
facefixer_strength
class-attribute
instance-attribute
The strength of the facefixer model.
hires_fix
class-attribute
instance-attribute
Set to True if you want to use the hires fix.
hires_fix_denoising_strength
class-attribute
instance-attribute
The strength of the denoising for the hires fix second pass.
loras
class-attribute
instance-attribute
A list of lora parameters to use.
tis
class-attribute
instance-attribute
A list of textual inversion (embedding) parameters to use.
workflow
class-attribute
instance-attribute
The specific comfyUI workflow to use.
transparent
class-attribute
instance-attribute
When true, will generate an image with a transparent background
tiling
class-attribute
instance-attribute
Set to True if you want to use seamless tiling.
special
class-attribute
instance-attribute
Reserved for future use.
seed
class-attribute
instance-attribute
The seed to use for this generation. If not provided, a random seed will be used.
seed_variation
class-attribute
instance-attribute
Deprecated.
control_type
class-attribute
instance-attribute
The type of control net type to use.
image_is_control
class-attribute
instance-attribute
Set to True if the image is a control image.
return_control_map
class-attribute
instance-attribute
Set to True if you want the ControlNet map returned instead of a generated image.
extra_texts
class-attribute
instance-attribute
A list of extra texts and prompts to use in the comfyUI workflow.
use_nsfw_censor
class-attribute
instance-attribute
If the request is SFW, and the worker accidentally generates NSFW, it will send back a censored image.
get_api_model_name
classmethod
validate_n
Ensure that n is at least 1.
Source code in horde_sdk/ai_horde_api/apimodels/generate/async_.py
get_sensitive_fields
classmethod
get_extra_fields_to_exclude_from_log
Return an additional set of fields to exclude from the log_safe_model_dump method.
log_safe_model_dump
Return a dict of the model's fields, with any sensitive fields redacted.
Source code in horde_sdk/generic_api/apimodels.py
post_processors_must_be_known
post_processors_must_be_known(
v: list[
str
| KNOWN_UPSCALERS
| KNOWN_FACEFIXERS
| KNOWN_MISC_POST_PROCESSORS
],
) -> list[
str
| KNOWN_UPSCALERS
| KNOWN_FACEFIXERS
| KNOWN_MISC_POST_PROCESSORS
]
Ensure that the post processors are in this list of supported post processors.
Source code in horde_sdk/ai_horde_api/apimodels/base.py
sampler_name_must_be_known
Ensure that the sampler name is in this list of supported samplers.
Source code in horde_sdk/ai_horde_api/apimodels/base.py
random_seed_if_none
If the seed is None, generate a random seed.
Source code in horde_sdk/ai_horde_api/apimodels/base.py
control_type_must_be_known
control_type_must_be_known(
v: str | KNOWN_IMAGE_CONTROLNETS | None,
) -> str | KNOWN_IMAGE_CONTROLNETS | None
Ensure that the control type is in this list of supported control types.
Source code in horde_sdk/ai_horde_api/apimodels/base.py
ImageGenerateAsyncRequest
Bases: BaseAIHordeRequest, APIKeyAllowedInRequestMixin, RequestUsesWorkerMixin
Request to start an image generation job.
Upon a successful response, you should poll the status of the job using the
check endpoint. See :class:horde_sdk.ai_horde_api.apimodels.generate.check.ImageGenerateCheckRequest for more
information.
Represents a POST request to the /v2/generate/async endpoint.
v2 API Model: GenerationInputStable
Source code in horde_sdk/ai_horde_api/apimodels/generate/async_.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | |
prompt
instance-attribute
The prompt which will be sent to Stable Diffusion to generate an image.
params
class-attribute
instance-attribute
The parameters for the image generation.
nsfw
class-attribute
instance-attribute
Set to true if this request is NSFW. This will skip workers which censor images.
censor_nsfw
class-attribute
instance-attribute
If the request is SFW, and the worker accidentally generates NSFW, it will send back a censored image.
r2
class-attribute
instance-attribute
If True, the image will be sent via cloudflare r2 download link.
shared
class-attribute
instance-attribute
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
class-attribute
instance-attribute
If enabled, suspicious prompts are sanitized through a string replacement filter instead.
source_image
class-attribute
instance-attribute
The public URL of the source image or a base64 string to use.
source_processing
class-attribute
instance-attribute
If source_image is provided, specifies how to process it.
source_mask
class-attribute
instance-attribute
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
class-attribute
instance-attribute
Additional uploaded images which can be used for further operations.
model_config
class-attribute
instance-attribute
trusted_workers
class-attribute
instance-attribute
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
class-attribute
instance-attribute
When True, allows slower workers to pick up this request. Disabling this incurs an extra kudos cost.
extra_slow_workers
class-attribute
instance-attribute
When True, allows extra slow workers to pick up this request.
workers
class-attribute
instance-attribute
A list of worker IDs to use for this request. If empty, any worker can pick up the request. Using this incurs and extra kudos cost.
worker_blacklist
class-attribute
instance-attribute
If true, the worker list will be treated as a blacklist instead of a whitelist.
validated_backends
class-attribute
instance-attribute
When true, only inference backends that are validated by the AI Horde devs will serve this request. When False, non-validated backends will also be used which can increase speed but you may end up with unexpected results.
style
class-attribute
instance-attribute
The style ID to use for the generation.
dry_run
class-attribute
instance-attribute
If true, the request will not be processed, but will return a response with the estimated kudos cost.
webhook
class-attribute
instance-attribute
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.
allow_downgrade
class-attribute
instance-attribute
If true, the request can be modified to lesser parameters if the original request is too expensive.
proxied_account
class-attribute
instance-attribute
The account this request is being proxied for. This requires the sending API to be a service account.
disable_batching
class-attribute
instance-attribute
When true, This request will not use batching. This will allow you to retrieve accurate seeds. Feature is restricted to Trusted users and Patreons.
apikey
class-attribute
instance-attribute
Defaults to ANON_API_KEY. See also .is_api_key_required()
accept
class-attribute
instance-attribute
The 'accept' header field.
client_agent
class-attribute
instance-attribute
The requesting client's agent. You should set this to reflect the name, version and contact information for your client.
validate_censor_nsfw
Ensure that censor_nsfw is not set when nsfw is enabled.
Source code in horde_sdk/ai_horde_api/apimodels/generate/async_.py
get_api_model_name
classmethod
get_http_method
classmethod
get_api_endpoint_subpath
classmethod
get_default_success_response_type
classmethod
get_success_status_response_pairs
classmethod
Source code in horde_sdk/ai_horde_api/apimodels/generate/async_.py
get_number_of_results_expected
get_extra_fields_to_exclude_from_log
get_sensitive_fields
classmethod
log_safe_model_dump
Return a dict of the model's fields, with any sensitive fields redacted.
Source code in horde_sdk/generic_api/apimodels.py
is_api_key_required
classmethod
validate_api_key_length
Validate that the API key is the correct length, or is the special ANON_API_KEY.
Source code in horde_sdk/generic_api/apimodels.py
get_api_endpoint_url
classmethod
Return the endpoint URL, including the path to the specific API action defined by this object.
Source code in horde_sdk/generic_api/apimodels.py
get_api_url
classmethod
get_header_fields
classmethod
Return a list of field names from this request object that should be sent as header fields.
This is in addition to GenericHeaderFields's values, and possibly the API specific class
which inherits from GenericHeaderFields, typically found in the horde_sdk.<api_name>_api.metadata module.
Source code in horde_sdk/generic_api/apimodels.py
get_query_fields
classmethod
Return a list of field names from this request object that should be sent as query parameters.
This is in addition to GenericQueryFields's values, and possibly the API specific class
which inherits from GenericQueryFields, typically found in the horde_sdk.<api_name>_api.metadata module.
Source code in horde_sdk/generic_api/apimodels.py
get_requires_follow_up
Return whether this request requires a follow up request(s).
Returns:
-
bool(bool) –Whether this request requires a follow up request to close the job on the server.