Assets
Assets are files of your product that are not releases: AI models, content packs, voices, sample libraries. You upload them once per product and environment, and decide per asset which licenses may fetch it. The app asks for the list, picks what it needs and fetches each file through a link that works for 5 minutes (protocol, section 6.14).
What an asset has
| Field | Meaning |
|---|---|
name |
1 to 100 of a-z, 0-9, ., _ and -, unique in the product. The name never changes: new content gets a new name, such as voice-de-2. |
group |
Optional, such as voice. The user picks one asset of a group. |
default |
At most one asset per group is the default, the one to take when the user chose none. |
title, description |
Optional, in English and German. The SDK returns the requested language, else English, else German. |
file |
File name, size and SHA-256. A file your app already holds with this SHA-256 need not be fetched again. |
Visibility decides who may fetch an asset:
public: every usable license of the product.entitled: licenses whose plan grants the entitlement you name (a flag that is on, a limit above 0 or a variant).unlisted: not in the list, but any usable license that knows the name can fetch it.
An asset can lie in the store only encrypted, like a release file (protocol, section 6.12): a leaked link or a copy of the store then opens nothing without a license. Upload it with release-tool asset --encrypt; nothing changes in the app, since the SDK decrypts the file while it fetches it.
An asset can also be a WebAssembly module you signed. Turn on the product setting modules first (PATCH /v1/products/{id} with {"settings": {"modules": true}}; off by default), then upload the module with release-tool asset --module-token <file>, where the file holds the token of release-tool sign-module for exactly this module. The server checks the token with your product's release keys and refuses it (invalid_module) if it does not verify or names another file; it never signs a module itself. While the setting is off, the server takes no module and hands none out. A module is never encrypted.
Upload assets from your pipeline with release-tool asset, or through the Management API yourself (POST /v1/products/{id}/assets, then the presigned PUT, then POST /v1/assets/{id}/complete), like release files. Up to 5 GiB per file and 100 GiB per product. The product page of the dashboard lists the assets and changes group, default, visibility and texts, or deletes an asset.
In the app
list_assets(language)returns the ready assets this license may see, ordered by group and name. It needs an activation and a usable license and does not renew the license token.request_asset_download(name)returns a short-lived link, or nothing if the license may not fetch an asset of that name or the product has none.fetchon that download saves the file. It writes to a temporary file next to the destination and gives the file its final name only once size and SHA-256 match; an encrypted asset is decrypted after that check, with a key the server wrapped for this one download.encryptedon the download says whether it is. A module's download carriesmodule_token; pass it with the file to the module runtime, which verifies it again with your keys. It fails withfile_mismatch(kind verify) if the file does not match,server_unreachableif the link fails or has expired (ask for a new one) andstorage_failedif the destination cannot be written.
The SDK only hands the file over. It never opens or runs it; loading a model or a content pack is the job of your app. If the server runs with build_check deny, an unknown build gets an empty list and no links.
Rust
for asset in client.list_assets(Some("en"))? {
if asset.group.as_deref() == Some("voice") && !asset.default {
continue;
}
if let Some(grant) = client.request_asset_download(&asset.name)? {
let dest = assets_dir.join(&grant.file.filename);
sdk_core::download::fetch_asset(&grant, &dest)?; // checks size and SHA-256
}
}
C
lsdk_asset_list *list = NULL;
lsdk_error *err = lsdk_client_list_assets(client, "en", &list);
if (err == NULL) {
for (size_t i = 0; i < lsdk_asset_list_count(list); i++) {
printf("%s (%s)\n", lsdk_asset_list_name(list, i), lsdk_asset_list_file_name(list, i));
}
lsdk_asset_list_free(list);
}
lsdk_asset_download *download = NULL;
err = lsdk_client_request_asset_download(client, "voice-de", &download);
if (err == NULL && download != NULL) {
err = lsdk_asset_download_fetch(download, "/path/to/voice-de.bin");
lsdk_asset_download_free(download);
}
Strings from a list stay valid until lsdk_asset_list_free, those of a download until lsdk_asset_download_free.
C++
for (const auto& asset : client.list_assets("en")) {
std::cout << asset.name << " " << asset.file.name << "\n";
}
if (auto download = client.request_asset_download("voice-de")) {
download->fetch("/path/to/" + download->file().name);
}
C#
foreach (var asset in await client.ListAssetsAsync("en"))
{
Console.WriteLine($"{asset.Name} {asset.Title}");
}
using var download = await client.RequestAssetDownloadAsync("voice-de");
if (download is not null)
{
await download.FetchAsync(Path.Combine(assetsDir, download.File.Name));
}
Python
for asset in client.list_assets("en"):
print(asset.name, asset.title)
download = client.request_asset_download("voice-de")
if download is not None:
with download:
download.fetch(assets_dir / download.file.name)
Java
for (AssetInfo asset : client.listAssets("en")) {
System.out.println(asset.name() + " " + asset.title().orElse(""));
}
Optional<AssetDownload> download = client.requestAssetDownload("voice-de");
if (download.isPresent()) {
try (AssetDownload d = download.get()) {
d.fetch(new File(assetsDir, d.file().name()));
}
}