Bailian CLI command reference for auth configuration, profile management, model marketplace, file upload, and general tools.
Manage CLI authentication, switch profiles, browse the model marketplace, upload files, and use general tools from the terminal.
ImportantAppend --help to any command for full parameter details, e.g. bl config show --help. Every parameter that accepts a file URL also accepts a local path — the CLI auto-uploads it to temporary storage (valid for 48 hours), so you never need to host files as URLs yourself. Command details on this page are verified against bl 2.8.0. Global flags can precede the full command path, for example bl --config token-plan auth status; command-specific and credential flags must still follow the command path.
Authentication
bl auth login
Authenticate with API key, console browser login, or OpenAPI AK/SK (credentials can coexist). No authentication required.
Usage
bl auth login --api-key <key> | --console [--no-browser | --token-stdin --console-region <region>] | --open-api --access-key-id <id> --access-key-secret <secret>
| Parameter | Type | Required | Description |
|---|---|---|---|
--api-key <key> | string | no | Model API key to validate and store |
--base-url <url> | string | no | Model API base URL to validate and store with --api-key |
--console | switch | no | Sign in via browser (China by default; use --console-site international for the international site). Creates an ordinary API key if needed; subscription plans require --api-key |
--no-browser | switch | no | With --console, print the login URL without opening a browser |
--token-stdin | switch | no | With --console, read and validate one console access token from stdin; requires --console-region, and does not open a browser or local server |
--console-region <region> | string | no | Console gateway region, e.g. cn-beijing or ap-southeast-1 |
--console-site <site> | string | no | Console site: domestic, international |
--open-api | switch | no | Store Alibaba Cloud OpenAPI AK/SK credentials |
--access-key-id <id> | string | no | Alibaba Cloud Access Key ID to store |
--access-key-secret <secret> | string | no | Alibaba Cloud Access Key Secret to store |
Example: Authenticate via browser login for console
bl auth login --console --console-site international
-
When a browser cannot be opened, use
bl auth login --console --console-site international --no-browserto print the login URL, or import an access token from stdin with--token-stdin. -
OpenAPI AK/SK is resolved as a complete group in this order: command parameters,
BAILIAN_ACCESS_KEY_ID/BAILIAN_ACCESS_KEY_SECRET, Bailian configuration, thenALIBABA_CLOUD_ACCESS_KEY_ID/ALIBABA_CLOUD_ACCESS_KEY_SECRET. Fields are not combined across sources. STS tokens come from the same source:BAILIAN_SECURITY_TOKEN, thesecurity_tokenconfig key, orALIBABA_CLOUD_SECURITY_TOKEN. -
Console business commands do not accept temporary AK/SK flags. When a console token is missing or expired, the CLI obtains one automatically with available AK/SK, exchanging at most once per request.
bl auth status
Show current authentication state. No authentication required.
Usage
bl auth status
This command only supports global flags.
Example: Show authentication status with JSON output
bl auth status --output json
bl auth logout
Clear stored credentials; full logout also clears the model Base URL. No authentication required.
Usage
bl auth logout [--console | --open-api] [--dry-run]
| Parameter | Type | Required | Description |
|---|---|---|---|
--console | switch | no | Only clear the console access_token, keep api_key intact |
--open-api | switch | no | Only clear OpenAPI AK/SK/STS credentials, keep other credentials intact |
Example: Clear console access_token only
bl auth logout --console
bl auth generate-access-token
Generate a CLI access token using OpenAPI AK/SK. No authentication required.
Usage
bl auth generate-access-token --access-key-id <id> --access-key-secret <secret> --security-token <token>
| Parameter | Type | Required | Description |
|---|---|---|---|
--access-key-id <id> | string | yes | Alibaba Cloud Access Key ID |
--access-key-secret <secret> | string | yes | Alibaba Cloud Access Key Secret |
--security-token <token> | string | no | Alibaba Cloud STS Security Token to store (optional) |
Example: Generate CLI access token with AK/SK and optional STS token
bl auth generate-access-token --access-key-id LTAIxxxxx --access-key-secret xxxxx --security-token <token>
Configuration
bl config set
Set a config value. No authentication required.
Usage
bl config set --key <key> --value <value>
| Parameter | Type | Required | Description |
|---|---|---|---|
--key <key> | string | yes | Config key (language, base_url, output, output_dir, timeout, watermark, api_key, api_key_capabilities, access_token, access_key_id, access_key_secret, security_token, default_*_model, workspace_id) |
--value <value> | string | yes | Value to set |
Example: Set configuration key language to zh-CN
bl config set --key language --value zh-CN
bl config show
Display current configuration. No authentication required.
Usage
bl config show
This command only supports global flags.
Example: Show current configuration in JSON output
bl config show --output json
- Shows the effective sources of the API Key and Base URL and warns when requests use values from different configuration sources.
bl config list
List config profiles and show the active profile. No authentication required.
Usage
bl config list
This command only supports global flags.
Example: List config profiles with active profile in JSON output
bl config list --output json
bl config use
Set the active config profile. No authentication required.
Usage
bl config use --name <name>
| Parameter | Type | Required | Description |
|---|---|---|---|
--name <name> | string | yes | Existing profile name, or default |
Example: Set active config profile to token-plan
bl config use --name token-plan
bl config ui
Open a local web UI to manage config profiles. No authentication required.
Usage
bl config ui [--port <port>] [--no-open]
| Parameter | Type | Required | Description |
|---|---|---|---|
--port <port> | number | no | Port to listen on (default: random free port) |
--no-open | switch | no | Do not open the browser automatically |
Example: Open config management web UI on port 8787
bl config ui --port 8787
bl config agent
Configure a coding agent to use DashScope API. No authentication required.
Usage
bl config agent --agent <name> (--base-url <url> | --region <region>) (--api-key <key> | --key <encoded>) --model <model>
| Parameter | Type | Required | Description |
|---|---|---|---|
--agent <name> | string | yes | Target agent: claude-code, qwen-code, opencode, openclaw, hermes, codex, pi |
--base-url <url> | string | no | API base URL |
--region <region> | string | no | Model Studio region (e.g. cn-beijing, ap-southeast-1); converted into --base-url. Token Plan only |
--api-key <key> | string | no | API key |
--key <encoded> | string | no | Obfuscated API key from the web console (starts with "o1_"); decoded into --api-key |
--model <model> | string | yes | Default model name |
--context-window <tokens> | number | no | OpenClaw only: model context window in tokens (default: 256000) |
--wire-api <api> | string | no | Codex only: wire protocol (default: responses). "chat" only works with legacy Codex <= 0.80.0 |
Example: Configure coding agent to use DashScope API with specified settings
bl config agent --agent claude-code --base-url https://dashscope-intl.aliyuncs.com/apps/anthropic --api-key sk-xxxxx --model qwen3-max
Output and diagnostics
The default output format is text. Switch to JSON with --output json, DASHSCOPE_OUTPUT=json, or the output config key.
- JSON mode returns the complete business result on stdout. Warnings, diagnostics, and errors are written separately to stderr as JSONL so scripts and Agents can parse them independently.
- Quiet mode hides only progress and informational messages while preserving complete results, warnings, and errors. Set
DASHSCOPE_QUIET=1to enable quiet. Scripts that extracted IDs, paths, or answers from quiet output must read JSON fields instead. --introspectprints the machine-readable command schema (JSON) and exits, so Agents can discover commands and parameters.- Interactive login, the local config UI, and Pipeline event streams use text output. To request JSON for streaming speech output, specify a file with
--out.
General tools
bl file upload
Upload a local file to DashScope temporary storage (48h). Requires API Key authentication.
Usage
bl file upload --file <path> --model <model>
| Parameter | Type | Required | Description |
|---|---|---|---|
--file <path> | string | yes | Local file to upload (image, video, audio) |
--model <model> | string | yes | Target model name (file is bound to this model) |
Example: Upload photo.jpg to DashScope storage bound to qwen3-vl-plus model
bl file upload --file photo.jpg --model qwen3-vl-plus
- The upload service is selected from the active model endpoint. Official temporary uploads support only the Beijing and Singapore regions; unsupported regions and Token Plan fail explicitly.
- An explicitly specified custom upload proxy is no longer rejected based on the key type.
- Uploads to temporary OSS follow
--timeout.
bl model list
Browse model families or show detailed model info in the Bailian model marketplace. No authentication required.
Usage
bl model list [--model <model>] [--page <n>] [--page-size <n>] [--provider <p>] [--capability <c>] [--feature <f>] [--input-modality <m>] [--output-modality <m>] [--include-deprecated] [--enrich]
| Parameter | Type | Required | Description |
|---|---|---|---|
--model <model> | string | no | Show full details of a specific model family (switches to detail mode) |
--page <n> | number | no | Page number (default: 1) |
--page-size <n> | number | no | Results per page (default: 10) |
--provider <p> | array | no | Filter by provider (repeatable, e.g. --provider alibaba --provider deepseek) |
--capability <c> | array | no | Filter by capability code (TG, Reasoning, VU, IG, VG, TTS, ASR, …) |
--feature <f> | array | no | Filter by feature (function-calling, web-search, structured-outputs, …) |
--context-window <w> | array | no | Filter by context window range bucket |
--input-modality <m> | array | no | Require an input modality (repeatable: Text, Image, Video, Audio) |
--output-modality <m> | array | no | Require an output modality (repeatable: Text, Image, Video, Audio) |
--include-deprecated | switch | no | Include models that are already offline (hidden by default) |
--enrich | switch | no | Also fetch input parameter schema (predictConfig) for trunk models (detail mode only) |
Example: List models provided by alibaba
bl model list --provider alibaba
- Both the catalog and --enrich parameter-schema endpoints are public — no console login needed.
- Browse mode hides models that are already offline; use --include-deprecated to include them. Detail mode (--model) always lists every version and flags its status instead.
bl model search
Search the model catalog by keyword, ranked by relevance. No authentication required.
Usage
bl model search --keyword <kw> [--limit <n>] [--provider <p>...] [--capability <c>...] [--feature <f>...] [--context-window <w>...] [--input-modality <m>...] [--output-modality <m>...] [--include-deprecated]
| Parameter | Type | Required | Description |
|---|---|---|---|
--keyword <kw> | string | yes | Keyword matched against model ID, name, capabilities, features, and description |
--limit <n> | number | no | Maximum results to return (default: 20) |
--provider <p> | array | no | Filter by provider (repeatable, e.g. --provider alibaba --provider deepseek) |
--capability <c> | array | no | Filter by capability code (TG, Reasoning, VU, IG, VG, TTS, ASR, and more) |
--feature <f> | array | no | Filter by feature (function-calling, web-search, structured-outputs, and more) |
--context-window <w> | array | no | Filter by context-window range bucket |
--input-modality <m> | array | no | Require an input modality (Text, Image, Video, Audio) |
--output-modality <m> | array | no | Require an output modality (Text, Image, Video, Audio) |
--include-deprecated | switch | no | Include models that are already offline |
Example: Search for models with qwen in the name
bl model search --keyword qwen
- Search scans the whole catalog but hides offline models by default; pass --include-deprecated to include them.
- The model catalog endpoint is public; no console login is needed.
bl model code
Print a ready-to-run SDK sample for calling a model. No authentication required.
Usage
bl model code --model <model> [--sdk <sdk>] [--api <style>] [--lang <lang>]
| Parameter | Type | Required | Description |
|---|---|---|---|
--model <model> | string | yes | Model to generate a sample for |
--sdk <sdk> | string | no | SDK flavour: openai (default) or dashscope |
--api <style> | string | no | API style: completions (default) or responses |
--lang <lang> | string | no | Language of the snippet (default: python); pass an unsupported value to list available options |
Example: Generate a Python sample for qwen-max
bl model code --model qwen-max
Example: Generate a curl sample for qwen-max
bl model code --model qwen-max --lang curl
- Text output is the snippet alone, so it can be redirected straight into a file; use --output json for the snippet plus metadata.
- The sample base URL contains a
[workspace-id]placeholder. Replace it, or set BAILIAN_WORKSPACE_ID and use the DashScope endpoint. - Available combinations are published per model; pass an unknown value to see the list for that model.
--apiacceptscompletionsorresponses; it is ignored when the SDK supports only one style.
bl advisor recommend
Recommend the best models for your use case (intent analysis → candidate recall → LLM ranking). Requires API Key authentication.
Usage
bl advisor recommend --message <text> [flags]
| Parameter | Type | Required | Description |
|---|---|---|---|
--message <text> | string | yes | Describe your requirements |
--top <n> | number | no | Number of recommendations (default: 3) |
--model <model> | string | no | LLM used for every stage: agent, intent, scoring, and explanation (default: qwen-flash-2025-07-28) |
--no-agent | switch | no | Skip the agent loop and run the deterministic engine directly |
--trace | switch | no | Emit full routing and performance trace to stderr |
--think | switch | no | Show the engine decision process to stderr |
--no-thinking | switch | no | Deprecated no-op: thinking is always disabled for advisor LLM calls |
Example: Recommend best models for visual-understanding chatbot requirement
bl advisor recommend --message "I need a visual-understanding chatbot"
Example: Skip Agent clarification and run the recommendation engine directly
bl advisor recommend --message "Build a digital-human livestream" --no-agent
- Recommendations run intent analysis, routing, candidate recall, scoring, and ranking. Interactive terminals support Agent clarification and multi-step recommendations while preserving the existing recommendation JSON envelope.
--traceand--thinkwrite only to stderr and do not change the recommendation result on stdout.
bl pipeline run
Run a pipeline workflow definition. No authentication required.
Usage
bl pipeline run --file <path> [flags]
| Parameter | Type | Required | Description |
|---|---|---|---|
--file <path> | string | yes | Pipeline definition file (YAML/JSON) |
--input <json> | string | no | Runtime input as inline JSON |
--input-file <path> | string | no | Runtime input from a JSON file |
--concurrency <n> | number | no | Max parallel steps (default: 1) |
--events <format> | string | no | Emit lifecycle events: jsonl |
--step-timeout <seconds> | number | no | Default step timeout in seconds |
Example: Run pipeline workflow from workflow.yaml with input {'brief':'hello'}
bl pipeline run --file workflow.yaml --input '{"brief":"hello"}'
--events jsonluses text output mode. Pipeline event streams cannot be mixed with other output formats.
bl pipeline validate
Validate a pipeline definition without executing. No authentication required.
Usage
bl pipeline validate --file <path>
| Parameter | Type | Required | Description |
|---|---|---|---|
--file <path> | string | yes | Pipeline definition file (YAML/JSON) |
Example: Validate pipeline definition from file
bl pipeline validate --file workflow.yaml
bl plugin install
Install or upgrade an allowlisted Command Pack. No authentication required.
Usage
bl plugin install --package <name[@version]>
| Parameter | Type | Required | Description |
|---|---|---|---|
--package <name[@version]> | string | yes | Allowlisted Command Pack package and optional version or tag |
Example: Install allowlisted Command Pack package
bl plugin install --package @ali/bailian-plugin-agent
bl plugin list
List installed Command Packs and their load status. No authentication required.
Usage
bl plugin list
This command only supports global flags.
Example: List installed Command Packs with JSON output
bl plugin list --output json
bl plugin remove
Remove an installed Command Pack. No authentication required.
Usage
bl plugin remove --name <package>
| Parameter | Type | Required | Description |
|---|---|---|---|
--name <package> | string | yes | Allowlisted Command Pack package name |
Example: Remove installed Command Pack by name
bl plugin remove --name @ali/bailian-plugin-agent
bl plugin link
Link an allowlisted local Command Pack for development. No authentication required.
Usage
bl plugin link --path <directory>
| Parameter | Type | Required | Description |
|---|---|---|---|
--path <directory> | string | yes | Local Command Pack package directory |
Example: Link local Command Pack for development
bl plugin link --path ../bailian-plugin-agent
bl workspace init
Initialize Bailian workspace and activate postpaid services. No authentication required.
Usage
bl workspace init --access-key-id <id> --access-key-secret <secret> [--security-token <token>]
| Parameter | Type | Required | Description |
|---|---|---|---|
--access-key-id <id> | string | no | Alibaba Cloud Access Key ID |
--access-key-secret <secret> | string | no | Alibaba Cloud Access Key Secret |
--security-token <token> | string | no | Alibaba Cloud STS Security Token (optional) |
Example: Initialize workspace with access keys
bl workspace init --access-key-id LTAIxxxxx --access-key-secret xxxxx
bl workspace list
List all workspaces.
Usage
bl workspace list [flags]
| Parameter | Type | Required | Description |
|---|---|---|---|
--list <n> | string | no | Limit number of results |
Example: List workspaces with limit
bl workspace list --list 5
bl console call
Call a Bailian console API via the CLI gateway.
Usage
bl console call --api <api> --data <json> [flags]
| Parameter | Type | Required | Description |
|---|---|---|---|
--api <api> | string | yes | API name (e.g. zeldaEasy.broadscope-bailian.memory-library.getLibraries) |
--data <json> | string | yes | Request data as JSON string |
Example: Call Bailian console API with data
bl console call --api zeldaEasy.bailian-commerce.freeTrial.queryFreeTierQuota --data '{"queryFreeTierQuotaRequest":{"models":["qwen3-max"]}}'
bl update
Update the CLI to the latest or a specified version. No authentication required.
Usage
bl update [--to <version>]
| Parameter | Type | Required | Description |
|---|---|---|---|
--to <version> | string | no | Install this exact version instead of the latest |
Example: Update CLI to specific version
bl update --to 0.1.14
bl updateexits with a non-zero status when an upgrade fails or the latest version cannot be determined, so scripts and agents can detect the failure.
Run bl --help to view all command groups.