# models

Python API: `hubai_sdk.services.models`

Create and manage top-level model resources.

A model contains shared metadata such as its display name, supported tasks, license, and visibility. Actual files belong to model
instances beneath a versioned variant; see
[hubai_sdk.services.variants](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/services/variants.md)
and
[hubai_sdk.services.instances](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/services/instances.md).

 * `Identifiers:`: Functions that accept an `identifier` support a UUID, a model slug, or a full HubAI slug copied from the web
   application. This makes slugs suitable for configuration files while UUIDs remain useful for programmatic flows.
 * `Visibility:`: During creation, `is_public=True` makes a model public, `False` makes it private, and `None` selects team
   visibility. For list operations, `None` means no visibility filter. For updates, `None` leaves the existing visibility
   unchanged.

> **Example**
> ```python
models = client.models.list_models(
    tasks=["OBJECT_DETECTION"],
    is_public=True,
    limit=10,
)
model = client.models.get_model(models[0].id)
```

## Functions

### create_model

```python
def create_model(name: str, *, license_type: License = 'undefined', is_public: bool | None = False, description: str | None =
None, description_short: str = '<empty>', architecture_id: UUID | str | None = None, tasks: list[Task] | None = None, links:
list[str] | None = None, is_yolo: bool = False) -> ModelResponse:
```

Create a model resource.

Parameters

 * `name` (`str`): Human-readable model name. HubAI derives the slug from it.
 * `license_type` (`License`): License attached to the model metadata.
 * `is_public` (`bool | None`): `True` for public, `False` for private, or `None` for team visibility.
 * `description` (`str | None`): Full model description.
 * `description_short` (`str`): Short summary shown in model listings.
 * `architecture_id` (`UUID | str | None`): Related architecture UUID, if known.
 * `tasks` (`list[Task] | None`): Tasks supported by the model.
 * `links` (`list[str] | None`): URLs for source code, papers, or other related resources.
 * `is_yolo` (`bool`): Whether the model uses a supported YOLO output contract.

Returns

 * `ModelResponse`: The created model resource.

Raises

 * `ResourceConflictError`: If a model with the derived slug already exists.
 * `HubApiError`: If HubAI rejects the request for another reason.

### create_model_cli

```python
def create_model_cli(name: str, *, license_type: License = 'undefined', is_public: bool | None = False, description: str | None =
None, description_short: str = '<empty>', architecture_id: UUID | str | None = None, tasks: list[Task] | None = None, links:
list[str] | None = None, is_yolo: bool = False):
```

Creates a new model resource.

### delete_model

```python
def delete_model(identifier: UUID | str):
```

Delete a model from HubAI.

Parameters

 * `identifier` (`UUID | str`): Model UUID, slug, or full HubAI slug.

Raises

 * `ResourceNotFoundError`: If `identifier` cannot be resolved.
 * `HubApiError`: If HubAI refuses the deletion.

### delete_model_cli

```python
def delete_model_cli(identifier: UUID | str):
```

Deletes a model.

### get_model

```python
def get_model(identifier: UUID | str) -> ModelResponse:
```

Get one model by UUID or slug.

Parameters

 * `identifier` (`UUID | str`): Model UUID, slug, or full HubAI slug.

Returns

 * `ModelResponse`: The resolved model resource.

### get_model_info_cli

```python
def get_model_info_cli(identifier: UUID | str):
```

Get the model information from the HubAI.

### list_models

```python
def list_models(tasks: list[Task] | None = None, license_type: License | None = None, is_public: bool | None = None, project_id:
str | None = None, luxonis_only: bool = False, limit: int = 50, sort: str = 'updated', order: Order = 'desc') ->
list[ModelResponse]:
```

List models visible to the authenticated HubAI team.

Parameters

 * `tasks` (`list[Task] | None`): Filter models by supported tasks.
 * `license_type` (`License | None`): Keep models with this license.
 * `is_public` (`bool | None`): Filter by public status. Leave as `None` to include every visibility available to the API key.
 * `project_id` (`str | None`): Keep models belonging to this project.
 * `luxonis_only` (`bool`): Whether to return only Luxonis-maintained models.
 * `limit` (`int`): Maximum number of models to return.
 * `sort` (`str`): [ModelResponse](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/sdk_models.md) field used for sorting, such as `"name"`, `"id"`, or `"updated"`.
 * `order` (`Order`): Sort in ascending or descending order.

Returns

 * `list[ModelResponse]`: A list of matching model resources.

### list_models_cli

```python
def list_models_cli(tasks: list[Task] | None = None, license_type: License | None = None, is_public: bool | None = None,
project_id: str | None = None, luxonis_only: bool = False, limit: int = 50, sort: str = 'updated', order: Order = 'desc', field:
Annotated[list[str] | None, Parameter(name=['--field', '-f'])] = None):
```

List the models in the HubAI.

### update_model

```python
def update_model(identifier: UUID | str, *, license_type: License | None = None, is_public: bool | None = None, description: str |
None = None, description_short: str | None = None, architecture_id: UUID | str | None = None, tasks: list[Task] | None = None,
links: list[str] | None = None, is_yolo: bool | None = None) -> ModelResponse:
```

Update fields on an existing model.

Only arguments whose value is not `None` are sent to HubAI. This means optional text fields cannot be cleared with this helper.

Parameters

 * `identifier` (`UUID | str`): Model UUID, slug, or full HubAI slug.
 * `license_type` (`License | None`): Replacement license.
 * `is_public` (`bool | None`): Replacement public/private state.
 * `description` (`str | None`): Replacement full description.
 * `description_short` (`str | None`): Replacement short description.
 * `architecture_id` (`UUID | str | None`): Replacement architecture UUID.
 * `tasks` (`list[Task] | None`): Replacement task list.
 * `links` (`list[str] | None`): Replacement related-resource links.
 * `is_yolo` (`bool | None`): Replacement YOLO flag.

Returns

 * `ModelResponse`: The updated model resource.

### update_model_cli

```python
def update_model_cli(identifier: UUID | str, *, license_type: License | None = None, is_public: bool | None = None, description:
str | None = None, description_short: str | None = None, architecture_id: UUID | str | None = None, tasks: list[Task] | None =
None, links: list[str] | None = None, is_yolo: bool | None = None):
```

Updates a model.

## Attributes

### app

### MODEL_INFO_KEYS

### MODEL_LIST_KEYS
