Authentication and Licensing
Accessing models from the Vision AI Hub requires authentication and licensing, managed via Personal Access Tokens (PATs).
Personal Access Tokens (PAT)
A PAT is required to create a LicenseSource
, which verifies your permission to use specific models. PATs are always bound to a Service User and group.
Generating a PAT:
- Go to the Integration Page on the Vision AI Hub.
- Create a service user (or use an existing one).
- Generate a new PAT for this user, granting it access to the necessary licenses.
- Copy the generated PAT securely. Treat it like a password.
License Sources (HubLicenseSource
vs OneTimeLicenseSource
)
You need to create a LicenseSource
object using your PAT. Choose the type based on your environment's internet connectivity:
1. HubLicenseSource
:
- The standard licensing method.
- Requires continuous internet access for license checks during pipeline initialization and potentially during runtime.
- Create using:
- Python
from denkflow import HubLicenseSource
license_source = HubLicenseSource.from_pat("YOUR-PAT-TOKEN", license_id="YOUR-LICENSE-ID")
or create pipeline directly from denkflow file:
- Python
from denkflow import Pipeline
pipeline = Pipeline.from_denkflow(model_file, pat=pat)
2. OneTimeLicenseSource
:
- Designed for environments with limited or no internet access after initial setup.
- Requires activation by DENKweit for your license before first use. Please contact DENKweit support to enable this feature.
- Needs internet connection only for the very first pipeline run to activate the license offline.
- Subsequent runs using the same licensed models can be fully offline.
- Internet is required again only if you add new models or change the licensed models in your pipeline. (Retraining existing licensed models on the Hub does not require reactivation).
- The offline license state is stored in the
DENKFLOW_DATA_DIRECTORY
. Ensure this directory is persistent. - Create using:
- Python
from denkflow import HubLicenseSource
# First, create a HubLicenseSource, providing the license_id
hub_source = HubLicenseSource.from_pat("YOUR-PAT-TOKEN", license_id="YOUR-LICENSE-ID")
# Then, convert it to a OneTimeLicenseSource
license_source = hub_source.to_one_time_license_source()
# Refreshing the license (e.g., after adding new models to your license on the Hub)
# This requires an internet connection.
# license_source.refresh()
or create pipeline directly from denkflow file:
- Python
from denkflow import Pipeline
pipeline = Pipeline.from_denkflow(model_file, pat=pat, one_time_registration=True)
- Refreshing Licenses: If you add new models to your existing license on the Vision AI Hub, you need to call the specific refresh method (
license_source.refresh()
) on yourOneTimeLicenseSource
object while connected to the internet. This updates the offline license state stored inDENKFLOW_DATA_DIRECTORY
to include the permissions for the new models. Retraining existing licensed models does not require a refresh.
Loading Pipelines: Use Pipeline.from_denkflow(file_name, *, license_source=..., pat=...)
to load .denkflow
files. You must provide either a license_source
object (created as shown above) or a pat
string (which internally creates a HubLicenseSource
).