module documentation
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 and
hubai_sdk.services.instances.
- 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
models = client.models.list_models(
tasks=["OBJECT_DETECTION"],
is_public=True,
limit=10,
)
model = client.models.get_model(models[0].id)| Function | create |
Create a model resource. |
| Function | create |
Creates a new model resource. |
| Function | delete |
Delete a model from HubAI. |
| Function | delete |
Deletes a model. |
| Function | get |
Get one model by UUID or slug. |
| Function | get |
Get the model information from the HubAI. |
| Function | list |
List models visible to the authenticated HubAI team. |
| Function | list |
List the models in the HubAI. |
| Function | update |
Update fields on an existing model. |
| Function | update |
Updates a model. |
| Constant | MODEL |
Undocumented |
| Constant | MODEL |
Undocumented |
| Variable | app |
Undocumented |
| Function | _model |
Undocumented |
| Function | _print |
Undocumented |
| Function | _print |
Undocumented |
@telemetry_operation( OperationTelemetrySpec( operation_name=OperationName.MODEL_CREATE, operation_group=TelemetryGroup.MODELS, success_event=MODEL_CREATED_EVENT, target_resource=TargetResource.MODEL, success_builder=build_model_created_properties))
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. |
licenseLicense | License attached to the model metadata. |
isbool | None | True for public, False for private, or None for team visibility. |
description:str | None | Full model description. |
descriptionstr | Short summary shown in model listings. |
architectureUUID | str | None | Related architecture UUID, if known. |
tasks:list[ | Tasks supported by the model. |
links:list[ | URLs for source code, papers, or other related resources. |
isbool | 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. |
@app.command( name='create')
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.
@telemetry_operation( OperationTelemetrySpec( operation_name=OperationName.MODEL_DELETE, operation_group=TelemetryGroup.MODELS, success_event=MODEL_DELETED_EVENT, target_resource=TargetResource.MODEL, identifier_param='identifier', success_builder=build_model_identifier_properties))
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. |
@telemetry_operation( OperationTelemetrySpec( operation_name=OperationName.MODEL_GET, operation_group=TelemetryGroup.MODELS, success_event=MODEL_RETRIEVED_EVENT, target_resource=TargetResource.MODEL, identifier_param='identifier', success_builder=build_model_identifier_properties))
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. |
@telemetry_operation( OperationTelemetrySpec( operation_name=OperationName.MODELS_LIST, operation_group=TelemetryGroup.MODELS, success_event=MODELS_LISTED_EVENT, target_resource=TargetResource.MODEL, success_builder=build_models_listed_properties))
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[ | Filter models by supported tasks. |
licenseLicense | None | Keep models with this license. |
isbool | None | Filter by public status. Leave as None to include every visibility available to the API key. |
projectstr | None | Keep models belonging to this project. |
luxonisbool | Whether to return only Luxonis-maintained models. |
limit:int | Maximum number of models to return. |
sort:str | ModelResponse field used for sorting, such as "name",
"id", or "updated". |
order:Order | Sort in ascending or descending order. |
| Returns | |
list[ | A list of matching model resources. |
@app.command( name='ls')
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.
@telemetry_operation( OperationTelemetrySpec( operation_name=OperationName.MODEL_UPDATE, operation_group=TelemetryGroup.MODELS, success_event=MODEL_UPDATED_EVENT, target_resource=TargetResource.MODEL, identifier_param='identifier', success_builder=build_model_updated_properties))
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. |
licenseLicense | None | Replacement license. |
isbool | None | Replacement public/private state. |
description:str | None | Replacement full description. |
descriptionstr | None | Replacement short description. |
architectureUUID | str | None | Replacement architecture UUID. |
tasks:list[ | Replacement task list. |
links:list[ | Replacement related-resource links. |
isbool | None | Replacement YOLO flag. |
| Returns | |
ModelResponse | The updated model resource. |
@app.command( name='update')
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.