# hubai_client

Python API: `hubai_sdk.hubai_client`

Authenticated entry point for the HubAI Python API.

## Classes

| Name | Description |
| --- | --- |
| [`HubAIClient`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/hubai_client.md) |
Authenticate with HubAI and expose its high-level service modules. |

### class `HubAIClient`

```python
class HubAIClient
```

Authenticate with HubAI and expose its high-level service modules.

A client does not hold a separate HTTP session. Its service attributes are modules whose functions use the API key stored in the
SDK environment. Consequently, creating another client replaces the process-wide key used by subsequent service calls.

> **Example**
> The constructor finds `HUBAI_API_KEY` automatically.

```python
from hubai_sdk import HubAIClient

client = HubAIClient()
models = client.models.list_models(is_public=True)
```

> **Note**
> Installed `hubai.plugins` entry points can add more attributes. A plugin cannot replace one of the built-in service attributes.

Attributes

| Name | Description |
| --- | --- |
| `convert` | Hosted model conversion functions. |
| `instances` | Functions for model artifacts and their files. |
| `models` | Functions for model resources. |
| `variants` | Functions for versioned model variants. |

Methods

| Name | Description |
| --- | --- |
| [`__init__`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/hubai_client.md) | Initialize
a HubAI SDK client. |

#### method `__init__`

```python
def __init__(api_key: str | None = None)
```

Initialize a HubAI SDK client.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `api_key` | `str | None` | HubAI API key. If omitted, the client falls back to the `HUBAI_API_KEY` environment variable and then
to the key loaded from secure credential storage. | `None` |

Raises

| Type | Description |
| --- | --- |
| `ValueError` | If no API key is available or the provided key is invalid. |
