Skip to content

horde_sdk.ai_horde_api.apimodels.sharedkeys

SharedKeySettings

Bases: _BaseSharedKeySettings

Represents the settings for a SharedKey.

v2 API Model: SharedKeyInput

Source code in horde_sdk/ai_horde_api/apimodels/sharedkeys.py
class SharedKeySettings(_BaseSharedKeySettings):
    """Represents the settings for a SharedKey.

    v2 API Model: `SharedKeyInput`
    """

    expiry: int = Field(default=-1, ge=-1)
    """The number of days until this key expires. -1 means never expires."""

expiry class-attribute instance-attribute

expiry: int = Field(default=-1, ge=-1)

The number of days until this key expires. -1 means never expires.

SharedKeyDetailsResponse

Bases: HordeResponseBaseModel, MessageSpecifiesSharedKeyMixin, SharedKeySettings

Information about a SharedKey, including its creating user, settings and utilization.

The data returned in this response can vary depending on the user's permissions, (creator, owner, or admin).

Represents the data returned from the following endpoints and http status codes
  • /v2/sharedkeys/{sharedkey_id} | SharedKeyModifyRequest [PATCH] -> 200
  • /v2/sharedkeys/{sharedkey_id} | SharedKeyDetailsRequest [GET] -> 200
  • /v2/sharedkeys | SharedKeyCreateRequest [PUT] -> 200

v2 API Model: SharedKeyDetails

Source code in horde_sdk/ai_horde_api/apimodels/sharedkeys.py
class SharedKeyDetailsResponse(HordeResponseBaseModel, MessageSpecifiesSharedKeyMixin, SharedKeySettings):
    """Information about a SharedKey, including its creating user, settings and utilization.

    The data returned in this response can vary depending on the user's permissions, (creator, owner, or admin).

    Represents the data returned from the following endpoints and http status codes:
        - /v2/sharedkeys/{sharedkey_id} | SharedKeyModifyRequest [PATCH] -> 200
        - /v2/sharedkeys/{sharedkey_id} | SharedKeyDetailsRequest [GET] -> 200
        - /v2/sharedkeys | SharedKeyCreateRequest [PUT] -> 200

    v2 API Model: `SharedKeyDetails`
    """

    username: str
    """The owning user's unique Username. It is a combination of their chosen alias plus their ID."""
    utilized: int
    """How much kudos has been utilized via this shared key until now."""

    @override
    @classmethod
    def get_api_model_name(cls) -> str | None:
        return "SharedKeyDetails"

    @field_validator("max_image_pixels", "max_image_steps", "max_text_tokens", mode="before")
    @classmethod
    def validate_restriction_values(cls, v: int) -> int:
        """Validate the restriction values.

        Args:
            v (int): The restriction value.

        Raises:
            ValueError: If the restriction value is invalid.

        Returns:
            int: The restriction value.
        """
        if v < -1:
            raise ValueError("Restriction values must be -1 or greater.")
        return v

username instance-attribute

username: str

The owning user's unique Username. It is a combination of their chosen alias plus their ID.

utilized instance-attribute

utilized: int

How much kudos has been utilized via this shared key until now.

get_api_model_name classmethod

get_api_model_name() -> str | None
Source code in horde_sdk/ai_horde_api/apimodels/sharedkeys.py
@override
@classmethod
def get_api_model_name(cls) -> str | None:
    return "SharedKeyDetails"

validate_restriction_values classmethod

validate_restriction_values(v: int) -> int

Validate the restriction values.

Parameters:

  • v (int) –

    The restriction value.

Raises:

  • ValueError –

    If the restriction value is invalid.

Returns:

  • int ( int ) –

    The restriction value.

Source code in horde_sdk/ai_horde_api/apimodels/sharedkeys.py
@field_validator("max_image_pixels", "max_image_steps", "max_text_tokens", mode="before")
@classmethod
def validate_restriction_values(cls, v: int) -> int:
    """Validate the restriction values.

    Args:
        v (int): The restriction value.

    Raises:
        ValueError: If the restriction value is invalid.

    Returns:
        int: The restriction value.
    """
    if v < -1:
        raise ValueError("Restriction values must be -1 or greater.")
    return v

ExpiryStrSharedKeyDetailsResponse

Bases: HordeResponseBaseModel, MessageSpecifiesSharedKeyMixin, _BaseSharedKeySettings

The shared key details for a style.

Represents the data returned from the following endpoints and http status codes
  • /v2/sharedkeys/{sharedkey_id} | SharedKeyModifyRequest [PATCH] -> 200
  • /v2/sharedkeys/{sharedkey_id} | SharedKeyDetailsRequest [GET] -> 200
  • /v2/sharedkeys | SharedKeyCreateRequest [PUT] -> 200

v2 API Model: _OVERLOADED_MODEL

Source code in horde_sdk/ai_horde_api/apimodels/sharedkeys.py
class ExpiryStrSharedKeyDetailsResponse(
    HordeResponseBaseModel,
    MessageSpecifiesSharedKeyMixin,
    _BaseSharedKeySettings,
):
    """The shared key details for a style.

    Represents the data returned from the following endpoints and http status codes:
        - /v2/sharedkeys/{sharedkey_id} | SharedKeyModifyRequest [PATCH] -> 200
        - /v2/sharedkeys/{sharedkey_id} | SharedKeyDetailsRequest [GET] -> 200
        - /v2/sharedkeys | SharedKeyCreateRequest [PUT] -> 200

    v2 API Model: `_OVERLOADED_MODEL`
    """

    expiry: str | None = None  # FIXME - duplicated in SharedKeyDetailsResponse due to overloaded model
    """The expiry date of the shared key."""
    username: str  # FIXME - duplicated in SharedKeyDetailsResponse due to overloaded model
    """The owning user's unique Username. It is a combination of their chosen alias plus their ID."""
    utilized: int  # FIXME - duplicated in SharedKeyDetailsResponse due to overloaded model
    """How much kudos has been utilized via this shared key until now."""

    @override
    @classmethod
    def get_api_model_name(cls) -> str:
        return _OVERLOADED_MODEL

expiry class-attribute instance-attribute

expiry: str | None = None

The expiry date of the shared key.

username instance-attribute

username: str

The owning user's unique Username. It is a combination of their chosen alias plus their ID.

utilized instance-attribute

utilized: int

How much kudos has been utilized via this shared key until now.

get_api_model_name classmethod

get_api_model_name() -> str
Source code in horde_sdk/ai_horde_api/apimodels/sharedkeys.py
@override
@classmethod
def get_api_model_name(cls) -> str:
    return _OVERLOADED_MODEL

SharedKeyDetailsRequest

Bases: BaseAIHordeRequest, MessageSpecifiesSharedKeyMixin

Request the details of a SharedKey, including its creating user, settings, and utilization.

The response data can vary depending on the user's permissions, (e.g., if they are a creator, owner, or admin).

Represents a GET request to the /v2/sharedkeys/{sharedkey_id} endpoint.

Source code in horde_sdk/ai_horde_api/apimodels/sharedkeys.py
class SharedKeyDetailsRequest(BaseAIHordeRequest, MessageSpecifiesSharedKeyMixin):
    """Request the details of a SharedKey, including its creating user, settings, and utilization.

    The response data can vary depending on the user's permissions, (e.g., if they are a creator, owner, or admin).

    Represents a GET request to the /v2/sharedkeys/{sharedkey_id} endpoint.
    """

    @override
    @classmethod
    def get_api_model_name(cls) -> str | None:
        return None

    @override
    @classmethod
    def get_http_method(cls) -> HTTPMethod:
        return HTTPMethod.GET

    @override
    @classmethod
    def get_api_endpoint_subpath(cls) -> AI_HORDE_API_ENDPOINT_SUBPATH:
        return AI_HORDE_API_ENDPOINT_SUBPATH.v2_sharedkeys

    @override
    @classmethod
    def get_default_success_response_type(cls) -> type[ExpiryStrSharedKeyDetailsResponse]:
        return ExpiryStrSharedKeyDetailsResponse

get_api_model_name classmethod

get_api_model_name() -> str | None
Source code in horde_sdk/ai_horde_api/apimodels/sharedkeys.py
@override
@classmethod
def get_api_model_name(cls) -> str | None:
    return None

get_http_method classmethod

get_http_method() -> HTTPMethod
Source code in horde_sdk/ai_horde_api/apimodels/sharedkeys.py
@override
@classmethod
def get_http_method(cls) -> HTTPMethod:
    return HTTPMethod.GET

get_api_endpoint_subpath classmethod

get_api_endpoint_subpath() -> AI_HORDE_API_ENDPOINT_SUBPATH
Source code in horde_sdk/ai_horde_api/apimodels/sharedkeys.py
@override
@classmethod
def get_api_endpoint_subpath(cls) -> AI_HORDE_API_ENDPOINT_SUBPATH:
    return AI_HORDE_API_ENDPOINT_SUBPATH.v2_sharedkeys

get_default_success_response_type classmethod

get_default_success_response_type() -> (
    type[ExpiryStrSharedKeyDetailsResponse]
)
Source code in horde_sdk/ai_horde_api/apimodels/sharedkeys.py
@override
@classmethod
def get_default_success_response_type(cls) -> type[ExpiryStrSharedKeyDetailsResponse]:
    return ExpiryStrSharedKeyDetailsResponse

SharedKeyDeleteResponse

Bases: HordeResponseBaseModel, ContainsMessageResponseMixin

Indicates that a SharedKey was successfully deleted.

Represents the data returned from the /v2/sharedkeys/{sharedkey_id} endpoint with http status code 200.

v2 API Model: SimpleResponse

Source code in horde_sdk/ai_horde_api/apimodels/sharedkeys.py
class SharedKeyDeleteResponse(HordeResponseBaseModel, ContainsMessageResponseMixin):
    """Indicates that a SharedKey was successfully deleted.

    Represents the data returned from the /v2/sharedkeys/{sharedkey_id} endpoint with http status code 200.

    v2 API Model: `SimpleResponse`
    """

    @override
    @classmethod
    def get_api_model_name(cls) -> str | None:
        return "SimpleResponse"

get_api_model_name classmethod

get_api_model_name() -> str | None
Source code in horde_sdk/ai_horde_api/apimodels/sharedkeys.py
@override
@classmethod
def get_api_model_name(cls) -> str | None:
    return "SimpleResponse"

SharedKeyDeleteRequest

Bases: BaseAIHordeRequest, MessageSpecifiesSharedKeyMixin, APIKeyAllowedInRequestMixin

Request to delete a SharedKey.

This is a privileged operation that requires the user to be the owner, a moderator, or an admin.

Represents a DELETE request to the /v2/sharedkeys/{sharedkey_id} endpoint.

Source code in horde_sdk/ai_horde_api/apimodels/sharedkeys.py
class SharedKeyDeleteRequest(
    BaseAIHordeRequest,
    MessageSpecifiesSharedKeyMixin,
    APIKeyAllowedInRequestMixin,
):
    """Request to delete a SharedKey.

    This is a privileged operation that requires the user to be the owner, a moderator, or an admin.

    Represents a DELETE request to the /v2/sharedkeys/{sharedkey_id} endpoint.
    """

    @override
    @classmethod
    def get_api_model_name(cls) -> str | None:
        return None

    @override
    @classmethod
    def get_http_method(cls) -> HTTPMethod:
        return HTTPMethod.DELETE

    @override
    @classmethod
    def get_api_endpoint_subpath(cls) -> AI_HORDE_API_ENDPOINT_SUBPATH:
        return AI_HORDE_API_ENDPOINT_SUBPATH.v2_sharedkeys

    @override
    @classmethod
    def get_default_success_response_type(cls) -> type[SharedKeyDeleteResponse]:
        return SharedKeyDeleteResponse

get_api_model_name classmethod

get_api_model_name() -> str | None
Source code in horde_sdk/ai_horde_api/apimodels/sharedkeys.py
@override
@classmethod
def get_api_model_name(cls) -> str | None:
    return None

get_http_method classmethod

get_http_method() -> HTTPMethod
Source code in horde_sdk/ai_horde_api/apimodels/sharedkeys.py
@override
@classmethod
def get_http_method(cls) -> HTTPMethod:
    return HTTPMethod.DELETE

get_api_endpoint_subpath classmethod

get_api_endpoint_subpath() -> AI_HORDE_API_ENDPOINT_SUBPATH
Source code in horde_sdk/ai_horde_api/apimodels/sharedkeys.py
@override
@classmethod
def get_api_endpoint_subpath(cls) -> AI_HORDE_API_ENDPOINT_SUBPATH:
    return AI_HORDE_API_ENDPOINT_SUBPATH.v2_sharedkeys

get_default_success_response_type classmethod

get_default_success_response_type() -> (
    type[SharedKeyDeleteResponse]
)
Source code in horde_sdk/ai_horde_api/apimodels/sharedkeys.py
@override
@classmethod
def get_default_success_response_type(cls) -> type[SharedKeyDeleteResponse]:
    return SharedKeyDeleteResponse

SharedKeyModifyRequest

Bases: BaseAIHordeRequest, SharedKeySettings, MessageSpecifiesSharedKeyMixin, APIKeyAllowedInRequestMixin

Request to modify a SharedKey.

This is a privileged operation that requires the user to be the owner, a moderator, or an admin.

Represents a PATCH request to the /v2/sharedkeys/{sharedkey_id} endpoint.

v2 API Model: SharedKeyInput

Source code in horde_sdk/ai_horde_api/apimodels/sharedkeys.py
class SharedKeyModifyRequest(
    BaseAIHordeRequest,
    SharedKeySettings,
    MessageSpecifiesSharedKeyMixin,
    APIKeyAllowedInRequestMixin,
):
    """Request to modify a SharedKey.

    This is a privileged operation that requires the user to be the owner, a moderator, or an admin.

    Represents a PATCH request to the /v2/sharedkeys/{sharedkey_id} endpoint.

    v2 API Model: `SharedKeyInput`
    """

    @override
    @classmethod
    def get_api_model_name(cls) -> str | None:
        return "SharedKeyInput"

    @override
    @classmethod
    def get_http_method(cls) -> HTTPMethod:
        return HTTPMethod.PATCH

    @override
    @classmethod
    def get_api_endpoint_subpath(cls) -> AI_HORDE_API_ENDPOINT_SUBPATH:
        return AI_HORDE_API_ENDPOINT_SUBPATH.v2_sharedkeys

    @override
    @classmethod
    def get_default_success_response_type(cls) -> type[ExpiryStrSharedKeyDetailsResponse]:
        return ExpiryStrSharedKeyDetailsResponse

get_api_model_name classmethod

get_api_model_name() -> str | None
Source code in horde_sdk/ai_horde_api/apimodels/sharedkeys.py
@override
@classmethod
def get_api_model_name(cls) -> str | None:
    return "SharedKeyInput"

get_http_method classmethod

get_http_method() -> HTTPMethod
Source code in horde_sdk/ai_horde_api/apimodels/sharedkeys.py
@override
@classmethod
def get_http_method(cls) -> HTTPMethod:
    return HTTPMethod.PATCH

get_api_endpoint_subpath classmethod

get_api_endpoint_subpath() -> AI_HORDE_API_ENDPOINT_SUBPATH
Source code in horde_sdk/ai_horde_api/apimodels/sharedkeys.py
@override
@classmethod
def get_api_endpoint_subpath(cls) -> AI_HORDE_API_ENDPOINT_SUBPATH:
    return AI_HORDE_API_ENDPOINT_SUBPATH.v2_sharedkeys

get_default_success_response_type classmethod

get_default_success_response_type() -> (
    type[ExpiryStrSharedKeyDetailsResponse]
)
Source code in horde_sdk/ai_horde_api/apimodels/sharedkeys.py
@override
@classmethod
def get_default_success_response_type(cls) -> type[ExpiryStrSharedKeyDetailsResponse]:
    return ExpiryStrSharedKeyDetailsResponse

SharedKeyCreateRequest

Bases: BaseAIHordeRequest, SharedKeySettings, APIKeyAllowedInRequestMixin

Request to create a new SharedKey.

Represents a PUT request to the /v2/sharedkeys endpoint.

v2 API Model: SharedKeyInput

Source code in horde_sdk/ai_horde_api/apimodels/sharedkeys.py
class SharedKeyCreateRequest(
    BaseAIHordeRequest,
    SharedKeySettings,
    APIKeyAllowedInRequestMixin,
):
    """Request to create a new SharedKey.

    Represents a PUT request to the /v2/sharedkeys endpoint.

    v2 API Model: `SharedKeyInput`
    """

    @override
    @classmethod
    def get_api_model_name(cls) -> str | None:
        return "SharedKeyInput"

    @override
    @classmethod
    def get_http_method(cls) -> HTTPMethod:
        return HTTPMethod.PUT

    @override
    @classmethod
    def get_api_endpoint_subpath(cls) -> AI_HORDE_API_ENDPOINT_SUBPATH:
        return AI_HORDE_API_ENDPOINT_SUBPATH.v2_sharedkeys_create

    @override
    @classmethod
    def get_default_success_response_type(cls) -> type[ExpiryStrSharedKeyDetailsResponse]:
        return ExpiryStrSharedKeyDetailsResponse

get_api_model_name classmethod

get_api_model_name() -> str | None
Source code in horde_sdk/ai_horde_api/apimodels/sharedkeys.py
@override
@classmethod
def get_api_model_name(cls) -> str | None:
    return "SharedKeyInput"

get_http_method classmethod

get_http_method() -> HTTPMethod
Source code in horde_sdk/ai_horde_api/apimodels/sharedkeys.py
@override
@classmethod
def get_http_method(cls) -> HTTPMethod:
    return HTTPMethod.PUT

get_api_endpoint_subpath classmethod

get_api_endpoint_subpath() -> AI_HORDE_API_ENDPOINT_SUBPATH
Source code in horde_sdk/ai_horde_api/apimodels/sharedkeys.py
@override
@classmethod
def get_api_endpoint_subpath(cls) -> AI_HORDE_API_ENDPOINT_SUBPATH:
    return AI_HORDE_API_ENDPOINT_SUBPATH.v2_sharedkeys_create

get_default_success_response_type classmethod

get_default_success_response_type() -> (
    type[ExpiryStrSharedKeyDetailsResponse]
)
Source code in horde_sdk/ai_horde_api/apimodels/sharedkeys.py
@override
@classmethod
def get_default_success_response_type(cls) -> type[ExpiryStrSharedKeyDetailsResponse]:
    return ExpiryStrSharedKeyDetailsResponse