search
Search and popularity endpoints for the v2 API.
SearchResponse
Bases: BaseModel
Paginated search response.
Source code in src/horde_model_reference/service/v2/routers/search.py
results
instance-attribute
Serialized model records matching the query.
_validate_category
Source code in src/horde_model_reference/service/v2/routers/search.py
_serialize_record
_apply_generic_filters
_apply_generic_filters(
manager: ModelReferenceManager,
category: MODEL_REFERENCE_CATEGORY,
*,
nsfw: bool | None,
baseline: str | None,
inpainting: bool | None,
tags_any: list[str] | None,
tags_all: list[str] | None,
tags_none: list[str] | None,
name_contains: str | None,
sort_by: str | None,
sort_desc: bool,
limit: int,
offset: int,
backend: str | None,
exclude_backend_variations: bool,
quantized: bool | None,
) -> SearchResponse
Build a query from parameters, execute, and return a SearchResponse.
Source code in src/horde_model_reference/service/v2/routers/search.py
search_category
search_category(
model_category_name: str,
manager: Annotated[
ModelReferenceManager,
Depends(get_model_reference_manager),
],
nsfw: Annotated[
bool | None,
Query(description="Filter by NSFW status"),
] = None,
baseline: Annotated[
str | None, Query(description="Filter by baseline")
] = None,
inpainting: Annotated[
bool | None,
Query(
description="Filter by inpainting (image only)"
),
] = None,
tags_any: Annotated[
list[str] | None,
Query(description="Models with any of these tags"),
] = None,
tags_all: Annotated[
list[str] | None,
Query(description="Models with all of these tags"),
] = None,
tags_none: Annotated[
list[str] | None,
Query(description="Models with none of these tags"),
] = None,
name_contains: Annotated[
str | None,
Query(
description="Case-insensitive name substring match"
),
] = None,
sort_by: Annotated[
str | None,
Query(description="Field name to sort by"),
] = None,
sort_desc: Annotated[
bool, Query(description="Sort descending")
] = False,
limit: Annotated[
int,
Query(
ge=1,
le=MAX_SEARCH_LIMIT,
description="Max results to return",
),
] = DEFAULT_SEARCH_LIMIT,
offset: Annotated[
int,
Query(
ge=0, description="Number of results to skip"
),
] = 0,
backend: Annotated[
str | None,
Query(description="Text model backend filter"),
] = None,
exclude_backend_variations: Annotated[
bool,
Query(
description="Exclude text model backend variations"
),
] = False,
quantized: Annotated[
bool | None,
Query(
description="Filter by quantization (text only)"
),
] = None,
) -> SearchResponse
Search models within a specific category with filtering, sorting, and pagination.
Source code in src/horde_model_reference/service/v2/routers/search.py
search_all
search_all(
manager: Annotated[
ModelReferenceManager,
Depends(get_model_reference_manager),
],
nsfw: Annotated[
bool | None,
Query(description="Filter by NSFW status"),
] = None,
name_contains: Annotated[
str | None,
Query(
description="Case-insensitive name substring match"
),
] = None,
tags_any: Annotated[
list[str] | None,
Query(description="Models with any of these tags"),
] = None,
tags_all: Annotated[
list[str] | None,
Query(description="Models with all of these tags"),
] = None,
tags_none: Annotated[
list[str] | None,
Query(description="Models with none of these tags"),
] = None,
sort_by: Annotated[
str | None,
Query(description="Field name to sort by"),
] = None,
sort_desc: Annotated[
bool, Query(description="Sort descending")
] = False,
limit: Annotated[
int,
Query(
ge=1,
le=MAX_SEARCH_LIMIT,
description="Max results to return",
),
] = DEFAULT_SEARCH_LIMIT,
offset: Annotated[
int,
Query(
ge=0, description="Number of results to skip"
),
] = 0,
) -> SearchResponse
Search models across all categories with generic filters only.
Source code in src/horde_model_reference/service/v2/routers/search.py
popular_models
async
popular_models(
model_category_name: str,
manager: Annotated[
ModelReferenceManager,
Depends(get_model_reference_manager),
],
limit: Annotated[
int, Query(ge=1, le=100, description="Max results")
] = 10,
sort_by: Annotated[
Literal[
"worker_count",
"usage_day",
"usage_month",
"usage_total",
],
Query(description="Metric to rank by"),
] = "worker_count",
include_workers: Annotated[
bool,
Query(description="Include per-worker details"),
] = False,
) -> list[dict[str, Any]]
Return models ranked by live Horde popularity metrics.
Only image_generation and text_generation have Horde API data.
Other categories return an empty list.