Use the dataset, image, workspace, api, and completion commands in PAI CLI to manage datasets and images, query workspaces, call OpenAPI operations directly, and set up shell auto-completion.
pai dataset
dataset list
pai dataset list [--workspace-id ID] [--page N] [--page-size N] [--columns COLS]Parameter | Type | Default | Description |
| string | config | Workspace ID |
| int | 1 | Page number |
| int | 20 | Entries per page |
| string | — | Custom output columns |
dataset get
pai dataset get <dataset-id>pai image
image list
pai image list [--workspace-id ID] [--type preset|custom] [--page N] [--page-size N]Parameter | Type | Default | Description |
| string | config | Workspace ID |
| string | — | Image type: |
| int | 1 | Page number |
| int | 20 | Entries per page |
| string | — | Custom output columns |
pai workspace
workspace list
pai workspace list [--page N] [--page-size N] [--columns COLS]Parameter | Type | Default | Description |
| int | 1 | Page number |
| int | 20 | Entries per page |
| string | — | Custom output columns |
workspace get
pai workspace get <workspace-id>pai api — generic OpenAPI invocation
Call any PAI OpenAPI operation directly when the CLI doesn't provide a dedicated subcommand.
pai api <product> <Action> --path PATH --version VERSION [flags]Parameter | Type | Default | Description |
<product> | Positional | — | Product identifier. Required (e.g., dsw, dlc, aiworkspace, paistudio) |
<Action> | Positional | — | API action name (e.g., GetIdleInstanceCuller) |
| string | GET | HTTP method: |
| string | — | ROA request path. Required (e.g., /api/v2/instances) |
| string | — | API version number. Required (e.g., 2022-01-01) |
| string | automatically inferred | API endpoint address. For products where the endpoint can't be inferred, specify it explicitly (e.g., paistudio.{region}.aliyuncs.com) |
| stringArray | — | Query parameters in KEY=VALUE format. Repeat the flag to specify multiple parameters |
| string | — | Request body JSON (PascalCase field names). Supports inline JSON, |
| stringArray | — | Modify request body fields before sending. See --override request body editing for details |
Common endpoints: pai-dsw.{region}.aliyuncs.com, pai-dlc.{region}.aliyuncs.com, paistudio.{region}.aliyuncs.com. The auto-inferred endpoint for DSW is inaccurate. When calling the PAI-DSW API, specify --endpoint pai-dsw.{region}.aliyuncs.com explicitly.
pai completion — shell auto-completion
Generate auto-completion scripts for Bash, Zsh, Fish, or PowerShell to speed up command-line usage.
Bash
# Temporary (current session only)
source <(pai completion bash)
# Permanent
pai completion bash > /etc/bash_completion.d/pai # Linux
pai completion bash > $(brew --prefix)/etc/bash_completion.d/pai # macOSZsh
# Make sure compinit is enabled
echo "autoload -U compinit; compinit" >> ~/.zshrc
# Temporary (current session only)
source <(pai completion zsh)
# Permanent
pai completion zsh > "${fpath[1]}/_pai" # Linux
pai completion zsh > $(brew --prefix)/share/zsh/site-functions/_pai # macOSFish
pai completion fish > ~/.config/fish/completions/pai.fishPowerShell
pai completion powershell | Out-String | Invoke-ExpressionAfter installation, reopen your terminal and type pai [Tab] to see auto-completion suggestions for all available commands.