Skip to content
Intura

Use a model

Versions and the cache

Which version load picks, how to pin one or fetch the newest, where the cache lives, and how to download a model into a folder of your own.

Which version load picks

Buying a model gets you every version of it. Versions are numbered v1.0, v1.1, v2.0 and so on. load decides which one to use like this:

CallWhat it loadsNetwork
load(slug)The newest version already in the cache. If none is cached, the recommended version, downloaded first.Only when nothing is cached
load(slug, version="v1.0")Exactly that version, downloaded if it is missingOnly when that version is missing
load(slug, refresh=True)Asks which version is recommended now and downloads it if you don't have itAlways (one small call, plus the download if the version is new)

So once a model is cached, load(slug) works offline and without a key. Nothing updates behind your back. Run with refresh=True (or intura-ai predict --refresh) when you want the latest. Older versions stay in the cache, so you can pin back to one with version=.

Passing both version= and refresh=True raises ValueError: pin a version or fetch the newest, not both. A version you don't own, or one that doesn't exist, raises NotFound.

python
model = client.models.load("chat-commerce-intent-id", version="v1.0")   # pinned
model = client.models.load("chat-commerce-intent-id", refresh=True)     # the latest

client.library.list() lists every version of each model you own. Your library shows how.

Where the cache lives

The cache is laid out <cache>/<slug>/<version>/. Its location is the first of these that is set:

  1. load(..., cache_dir="./models")
  2. $INTURA_CACHE_DIR
  3. $XDG_CACHE_HOME/intura
  4. ~/.cache/intura

To free space, delete a version folder, or the whole cache.

Interrupted downloads

A partly downloaded model is never mistaken for a complete one. Every download goes into a hidden staging folder next to its destination. That folder is renamed to <version>/ only after every file has arrived at the size the bucket reports. If a download is interrupted (dropped connection, Ctrl-C, full disk), no version folder is left behind, and the next load starts again.

Download into a folder of your own

To put a model in a folder you choose, for example in a container image or on a machine with no internet access, use download, then load that folder:

python
from intura_ai import Intura, LocalModel

client = Intura()
path = client.models.download("guardrails-pii-detection-id", "./models", version="v1.0")
# ./models/guardrails-pii-detection-id/v1.0/
model = LocalModel.load(path)

client.models.download(slug, dest=".", *, version=None, overwrite=False) writes every file of the model into <dest>/<slug>/<version>/ and returns that folder. With no version, it downloads the recommended one.

download is atomic in the same way as load. It keeps a complete bundle that is already there, unless you pass overwrite=True.

The same from a shell:

bash
intura-ai download guardrails-pii-detection-id --dir ./models --version v1.0

In a container

Run intura-ai download (or client.models.download) while you build the image, then load the folder when the container runs. The running container needs no key and no network:

python
from intura_ai import LocalModel

model = LocalModel.load("/models/guardrails-pii-detection-id/v1.0")

Use your own downloader

client.models.links(slug, version=None) returns the signed URLs without downloading anything:

python
links = client.models.links("guardrails-pii-detection-id")
links.slug, links.version, links.expires_at
for file in links.files:
    print(file.name, file.size)    # file.url is the signed link

It returns a ModelDownload with slug, version, files (each a ModelFile with name, size and url), expires_at, and size, the total bytes. The links are valid for 15 minutes and can't be revoked, so treat them like a credential. url is left out of the printed form for that reason.