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.
Even if pnpm / yarn is installed, use npm to install
After installation, two commands are added to your PATH:
Run
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:
This installs every
To install a single Skill, replace
You must authenticate before calling any API. Choose one of the methods below based on your environment.
Standard API Keys and Token Plan subscription keys differ as follows:
The login command already tests usability, so you only need to confirm the configuration status:
No repeated model-call test is needed. If login fails, use the
To clear local credentials and sign out, run:
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 withnpm -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)
bailian-cli — do not use pnpm / yarn to install the CLI.bl (short alias) and bailian (full name). Verify:
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:
bailian-* Skill in the registry (plus the shared bailian-protocol) in one go, and is the officially recommended install path. If bl skill init is unavailable, use the skills tool instead (it requires Git on the machine; the latest skills package requires Node.js >= 22.20, so pin skills@1.5.18 on Node.js 18):
--skill '*' with its name; --list shows all Skills in the repository.
Configure authentication
You must authenticate before calling any API. Choose one of the methods below based on your environment.
- Console login (recommended)
- Standard API Key
- Token Plan
- AK/SK access token
- Environment variable
Best for interactive local installs — no need to copy an API Key manually. This command opens a browser to complete Alibaba Cloud console login and authorization:This also unlocks console capabilities such as
app list and usage free, and automatically configures the credentials needed for API Key calls.| Aspect | Standard API Key | Token Plan API Key |
|---|---|---|
| Billing | Pay-as-you-go (includes new-user free quota) | Deducts from your Token Plan subscription quota |
| Scope | Model service calls | Calls to models supported by Token Plan |
| Typical use | No subscription, or pay-as-you-go | Token Plan subscribers consuming plan quota first |
| Setup | bl auth login --api-key <Key> | bl auth login --config token-plan --api-key <sk-sp-Key> |
Verify
The login command already tests usability, so you only need to confirm the configuration status:
hint or message in the output to troubleshoot (network, invalid Key, base_url, etc.).
Log out
To clear local credentials and sign out, run:
Troubleshooting
bl: command not found
bl: command not found
The global bin directory is not on your PATH. Run
npm config get prefix and add its bin subdirectory to PATH, then retry.engines error during install
engines error during install
Node.js version too low. Upgrade to >= 18.17.0 and reinstall.
401 / authentication failure
401 / authentication failure
Not logged in or invalid API Key. Re-run the login command for your Key type (standard API Key or Token Plan).
Why doesn't a CLI model call deduct from my Token Plan?
Why doesn't a CLI model call deduct from my Token Plan?
The active credential is a standard API Key (the
default profile). Token Plan requires your subscription API Key signed in to the token-plan profile; run bl auth status --output json to see which credential is active.How do I make CLI model calls use my Token Plan?
How do I make CLI model calls use my Token Plan?
Sign in with your subscription API Key:
bl auth login --config token-plan --api-key <sk-sp-Key>. If the profile already exists, switch to it with bl config use --name token-plan.Can I use every CLI feature with only a Token Plan API Key?
Can I use every CLI feature with only a Token Plan API Key?
No. Model-call commands work; console features (such as
app list, usage free, workspace) require console login (bl auth login --console), and Token Plan seat management additionally needs Alibaba Cloud OpenAPI AK/SK credentials. See Configure authentication for the comparison.How do I check and switch the active API Key?
How do I check and switch the active API Key?
Run
bl auth status --output json to inspect the active credential (masked), bl config list to list all profiles, and bl config use --name <profile> to switch the active profile.Corporate network can't reach npm
Corporate network can't reach npm
Configure a mirror or proxy, then reinstall.
Only pnpm available, no npm
Only pnpm available, no npm
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.