- A device credential that grants
assets.upload; the CDN refuses uploads from a credential without it. Issue one withlua devices credential --device-name <name> --operations commands,assets.upload. - The Node or Python client. The MicroPython client has no CDN support.
1
Upload from a command handler
cdn.upload sends the bytes as a multipart upload and resolves with the file’s ID and URL. One file per call, at most 100 MB.- Node
- Python
device.ts
url is https://cdn.heylua.ai/<fileId>, and mediaType and extension report what the CDN detected. cdn.upload is a plain HTTPS request carrying the credential, independent of the device connection, so it works while the socket is down or before connect(). url never expires and is fetched without a credential, so anyone holding it can open the file; the client has no delete call, and files are removed only when the owning account is erased.2
Hand the URL to the agent
Returning the URL from a command puts it in the tool result, so the model can share it in the conversation. For a device-initiated event, put the URL in a trigger payload and store or forward it in the handler.
device.ts
src/devices/ShelfPhotoTaken.ts
3
Verify
Call the command by hand and open the returned URL.The reply contains
url; fetching it returns the file with the detected media type.Options you may need
Download or rebuild a URL
cdn.download(fileId) fetches the bytes back (Buffer in Node, bytes in Python) and cdn.getUrl(fileId) (get_url in Python) rebuilds the URL from an ID you stored.
Files from the agent side
Code running on the platform uploads through theCDN runtime object instead of a device credential.
If it isn’t working
upload rejects with the platform's message
upload rejects with the platform's message
The credential doesn’t grant
assets.upload (the CDN answers Device credentials require a designated device endpoint), or it was revoked. Issue a new credential with the operation; operations can’t be added later.upload rejects for a large file
upload rejects for a large file
The cap is 100 MB per file. Compress or split the file.
Next steps
Node device client
The
CDN class and CdnUploadResult.Handle device triggers
Handlers for device-initiated events.
Laptop controller
Screenshots uploaded from a laptop.

