Skip to main content
Get Started

Installation & Authentication

Install the Bailian CLI and Skills, configure authentication, and verify.

This page covers how to install the Bailian CLI, install the companion Skills, and configure authentication.

Prerequisites

  • Network access (either the npm registry or bailian.aliyun.com, depending on the install method you choose below).
  • For the npm method: Node.js ≥ 18.17.0 (verify with node -v) and npm (verify with npm -v). If you don't have Node.js, or your version is too old, use the binary install script below instead — no Node.js required.

Install the CLI

  • npm (existing Node.js)
  • Binary script (no Node.js required)
npm install -g bailian-cli
Even if pnpm / yarn is installed, use npm to install bailian-cli — do not use pnpm / yarn to install the CLI.
After installation, two commands are added to your PATH: bl (short alias) and bailian (full name). Verify:
bl --version
which bl   # use "where bl" on Windows
Run bl update at any time to check for and install the latest CLI version.
If you see command not found, check that the global bin directory is on your PATH: for the npm install, run npm config get prefix and add its bin subdirectory to PATH; for the binary install, add the path printed by the install script.

Install Skills

Once the CLI is verified, install the companion Skills so your Agent gains the full range of Bailian capabilities. The recommended, one-shot method is the CLI's built-in bootstrap command:
bl skill init
This installs every bailian-* Skill in the registry (plus the shared bailian-protocol) in one go, and is the officially recommended install path. For more granular, on-demand installs (e.g. only one Skill), fall back to:
npx skills add modelstudioai/cli --all -g

Configure authentication

You must authenticate before calling any API. Choose one of the methods below based on your environment.
  • Standard API Key
  • Token Plan
  • AK/SK access token
  • Environment variable

Verify

The login command already tests usability, so you only need to confirm the configuration status:
bl auth status --output json
No repeated model-call test is needed. If login fails, use the hint or message in the output to troubleshoot (network, invalid Key, base_url, etc.).
When reporting auth status, use only masked fields. Never echo a full API Key, and do not write real Keys into repositories, logs, or the public parts of chat records.

Log out

To clear local credentials and sign out, run:
bl auth logout

Troubleshooting

The global bin directory is not on your PATH. Run npm config get prefix and add its bin subdirectory to PATH, then retry.
Node.js version too low. Upgrade to ≥ 18.17.0 and reinstall.
Not logged in or invalid API Key. Re-run the login command for your Key type (standard API Key or Token Plan).
Configure a mirror or proxy, then reinstall.
Use the binary install script instead (no Node.js/npm required): curl -fsSL https://bailian.aliyun.com/cli/install.sh | bash. Alternatively, install or repair npm first, then use npm install -g bailian-cli — but do not use pnpm / yarn to install the CLI.