Skip to main content

配置与工具

阿里云百炼 CLI 鉴权配置、Profile 管理、模型市场、文件上传等通用工具命令速查。

在终端管理 CLI 鉴权配置、切换 Profile、浏览模型市场、上传文件以及使用其他通用工具。
任意命令追加 --help 可查看完整参数说明,例如 bl config show --help。所有接受文件 URL 的参数也接受本地路径——CLI 会自动上传到临时存储(有效期 48 小时),无需手动托管为 URL。全局参数可放在完整命令路径之前,例如 bl --config token-plan auth status;命令专属参数和凭证参数仍需放在命令路径之后。本文命令明细以 bl 2.5.1 为基准核实。

鉴权管理

bl auth login

使用 API Key、控制台浏览器登录或 OpenAPI AK/SK 进行认证(多种凭证可共存)。无需鉴权。 语法
bl auth login --api-key <key> | --console [--no-browser | --token-stdin --console-region <region>] | --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
--consoleswitch否通过浏览器登录(默认中国站;国际站使用 --console-site international)。需要时会创建普通 API Key;订阅计划必须使用 --api-key 登录
--no-browserswitch否与 --console 同用,只打印登录链接,不自动打开浏览器
--token-stdinswitch否与 --console 同用,从标准输入读取并校验一个控制台访问令牌;需要 --console-region,不拉起浏览器或本地服务
--console-region <region>string否控制台网关地域,例如 cn-beijing、ap-southeast-1
--console-site <site>string否控制台站点:domestic、international
--open-apiswitch否保存阿里云 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 login --console --no-browser 打印登录链接,或通过 --token-stdin 从标准输入导入访问令牌。

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]
参数类型必填说明
--consoleswitch否仅清除控制台 access_token,保留 api_key
--open-apiswitch否仅清除 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-openswitch否不自动打开浏览器
示例:启动本地配置管理界面
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, pi
--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-deprecatedswitch否包含已下线的模型(默认隐藏)
--enrichswitch否同时获取主干模型的输入参数 Schema(predictConfig,仅详情模式)
示例:筛选阿里云提供的模型
bl model list --provider alibaba
  • 模型目录和 --enrich 使用的参数 Schema Endpoint 均为公开接口,无需登录控制台。
  • 浏览模式会隐藏已下线的模型,可用 --include-deprecated 包含它们;详情模式(--model)始终列出全部版本并标注状态。
按关键词搜索模型目录,按相关度排序。无需鉴权。 语法
bl model search --keyword <kw> [--limit <n>] [--provider <p>...] [--capability <c>...] [--feature <f>...] [--context-window <w>...] [--input-modality <m>...] [--output-modality <m>...] [--include-deprecated]
参数类型必填说明
--keyword <kw>string是与模型 ID、名称、能力、特性和描述匹配的关键词
--limit <n>number否最大返回条数(默认:20)
--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-deprecatedswitch否包含已下线模型
示例:搜索名称包含 qwen 的模型
bl model search --keyword qwen
  • 搜索会扫描完整目录,但默认隐藏已下线模型;传入 --include-deprecated 可包含。
  • 模型目录接口公开,无需控制台登录。

bl model code

输出可直接运行的 SDK 调用示例。无需鉴权。 语法
bl model code --model <model> [--sdk <sdk>] [--api <style>] [--lang <lang>]
参数类型必填说明
--model <model>string是要生成示例的模型
--sdk <sdk>string否SDK 类型:openai(默认)或 dashscope
--api <style>string否API 风格:completions(默认)或 responses
--lang <lang>string否代码片段语言(默认:python);传入不支持的值可查看可用列表
示例:生成 qwen-max 的 Python 示例
bl model code --model qwen-max
示例:生成 qwen-max 的 curl 示例
bl model code --model qwen-max --lang curl
  • 文本输出只包含代码片段,可直接重定向到文件;使用 --output json 可同时获取元数据。
  • 示例 Base URL 包含 [workspace-id] 占位符,需替换为实际 Workspace ID,或设置 BAILIAN_WORKSPACE_ID 后使用 DashScope Endpoint。
  • 可用组合由模型决定;传入不支持的值可查看该模型的可用列表。

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
链接白名单内的本地 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
  • 升级失败或无法获取最新版本时返回非零退出码,便于脚本和 Agent 检测失败。
运行 bl --help 可查看全部命令分组。