Updated on 2026-09-18 GMT+08:00

Using KooCLI

Huawei Cloud Koo Command Line Interface (previously "HCloud CLI") is designed to manage Huawei Cloud service APIs released on API Explorer. You can use this tool to call the APIs of ModelArts in API Explorer to manage and use your ModelArts resources. For detailed information about KooCLI, see What is KooCLI?

Installing KooCLI

Before you begin, you will need to install KooCLI. KooCLI is compatible with Windows, Linux, and macOS. Install the version that matches your OS.

Initializing KooCLI

When KooCLI is used to call APIs, you need to obtain the caller's identity information for authentication. If you initialize KooCLI, your permanent AK/SK is stored in the configuration file, so you do not need to enter the credentials each time you call an API.

Skip this step if you intend to pass authentication parameters directly in commands instead of using the configuration file. For details, see Using KooCLI in Non-configuration Mode.

The following uses Windows as an example to describe how to initialize KooCLI. The steps on Linux and macOS are similar. Before the initialization, obtain the AK/SK information. For details, see Access Keys.

  1. Open the CLI.
  2. Run the following command to initialize the configuration:
    hcloud configure init
  3. Enter the parameter values as prompted.
    Access Key ID [required]:      // Mandatory. Enter the AK.
    Secret Access Key [required]:      // Mandatory. Enter the SK. The system will anonymize the input.
    Secret Access Key (again):      // Mandatory. Enter the SK again. The system will anonymize the input.
    Region:      //Optional. Enter a region.

    The message "Initialization successful" is then displayed.

Generating and Executing a CLI Command

KooCLI supports two command generation methods:

  • Use API Explorer to quickly generate and obtain the CLI command for calling an API. This method is recommended as it is more convenient.
  • Use CLI commands to query API operations and related parameters, and then manually combine CLI commands to call APIs. For details, see Step 4: View and Run Cloud Service Operation Commands.

The following uses the ModelArts API for querying the workspace list as an example to describe how to generate a CLI command from API Explorer and then run the CLI command to call the API.

  1. On the ModelArts page of API Explorer, select the API for which you want to generate a CLI command.
  2. In the parameter configuration interface in the middle, enter the parameters required to call the API.
  3. In the right pane, click the CLI Example tab and view the generated CLI command.

    The following is an example of the CLI command for calling the API for querying the workspace list.

    hcloud ModelArts ListWorkspace --cli-region="cn-north-4"
  4. Copy the generated CLI command and paste it into the CLI for execution.

    The following is an example CLI command output for calling the API to query the workspace list.

    {
      "total_count": 1,
      "count": 1,
      "workspaces": [
        {
          "id": "0",
          "name": "default",
          "description": null,
          "owner": "0000****00",
          "create_time": 1773470348000,
          "update_time": 1773470348000,
          "enterprise_project_id": "0",
          "enterprise_project_name": "default",
          "auth_type": "public",
          "status": "NORMAL",
          "status_info": "",
          "metadata": {
            "tags": []
          }
        }
      ]
    }