horde_sdk.ai_horde_api.apimodels.base¶
The base classes for all AI Horde API requests/responses.
__all__
module-attribute
¶
__all__ = [
"ActiveModel",
"ActiveModelLite",
"BaseAIHordeRequest",
"ExtraSourceImageEntry",
"ExtraTextEntry",
"GenMetadataEntry",
"ImageGenerateParamMixin",
"JobRequestMixin",
"JobResponseMixin",
"JobSubmitResponse",
"LorasPayloadEntry",
"MessageSpecifiesSharedKeyMixin",
"SingleWarningEntry",
"TIPayloadEntry",
"WorkerRequestMixin",
"WorkerRequestNameMixin",
"_BaseImageGenerateParamMixin",
]
BaseAIHordeRequest ¶
Bases: HordeRequest
Base class for all AI Horde API requests.
Source code in horde_sdk/ai_horde_api/apimodels/base.py
JobRequestMixin ¶
Bases: HordeAPIData
Mix-in class for data relating to any generation jobs.
Source code in horde_sdk/ai_horde_api/apimodels/base.py
JobResponseMixin ¶
Bases: HordeAPIData
Mix-in class for data relating to any generation jobs.
Source code in horde_sdk/ai_horde_api/apimodels/base.py
WorkerRequestMixin ¶
Bases: HordeAPIData
Mix-in class for data relating to worker requests.
Source code in horde_sdk/ai_horde_api/apimodels/base.py
worker_id
instance-attribute
¶
The UUID of the worker in question for this request.
WorkerRequestNameMixin ¶
Bases: HordeAPIData
Mix-in class for data relating to worker requests.
Source code in horde_sdk/ai_horde_api/apimodels/base.py
worker_name
instance-attribute
¶
The name of the worker in question for this request.
LorasPayloadEntry ¶
Bases: HordeAPIObjectBaseModel
Represents a single lora parameter.
v2 API Model: ModelPayloadLorasStable
Source code in horde_sdk/ai_horde_api/apimodels/base.py
name
class-attribute
instance-attribute
¶
The name of the LoRa model to use.
model
class-attribute
instance-attribute
¶
The strength of the LoRa against the stable diffusion model.
clip
class-attribute
instance-attribute
¶
The strength of the LoRa against the clip model.
inject_trigger
class-attribute
instance-attribute
¶
Any trigger required to activate the LoRa model.
is_version
class-attribute
instance-attribute
¶
If true, will treat the lora name as a version ID.
TIPayloadEntry ¶
Bases: HordeAPIObjectBaseModel
Represents a single textual inversion (embedding) parameter.
v2 API Model: ModelPayloadTextualInversionsStable
Source code in horde_sdk/ai_horde_api/apimodels/base.py
name
class-attribute
instance-attribute
¶
The name or ID of the textual inversion model to use.
inject_ti
class-attribute
instance-attribute
¶
Whether to automatically insert the TI into the prompt or negprompt.
strength
class-attribute
instance-attribute
¶
The strength to apply the textual inversion model.
validate_inject_ti ¶
Ensure that the inject_ti is either 'prompt' or 'negprompt'.
Source code in horde_sdk/ai_horde_api/apimodels/base.py
validate_strength ¶
Ensure that the strength is non-zero.
strength_only_if_inject_ti ¶
Ensure that the strength is only set if the inject_ti is set.
Source code in horde_sdk/ai_horde_api/apimodels/base.py
ExtraSourceImageEntry ¶
Bases: HordeAPIObjectBaseModel
Represents a single extra source image.
v2 API Model: ExtraSourceImage
Source code in horde_sdk/ai_horde_api/apimodels/base.py
original_url
class-attribute
instance-attribute
¶
The URL of the original image after it was downloaded.
image
class-attribute
instance-attribute
¶
The URL of the image to download, or the base64 string once downloaded.
strength
class-attribute
instance-attribute
¶
The strength to apply to this image on various operations.
ExtraTextEntry ¶
Bases: HordeAPIObjectBaseModel
Represents a single extra text.
v2 API Model: ExtraText
Source code in horde_sdk/ai_horde_api/apimodels/base.py
SingleWarningEntry ¶
Bases: HordeAPIObjectBaseModel
Represents a single warning.
v2 API Model: RequestSingleWarning
Source code in horde_sdk/ai_horde_api/apimodels/base.py
code
class-attribute
instance-attribute
¶
The code uniquely identifying this warning.
message
class-attribute
instance-attribute
¶
The human-readable description of this warning
code_must_be_known ¶
Ensure that the warning code is in this list of supported warning codes.
Source code in horde_sdk/ai_horde_api/apimodels/base.py
ImageGenerateParamMixin ¶
Bases: _BaseImageGenerateParamMixin
Contains basic and api-specific parameters for image generation.
v2 API Model: ModelPayloadRootStable
Source code in horde_sdk/ai_horde_api/apimodels/base.py
model_config
class-attribute
instance-attribute
¶
model_config = (
ConfigDict(frozen=True, extra="allow")
if not os.getenv("TESTS_ONGOING")
else ConfigDict(frozen=True, extra="forbid")
)
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
¶
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
JobSubmitResponse ¶
Bases: HordeResponseBaseModel
Indicates that a generation job was successfully submitted and the amount of kudos gained.
Represents the data returned from the following endpoints and http status codes
- /v2/generate/text/submit | TextGenerationJobSubmitRequest [POST] -> 200
- /v2/generate/submit | ImageGenerationJobSubmitRequest [POST] -> 200
v2 API Model: GenerationSubmitted
Source code in horde_sdk/ai_horde_api/apimodels/base.py
GenMetadataEntry ¶
Bases: HordeAPIObjectBaseModel
Represents a single generation metadata entry.
v2 API Model: GenerationMetadataStable
Source code in horde_sdk/ai_horde_api/apimodels/base.py
type_
class-attribute
instance-attribute
¶
The relevance of the metadata field.
value
class-attribute
instance-attribute
¶
The value of the metadata field.
ref
class-attribute
instance-attribute
¶
Optionally a reference for the metadata (e.g. a lora ID)
validate_type ¶
Ensure that the type is in this list of supported types.
Source code in horde_sdk/ai_horde_api/apimodels/base.py
validate_value ¶
Ensure that the value is in this list of supported values.
Source code in horde_sdk/ai_horde_api/apimodels/base.py
MessageSpecifiesSharedKeyMixin ¶
Bases: HordeAPIData
Mix-in class to describe an endpoint for which you can specify a shared key.
Source code in horde_sdk/ai_horde_api/apimodels/base.py
ActiveModelLite ¶
Bases: HordeAPIObjectBaseModel
Represents a single active model.
v2 API Model: ActiveModelLite
Source code in horde_sdk/ai_horde_api/apimodels/base.py
ActiveModel ¶
Bases: ActiveModelLite
Represents a single active model.
v2 API Model: ActiveModel
Source code in horde_sdk/ai_horde_api/apimodels/base.py
eta
class-attribute
instance-attribute
¶
Estimated time in seconds for this model's queue to be cleared.
jobs
class-attribute
instance-attribute
¶
The job count waiting to be generated by this model.
performance
class-attribute
instance-attribute
¶
The average speed of generation for this model.
queued
class-attribute
instance-attribute
¶
The amount waiting to be generated by this model.
type_
class-attribute
instance-attribute
¶
The model type (text or image).