All Products
Search
Document Center

Platform For AI:PAI CLI overview

Last Updated:Sep 01, 2026

Manage PAI resources from the command line. PAI CLI supports DSW instance management, DLC distributed training, resource quota management, and other operations. Use the command reference, global parameters, override flags, and exit codes to automate workflows.

Commands

Command

Description

Documentation

pai dsw

Manage interactive modeling (DSW) instances

DSW

pai dlc

Manage distributed training jobs

DLC

pai resource

Manage resource quotas

Resource management

pai dataset

Manage datasets

Other commands > pai dataset

pai image

Manage images

Other commands > pai image

pai workspace

Manage workspaces

Other commands > pai workspace

pai api

Invoke OpenAPI

Other commands > pai api

pai completion

Generate shell completion scripts

Other commands > pai completion

pai config

Manage configuration

Configuration management

Global parameters

The following parameters apply to all commands and can be placed anywhere in the command line.

Parameter

Type

Default

Description

--region

string

Profile setting

Override the region, such as cn-hangzhou, cn-shanghai, or cn-wulanchabu

--profile

string

default

Specify a configuration profile for switching between accounts

-o, --output

string

table

Output format: table json yaml quiet. The quiet format prints one identifier (ID or name) per line for list commands, which is useful for piping. An unrecognized format causes an error exit (exit code 2)

--debug

bool

false

Print HTTP request and response debug information

Note

For scripting, use -o json and parse the output with jq. Example: pai dsw instance list -o json | jq '.[].instance_id'. To get only IDs, use -o quiet instead: pai dsw instance list -o quiet prints one instance ID per line.

--override request body editing

For write commands that accept a configuration file or request body, use the --override family of flags to modify fields before submission, without copying the configuration file for each run. This is equivalent to manually editing the file before submission. Argument precedence rules are unchanged.

Parameter

Description

--override PATH=VALUE

Modify a value in the request body. Can be specified multiple times. The type is determined by the original value being replaced. An entire list or object can be replaced with a same-shaped JSON value (also a way to add new elements). Quoted paths with subscripts are supported: --override 'Datasets[0].MountPath=/mnt/x'

--override-string PATH=VALUE

Same as --override, but always writes a string value

--override-unset PATH

Remove a value from the request body. Can be specified multiple times

Supported commands: dlc job submit, dsw instance create / update / apply / render, resource quota write commands, and pai api.

# Same configuration, change the instance type and apply (applied changes are logged to stderr)
pai dsw instance apply -f team-env.yaml --override EcsSpec=ecs.gn7i-c16g1.4xlarge

# Modify nested fields + remove fields
pai dlc job submit --body-json @job.json \
  --override DisplayName=bert-lr001 --override-unset Priority
Note

Each effective modification prints a line to stderr: [info] applied to the body: PATH old -> new. This audit information doesn't pollute stdout.

Exit codes

Exit code

Meaning

Typical scenario

0

Success

The command completed successfully (including --dry-run previews)

1

Resource not found

The specified instance, job, service, or quota doesn't exist

2

Argument error

A required parameter is missing, a parameter format is invalid, the subcommand is unknown, or the --output value is unrecognized

3

Authentication or permission error

Invalid credentials, insufficient RAM permissions, or unauthorized service (checked before 404)

4

Server or runtime error

The API returned a 5xx error, the network connection failed, the target service is unreachable, or the operation timed out

5

Confirmation required

A high-risk write operation was run without --yes: the command prints a confirmation_required plan JSON and exits. Add --yes and run again

Note

Exit codes are a stable contract for scripts and agents. Error details are output to stderr as a {"error","message","hint"} JSON envelope with -o json. Stdout stays clean.