Manage AutoDL GPU instances from your terminal.
AutoDL CLI is an open-source, unofficial client for AutoDL's Common and Container
Instance Pro APIs, with experimental console-API support for ordinary containers. It brings account billing, instance lifecycle operations,
private images, and storage switching into a single autodl command, with readable
terminal output and JSON responses for scripts.
Project scope: Supports the documented Common and Container Instance Pro endpoints listed below, plus experimental ordinary container management. Application instances, elastic deployments, SSH execution, and a TUI are outside the current scope. This project is independent of AutoDL and is not affiliated with or endorsed by the platform.
- Inspect your account. Read balances, vouchers, and lifetime spending.
- Manage Pro instances. List, inspect, create, start, stop, and release GPU instances.
- Manage ordinary containers (experimental). Use a separate web login token to list, inspect, start, stop, and release existing non-Pro containers.
- Reuse environments. Save private images, check their preparation status, and switch storage types.
- Automate workflows. Use JSON output, shell completion, explicit exit codes, and request previews without credentials or network access.
Download an archive from GitHub Releases,
verify it against checksums.txt, extract it, and put autodl (autodl.exe on
Windows) on your PATH. Archives contain a statically built binary, the README,
and the license.
| Operating system | Architectures |
|---|---|
| Linux | amd64, arm64 |
| macOS | amd64, arm64 |
| Windows | amd64, arm64 |
With Go 1.26 or later, you can also install from source:
go install github.com/saurlax/autodl-cli/cmd/autodl@latestEnsure your Go binary directory is on PATH, then run autodl --version.
Get a developer token from the AutoDL console under Account → Settings → Developer Token. Container Instance Pro APIs require personal or enterprise identity verification.
autodl config set-token
# Paste the developer token at the hidden prompt and press Enter.
autodl account balance
autodl instance list
autodl image listThe token is stored in the system keyring: Windows Credential Manager, macOS
Keychain, or Linux Secret Service. Headless environments can use AUTODL_TOKEN:
export AUTODL_TOKEN='your-developer-token'
autodl instance list --jsonIn PowerShell, use $env:AUTODL_TOKEN = 'your-developer-token'. Token precedence is
--token → AUTODL_TOKEN → system keyring. An explicit --config PATH selects a
plaintext credential file instead of the keyring; keyring errors never silently
fall back to plaintext. See the authentication guide for
storage requirements, file permissions, and migration from v0.1.0.
Run autodl, a command group such as autodl instance, or any command with
--help to see its options. Help and input validation require no credentials.
Replace INSTANCE_ID below with an ID from instance list.
autodl instance list --page 1 --page-size 20
autodl instance status INSTANCE_ID
autodl instance get INSTANCE_IDinstance get includes SSH passwords and Jupyter tokens. Treat its output,
including JSON snapshots, as sensitive.
Preview a creation request before sending it:
autodl instance create \
--gpu-spec pro6000-p \
--image base-image-l2t43iu6uk \
--cuda-min 118 \
--gpus 1 \
--region westDC3,beijingDC2 \
--name training \
--dry-runGPU, image, and region values are examples; select current IDs from the
official API appendix.
Creation requires --gpu-spec, --image, and --cuda-min. CUDA uses integer
encoding: 113 means 11.3 and 118 means 11.8. GPU count defaults to 1 (range
1–4); --disk-gb defaults to 0 (range 0–500). Omit regions to let AutoDL choose.
IDs are passed through so new offerings do not require a CLI update.
Removing --dry-run creates and boots a pay-as-you-go instance. Other API
commands also send requests immediately unless --dry-run is supplied:
autodl instance start INSTANCE_ID --start-command 'nvidia-smi'
autodl instance stop INSTANCE_ID
autodl image save INSTANCE_ID --name training-env
autodl image list
autodl storage mount --data-center westDC2 --type exclusive
autodl storage mount --data-center westDC2 --type ordinaryOnly pay-as-you-go creation and GPU-mode startup are supported. A startup command
failure does not automatically stop billing. To permanently delete an instance
and its data, stop it first, then run autodl instance release INSTANCE_ID --yes.
| Command | Purpose |
|---|---|
account balance |
Balance, vouchers, and lifetime spending |
instance list |
Paginated Pro instance list |
instance create |
Create and boot a GPU instance |
instance get INSTANCE_ID |
Snapshot and connection credentials |
instance status INSTANCE_ID |
Current lifecycle status |
instance start INSTANCE_ID |
GPU-mode power on |
instance stop INSTANCE_ID |
Power off |
instance release INSTANCE_ID --yes |
Permanent release |
image save INSTANCE_ID --name NAME |
Save a private image |
image list |
Paginated private images and save status |
storage mount --data-center CODE --type TYPE |
Switch exclusive NFS / ordinary storage |
config set-token |
Save token in system keyring (hidden terminal input) |
container list/get/status/start/stop/release |
Experimental management of ordinary containers |
config set-web-token |
Save a separate web login token for ordinary containers |
completion bash|zsh|fish|powershell |
Generate shell completion |
Missing arguments, required flags, invalid values, and unknown flags print the relevant command's complete help.
Use container for existing ordinary (non-Pro) containers; instance continues to use the official Pro API. Ordinary containers use the undocumented website endpoints at https://www.autodl.com/api/v1/instance, with a web login token, rather than a developer token. These endpoints were inspected in the console's public JavaScript on 2026-10-20. A live authenticated list request succeeded on that date, returning zero instances; snapshot, status, startup, shutdown, and release remain unverified against a live instance. Website updates can break this integration.
While logged into the AutoDL console, obtain your own web token from the browser's developer tools: Application → Local Storage → https://www.autodl.com → token, or the Authorization header of an instance-list request in Network. Treat it as a password. Save it at the hidden prompt:
autodl config set-web-token
autodl container list
autodl container get YOUR_INSTANCE_ID
autodl container status YOUR_INSTANCE_ID
autodl container start YOUR_INSTANCE_ID --dry-run
autodl container start YOUR_INSTANCE_ID
autodl container start YOUR_INSTANCE_ID --mode non_gpu
autodl container stop YOUR_INSTANCE_ID
autodl container release YOUR_INSTANCE_ID --yesWeb credential precedence is --web-token → AUTODL_WEB_TOKEN → system keyring (autodl-cli / web-token). Developer credentials are never used automatically for these requests. An explicit --config PATH instead selects a plaintext token file; use a dedicated path for web credentials when saving and reading. The default origin for container is https://www.autodl.com; an explicit --base-url overrides it. GET snapshots use URL query parameters, while Pro GET requests retain their documented JSON bodies.
Implementation evidence from the current official console: endpoint wrappers, list and GPU startup requests, and no-GPU startup request. These versioned assets may disappear after a console release.
container get and raw container list --json can include connection secrets. container status, including --json, exposes only the status in data. GPU startup is the default; --mode non_gpu requests the console's no-GPU mode, subject to account and billing restrictions. Creation and image management remain Pro-only. Authentication failures do not open a browser, retry, or change saved credentials; if your web login expires, replace its saved token.
autodl instance list --json
autodl instance status INSTANCE_ID --json
autodl instance status INSTANCE_ID --timeout 2m
autodl completion bash > autodl-completion.bashGlobal flags are --token, --config, --base-url, --timeout (default 30s),
--json, --dry-run, --help, and --version.
--json writes the complete successful API envelope (code, data, msg, and
optional request_id) as one JSON object to stdout. Errors go to stderr. Default
output uses tables for lists, exact thousandths of CNY for balances, scalar values
for status and created IDs, and indented JSON for snapshots. Successful operations
without data print OK.
| Exit code | Meaning |
|---|---|
0 |
Success or help |
1 |
Configuration, network, API, or output error |
2 |
Command usage error |
--dry-run works on API commands and prints {method,url,body} without loading
credentials or sending a request. It excludes the Authorization header; body
values such as startup commands are printed as supplied.
Requests are never retried automatically. After an ambiguous network failure, check the console before repeating a creation or destructive operation. The HTTP client respects proxy environment variables, applies a per-request timeout, propagates interrupt cancellation, limits response size, and refuses redirects. Custom base URLs must be HTTPS origins; loopback HTTP is accepted for local testing.
git clone https://github.com/saurlax/autodl-cli.git
cd autodl-cli
go build -o autodl ./cmd/autodl
go vet ./...
go test -race ./...
go mod verifyTests use local HTTP servers, fake credential stores, and temporary files; no real token, desktop keyring session, or GPU is needed. CI runs on Linux, macOS, and Windows and packages all six release targets. See the development and release guide for packaging, validation coverage, and read-only acceptance checks.
Bug reports, documentation improvements, and focused API additions are welcome. Search GitHub Issues before opening a report or proposal. Include your CLI version, operating system, command, and sanitized error output; remove developer tokens and instance connection credentials. Discuss new API coverage before implementing it, and keep changes aligned with the official contract. Run the development checks above before submitting a pull request.
The API contract follows AutoDL's Common API and Container Instance Pro API, reviewed on 2026-10-04. Snapshot and status endpoints deliberately send a JSON body with GET, following that contract. Common API's standalone “save image” heading has no callable endpoint; private-image saving uses the documented Pro endpoint.
Command design was informed by Minato-Aqukin/AutoDL-cli and Raymond1800/autodl-cli. This is an independent Go implementation, built with Cobra.
AutoDL CLI is licensed under the MIT License.