# 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 raw model slug, or a `<team>/<model>` resource path.
   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

| Name | Description |
| --- | --- |
| [`create_model`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/services/models.md) | Create a model resource. |
| [`create_model_cli`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/services/models.md) | Creates a new model resource. |
| [`delete_model`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/services/models.md) | Delete a model from HubAI. |
| [`delete_model_cli`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/services/models.md) | Deletes a model. |
| [`get_model`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/services/models.md) | Get one model by identifier. |
| [`get_model_info_cli`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/services/models.md) | Get the model information from the HubAI. |
| [`list_models`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/services/models.md) | List models visible to the authenticated HubAI team. |
| [`list_models_cli`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/services/models.md) | List the models in the HubAI. |
| [`update_model`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/services/models.md) | Update fields on an existing model. |
| [`update_model_cli`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/services/models.md) | Updates a model. |

### function `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.

Args

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

Returns

| Type | Description |
| --- | --- |
| `ModelResponse` | The created model resource. |

Raises

| Type | Description |
| --- | --- |
| `ResourceConflictError` | If a model with the derived slug already exists. |
| `HubApiError` | If HubAI rejects the request for another reason. |

### function `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.

### function `delete_model`

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

Delete a model from HubAI.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `identifier` | `UUID | str` | Model UUID, raw slug, or `<team>/<model>` path. | required |

Raises

| Type | Description |
| --- | --- |
| `ResourceNotFoundError` | If `identifier` cannot be resolved. |
| `HubApiError` | If HubAI refuses the deletion. |

### function `delete_model_cli`

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

Deletes a model.

### function `get_model`

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

Get one model by identifier.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `identifier` | `UUID | str` | Model UUID, raw slug, or `<team>/<model>` path. | required |

Returns

| Type | Description |
| --- | --- |
| `ModelResponse` | The resolved model resource. |

### function `get_model_info_cli`

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

Get the model information from the HubAI.

### function `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.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `tasks` | `list[Task] | None` | Filter models by supported tasks. | `None` |
| `license_type` | `License | None` | Keep models with this license. | `None` |
| `is_public` | `bool | None` | Filter by public status. Leave as `None` to include every visibility available to the API key. | `None` |
| `project_id` | `str | None` | Keep models belonging to this project. | `None` |
| `luxonis_only` | `bool` | Whether to return only Luxonis-maintained models. | `False` |
| `limit` | `int` | Maximum number of models to return. | `50` |
| `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"`. | `'updated'` |
| `order` | `Order` | Sort in ascending or descending order. | `'desc'` |

Returns

| Type | Description |
| --- | --- |
| `list[ModelResponse]` | A list of matching model resources. |

### function `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.

### function `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.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `identifier` | `UUID | str` | Model UUID, raw slug, or `<team>/<model>` path. | required |
| `license_type` | `License | None` | Replacement license. | `None` |
| `is_public` | `bool | None` | Replacement public/private state. | `None` |
| `description` | `str | None` | Replacement full description. | `None` |
| `description_short` | `str | None` | Replacement short description. | `None` |
| `architecture_id` | `UUID | str | None` | Replacement architecture UUID. | `None` |
| `tasks` | `list[Task] | None` | Replacement task list. | `None` |
| `links` | `list[str] | None` | Replacement related-resource links. | `None` |
| `is_yolo` | `bool | None` | Replacement YOLO flag. | `None` |

Returns

| Type | Description |
| --- | --- |
| `ModelResponse` | The updated model resource. |

### function `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.

## Module Attributes

| Name | Type | Description |
| --- | --- | --- |
| [`app`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/services/models.md) |  |  |
| [`MODEL_INFO_KEYS`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/services/models.md) | `list[str]` |  |
| [`MODEL_LIST_KEYS`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/services/models.md) | `list[str]` |  |

### variable `app`

```python
app = App(name='model', help='Models Interactions', group='Resource Management')
```

### constant `MODEL_INFO_KEYS`

```python
MODEL_INFO_KEYS: list[str] = ...
```

### constant `MODEL_LIST_KEYS`

```python
MODEL_LIST_KEYS: list[str] = ['name', 'id', 'slug']
```
