Skip to content
Intura

Get started

Download keys

What a download key is for, where to create one, how to give it to the SDK, and when you don't need one at all.

What a download key does

A download key lets the SDK fetch the models you own without signing in. It is used for three things only, and all of them happen before a prediction:

  • listing what your account owns (client.library.list())
  • listing the models you may download (client.models.list())
  • signing the download links for one model (client.models.load, download and links)

The key only signs the links. The files come straight from Cloud Storage, on links that are valid for 15 minutes, and the key is never sent there. If a link expires partway through a download, it is re-signed once.

Predicting never uses the key. A loaded model holds no connection and no key.

Create a key

  1. Sign in and open your account page.
  2. Under Download keys, name the key after where it runs (for example prod-server) and create it.
  3. Copy it right away. This is the only time it is shown.

You can create several keys, one per server, CI job or device, and revoke any of them on the same page. Anything using a revoked key stops downloading at once.

Give the key to the SDK

Set it in the environment:

bash
export INTURA_API_KEY=sk_...

or pass it to the client:

python
from intura_ai import Intura

client = Intura()                  # reads INTURA_API_KEY
client = Intura(api_key="sk_...")  # or pass it explicitly

The command line reads the same variable, or takes --api-key:

bash
intura-ai library --api-key sk_...

When you don't need a key

Intura() constructs without one. So does loading a model that is already downloaded:

  • client.models.load(slug) loads the newest cached version with no network call and no key.
  • LocalModel.load(path) runs a folder you downloaded earlier, and never talks to the API.

The first call that does need the API raises MissingAPIKey, and its message says where to get a key:

python
from intura_ai import Intura, MissingAPIKey

try:
    model = Intura().models.load("chat-commerce-intent-id")
except MissingAPIKey as exc:
    print(exc)

MissingAPIKey is also a ValueError.

Check that a key works

client.library.list() is the simplest check. It raises AuthenticationError for a wrong or revoked key and returns your library otherwise.

python
from intura_ai import AuthenticationError, Intura

try:
    Intura().library.list()
except AuthenticationError:
    print("That key is wrong or revoked. Create a new one on your account page.")

Keep it secret

Treat a download key like a password. Keep it in an environment variable or a secret store, not in source code. The client never prints it: repr(client) shows only the API root. If a key leaks, revoke it on your account page and create another.