The sandbox rents a whole GPU node and is billed per second from the moment it is
running until it is terminated. Each example sets the sandbox’s timeout to 30 minutes so a stopped script cannot leave it running indefinitely.Before You Start
- Your account must be enabled for the GPU Sandboxes preview. See Check access.
- Set
TELNYX_API_KEYto your Telnyx API key. Don’t put it in shared logs.
Run a Sandbox
- CLI
- curl
Install the Telnyx CLI, The examples use The command after The logs hold the main process’s output, The main process gets
telnyx-edge, as described in Installation, then store your API key in it:jq. Run them in order in the same shell.1
Choose a GPU type
gpu-types lists each GPU type with its GPU count per node, and the CPU, memory, and disk that come with each GPU. --gpu takes a type and its count as TYPE:COUNT, for example B300:8. Currently each type has one count, the number of GPUs on its node, so the second line takes both from the list instead of hard-coding them.2
Create a sandbox
-- replaces the image’s own: it prints a line, then sleeps so the sandbox stays up for commands. create prints the sandbox’s ID, and --wait returns once the sandbox is running. The commands below take the ID or the name.If the sandbox ends before running, telnyx-edge sandbox-gpu get "$SANDBOX" shows its termination_reason: for example queue_timeout when no node became free in time, or image_pull_failed.3
Run a command
nvidia-smi lists the GPUs you rented. The driver and nvidia-smi are provided in every GPU sandbox, so the plain Ubuntu image needs nothing added; see GPUs. exec streams the command’s output to your terminal and exits with its exit code. Put the command after -- so its own flags aren’t read as the CLI’s.4
Read the file
- writes the file to stdout. Without it, the file is saved under its own name in the current directory.5
Read the logs
sandbox started, but not the exec’s. Add -f to keep following new output.6
Terminate the sandbox
SIGTERM, then SIGKILL if it is still running after a grace period. --yes skips the confirmation prompt, and --wait returns once the sandbox is terminated.Next Steps
- Lifecycle: states, timeouts, readiness probes, and termination reasons.
- Execs and WebSocket attach: interactive commands and resumable output.
- Images and environment: how the command, working directory, and environment are resolved.