Drives are in pre-release in the Baseten CLI (
baseten drive and baseten sandbox drive) and in the Python, TypeScript, and Go SDKs (baseten, @basetenlabs/client, @basetenlabs/sandbox, and baseten-go). Commands, methods, and responses can change. The Management API drive operations are experimental.Set up
The drive examples use the same SDKs and CLI as sandboxes. The management client creates, gets, lists, updates, and deletes drives. Mounting goes through a sandbox. Every example reads your API key from theBASETEN_API_KEY environment
variable, so keep the key out of your code.
To set your API key:
Replace <BASETEN_API_KEY> with a
Baseten API key, then run the
following command in the shell where you run the examples:
- TypeScript
- Python
- Go
- API
- CLI
-
Run the following command to install the SDK:
-
Create the management client, which reads the key from the
environment:
Create a drive
You can’t change the name or region later. A name is unique in your team. Use 1 to 49 characters: lowercase letters, digits, and hyphens, and don’t start or end the name with a hyphen. Omitname and Baseten generates one. Creation
returns before the drive is ready. The drive is ready when its status is
DEPLOYED.
To create a drive named shared-notes:
- TypeScript
- Python
- Go
- API
- CLI
Run the following code, which waits until the drive is ready:
Create a drive in a specific region
A drive defaults to your default sandbox region. Only sandboxes in the drive’s region can mount it, so create it in the region that your sandboxes run in. To create a drive in a specific region:- TypeScript
- Python
- Go
- API
- CLI
Run the following code. It prints the regions available to your account,
then creates the drive in
us-was-1. Replace us-was-1 with a name from
the list.Next steps
Mount a drive
Mount the drive in a running sandbox.
Get a drive
Check a drive’s status, region, and labels.