Skip to main content
Each tab below does the same thing: it creates a GPU sandbox, runs a command in it, reads the result, and terminates the sandbox. Use the Telnyx CLI from a terminal, or the REST API directly with curl.
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_KEY to your Telnyx API key. Don’t put it in shared logs.

Run a Sandbox

Install the Telnyx CLI, telnyx-edge, as described in Installation, then store your API key in it:
The examples use 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

The command after -- 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

The logs hold the main process’s output, sandbox started, but not the exec’s. Add -f to keep following new output.
6

Terminate the sandbox

The main process gets 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.
Terminated sandboxes stay readable for at least 30 days.

Next Steps