阿里云百炼 CLI 鉴权配置、Profile 管理、模型市场、文件上传等通用工具命令速查。
在终端管理 CLI 鉴权配置、切换 Profile、浏览模型市场、上传文件以及使用其他通用工具。
重要任意命令追加 --help 可查看完整参数说明,例如 bl config show --help。所有接受文件 URL 的参数也接受本地路径——CLI 会自动上传到临时存储(有效期 48 小时),无需手动托管为 URL。本文命令明细以 bl 2.2.1 为基准核实。
鉴权管理
bl auth login
使用 API Key、控制台浏览器登录或 OpenAPI AK/SK 进行认证(多种凭证可共存)。无需鉴权。
语法
bl auth login --api-key <key> | --console | --open-api --access-key-id <id> --access-key-secret <secret>
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
--api-key <key> | string | 否 | 要校验并保存的模型 API Key |
--base-url <url> | string | 否 | 与 --api-key 一并校验并保存的模型 API Base URL |
--console | switch | 否 | 通过浏览器登录(默认中国站;国际站使用 --console-site international)。需要时会创建普通 API Key;订阅计划必须使用 --api-key 登录 |
--console-site <site> | string | 否 | 控制台站点:domestic、international |
--open-api | switch | 否 | 保存阿里云 OpenAPI AK/SK 凭证 |
--access-key-id <id> | string | 否 | 要保存的阿里云 Access Key ID |
--access-key-secret <secret> | string | 否 | 要保存的阿里云 Access Key Secret |
示例:通过浏览器登录并创建 API Key
bl auth login --console
bl auth status
显示当前认证状态。无需鉴权。
语法
bl auth status
该命令仅支持全局参数。
示例:以 JSON 输出当前认证状态
bl auth status --output json
bl auth logout
清除已保存的凭证;完整退出还会清除模型 Base URL。无需鉴权。
语法
bl auth logout [--console | --open-api] [--dry-run]
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
--console | switch | 否 | 仅清除控制台 access_token,保留 api_key |
--open-api | switch | 否 | 仅清除 OpenAPI AK/SK/STS 凭证,保留其他凭证 |
示例:仅清除控制台凭证
bl auth logout --console
bl auth generate-access-token
使用 OpenAPI AK/SK 生成 CLI Access Token。无需鉴权。
语法
bl auth generate-access-token --access-key-id <id> --access-key-secret <secret> --security-token <token>
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
--access-key-id <id> | string | 是 | 阿里云 Access Key ID |
--access-key-secret <secret> | string | 是 | 阿里云 Access Key Secret |
--security-token <token> | string | 否 | 要保存的阿里云 STS Security Token(可选) |
示例:使用 AK/SK 生成 CLI 访问令牌
bl auth generate-access-token --access-key-id LTAIxxxxx --access-key-secret xxxxx --security-token <token>
配置管理
bl config set
设置配置项。无需鉴权。
语法
bl config set --key <key> --value <value>
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
--key <key> | string | 是 | 配置项名称(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 | 是 | 要设置的值 |
示例:设置语言为中文
bl config set --key language --value zh-CN
bl config show
显示当前配置。无需鉴权。
语法
bl config show
该命令仅支持全局参数。
示例:以 JSON 输出当前配置
bl config show --output json
bl config list
列出配置 Profile 并显示当前激活项。无需鉴权。
语法
bl config list
该命令仅支持全局参数。
示例:以 JSON 输出配置概览
bl config list --output json
bl config use
设置当前激活的配置 Profile。无需鉴权。
语法
bl config use --name <name>
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
--name <name> | string | 是 | 已有 Profile 名称,或 default |
示例:切换到指定配置文件
bl config use --name token-plan
bl config ui
打开用于管理配置 Profile 的本地 Web UI。无需鉴权。
语法
bl config ui [--port <port>] [--no-open]
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
--port <port> | number | 否 | 监听端口(默认:随机可用端口) |
--no-open | switch | 否 | 不自动打开浏览器 |
示例:启动本地配置管理界面
bl config ui --port 8787
bl config agent
配置编程 Agent 使用 DashScope API。无需鉴权。
语法
bl config agent --agent <name> (--base-url <url> | --region <region>) (--api-key <key> | --key <encoded>) --model <model>
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
--agent <name> | string | 是 | 目标 Agent:claude-code, qwen-code, opencode, openclaw, hermes, codex |
--base-url <url> | string | 否 | API Base URL |
--region <region> | string | 否 | 模型服务地域(例如 cn-beijing、ap-southeast-1);将转换为 --base-url。仅用于 Token Plan |
--api-key <key> | string | 否 | API Key |
--key <encoded> | string | 否 | 来自 Web 控制台的混淆 API Key(以 "o1_" 开头);将解码为 --api-key |
--model <model> | string | 是 | 默认模型名称 |
--context-window <tokens> | number | 否 | 仅 OpenClaw:模型上下文窗口 Token 数(默认:256000) |
--wire-api <api> | string | 否 | 仅 Codex:通信协议(默认:responses)。"chat" 仅适用于旧版 Codex <= 0.80.0 |
示例:配置 Agent 使用 DashScope API
bl config agent --agent claude-code --base-url https://dashscope.aliyuncs.com/apps/anthropic --api-key sk-xxxxx --model qwen3-max
通用工具
bl file upload
将本地文件上传到 DashScope 临时存储(保留 48 小时)。需要 API Key 鉴权。
语法
bl file upload --file <path> --model <model>
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
--file <path> | string | 是 | 要上传的本地文件(图片、视频或音频) |
--model <model> | string | 是 | 目标模型名称(文件将与该模型绑定) |
示例:上传图片文件并绑定模型
bl file upload --file photo.jpg --model qwen3-vl-plus
bl model list
浏览百炼模型市场中的模型系列,或查看模型详细信息。无需鉴权。
语法
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]
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
--model <model> | string | 否 | 显示指定模型系列的完整详情(切换到详情模式) |
--page <n> | number | 否 | 页码(默认:1) |
--page-size <n> | number | 否 | 每页结果数(默认:10) |
--provider <p> | array | 否 | 按提供商筛选(可重复,例如 --provider alibaba --provider deepseek) |
--capability <c> | array | 否 | 按能力代码筛选(TG、Reasoning、VU、IG、VG、TTS、ASR 等) |
--feature <f> | array | 否 | 按特性筛选(function-calling、web-search、structured-outputs 等) |
--context-window <w> | array | 否 | 按上下文窗口范围筛选 |
--input-modality <m> | array | 否 | 限定输入模态(可重复:Text、Image、Video、Audio) |
--output-modality <m> | array | 否 | 限定输出模态(可重复:Text、Image、Video、Audio) |
--include-deprecated | switch | 否 | 包含已下线的模型(默认隐藏) |
--enrich | switch | 否 | 同时获取主干模型的输入参数 Schema(predictConfig,仅详情模式) |
示例:筛选阿里云提供的模型
bl model list --provider alibaba
- 模型目录和 --enrich 使用的参数 Schema Endpoint 均为公开接口,无需登录控制台。
- 浏览模式会隐藏已下线的模型,可用 --include-deprecated 包含它们;详情模式(--model)始终列出全部版本并标注状态。
bl advisor recommend
为你的使用场景推荐最佳模型(意图分析 → 候选召回 → LLM 排序)。需要 API Key 鉴权。
语法
bl advisor recommend --message <text> [flags]
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
--message <text> | string | 是 | 描述你的需求 |
示例:根据需求预览模型推荐结果
bl advisor recommend --message "我需要一个能够理解图片的聊天机器人"
bl pipeline run
运行 Pipeline 工作流定义。无需鉴权。
语法
bl pipeline run --file <path> [flags]
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
--file <path> | string | 是 | Pipeline 定义文件(YAML/JSON) |
--input <json> | string | 否 | 内联 JSON 格式的运行时输入 |
--input-file <path> | string | 否 | 来自 JSON 文件的运行时输入 |
--concurrency <n> | number | 否 | 最大并行步骤数(默认:1) |
--events <format> | string | 否 | 输出生命周期事件:jsonl |
--step-timeout <seconds> | number | 否 | 默认步骤超时时间,单位为秒 |
示例:运行指定工作流定义并传入输入参数
bl pipeline run --file workflow.yaml --input '{"brief":"你好"}'
bl pipeline validate
验证 Pipeline 定义但不执行。无需鉴权。
语法
bl pipeline validate --file <path>
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
--file <path> | string | 是 | Pipeline 定义文件(YAML/JSON) |
示例:预览工作流定义验证结果
bl pipeline validate --file workflow.yaml
bl plugin install
安装或升级白名单内的 Command Pack。无需鉴权。
语法
bl plugin install --package <name[@version]>
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
--package <name[@version]> | string | 是 | 白名单内的 Command Pack 包名,以及可选的版本或 Tag |
示例:安装指定 Command Pack 包
bl plugin install --package @ali/bailian-plugin-agent
bl plugin list
列出已安装的 Command Pack 及其加载状态。无需鉴权。
语法
bl plugin list
该命令仅支持全局参数。
示例:输出已安装插件的 JSON 列表
bl plugin list --output json
bl plugin remove
移除已安装的 Command Pack。无需鉴权。
语法
bl plugin remove --name <package>
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
--name <package> | string | 是 | 白名单内的 Command Pack 包名 |
示例:移除指定 Command Pack 插件
bl plugin remove --name @ali/bailian-plugin-agent
bl plugin link
链接白名单内的本地 Command Pack 用于开发。无需鉴权。
语法
bl plugin link --path <directory>
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
--path <directory> | string | 是 | 本地 Command Pack 包目录 |
示例:链接本地 Command Pack 用于开发
bl plugin link --path ../bailian-plugin-agent
bl workspace init
初始化百炼 Workspace 并开通后付费服务。无需鉴权。
语法
bl workspace init --access-key-id <id> --access-key-secret <secret> [--security-token <token>]
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
--access-key-id <id> | string | 否 | 阿里云 Access Key ID |
--access-key-secret <secret> | string | 否 | 阿里云 Access Key Secret |
--security-token <token> | string | 否 | 阿里云 STS Security Token(可选) |
示例:使用密钥初始化百炼 Workspace
bl workspace init --access-key-id LTAIxxxxx --access-key-secret xxxxx
bl workspace list
列出全部 Workspace。
语法
bl workspace list [flags]
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
--list <n> | string | 否 | 限制结果数量 |
示例:预览前 5 个 Workspace 列表
bl workspace list --list 5
bl console call
通过 CLI Gateway 调用百炼控制台 API。
语法
bl console call --api <api> --data <json> [flags]
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
--api <api> | string | 是 | API 名称(例如 zeldaEasy.broadscope-bailian.memory-library.getLibraries) |
--data <json> | string | 是 | JSON 字符串格式的请求数据 |
示例:调用百炼控制台 API 并传入请求数据
bl console call --api zeldaEasy.bailian-commerce.freeTrial.queryFreeTierQuota --data '{"queryFreeTierQuotaRequest":{"models":["qwen3-max"]}}'
bl update
将 CLI 更新到最新版本或指定版本。无需鉴权。
语法
bl update [--to <version>]
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
--to <version> | string | 否 | 安装指定版本,而不是最新版本 |
示例:确认执行 CLI 版本更新到 0.1.14
bl update --to 0.1.14
运行 bl --help 可查看全部命令分组。