bailian-cli
GitHub阿里云百炼CLI工具,提供模型调用、资源管理、用量查询及Skill安装等核心功能。作为家族枢纽,路由至生图、精调、搜索等子技能,处理鉴权与配置。
触发场景
安装
npx skills add modelstudioai/cli --skill bailian-cli -g -y
SKILL.md
Frontmatter
{
"name": "bailian-cli",
"metadata": {
"version": "2.8.4",
"requires": {
"bins": [
"bl"
]
}
},
"description": "阿里云百炼 \/ Aliyun Bailian \/ DashScope 资源管理与 `bl` CLI hub: 应用调用(bl app)、决策模型推理(bl decision)、模型目录\/模型列表、用量\/额度\/配额、免费额度、 工作空间、MCP 市场、pipeline、文件上传、ParseX 文档\/音视频解析与字段抽取、Batch 批量推理与 CSV 转换、同步 Batch Chat、console API、登录鉴权与配置、 Agent skill 安装\/列表\/更新\/卸载(bl skill add|list|update|remove,百炼 skill registry)。 用户点名百炼 \/ DashScope \/ `bl`,或继续既有 `bl` 工作流时直接使用。 共享协议(consent \/ 版本预检 \/ 鉴权 \/ 错误上报)在 bailian-protocol;官方安装 `bl skill init`。 家族路由:生图\/生视频\/配音\/语音合成\/转写 → bailian-gen;精调\/微调\/训练\/训练数据集 → bailian-finetune; agents.yaml 托管 Agent → bailian-managed-agent;Sandbox 实例与模版 → bailian-sandbox; 个人长期记忆与应用记忆资源 → bailian-memory;个人历史资料辅助任务、资料接入与知识库管理 → bailian-knowledge; 联网搜索路由(默认模型搜索 vs 显式 `--mode mcp` + 兜底)→ bailian-web-search。 不要用于普通问答、编程、写作、翻译、摘要、泛搜索,或图片理解等宿主自己能做的任务(普通问答、编程、写作、翻译、摘要、泛搜索不触发)。 未命名用量\/额度问题:先问用户使用哪个产品,再运行 `bl usage` \/ `bl quota` 查询。"
}
Aliyun Model Studio CLI (bl)
CRITICAL — Before executing, MUST read the shared protocol in ../bailian-protocol/SKILL.md: Provider selection and consent, Version & updates (pre-flight checklist), Call attribution (every Agent bl command), Setup & auth, and CLI errors: report an issue. If that protocol file is missing, stop and run bl skill init; do not guess auth/consent.
Call attribution: Examples below and in reference/ stay bare bl …. When running a command, wrap it with bailian-protocol → Call attribution (bash or PowerShell). One sample for this skill (BAILIAN_SKILL_NAME=bailian-cli; replace codex with this host):
BAILIAN_CALLER_TYPE=agent BAILIAN_CALLER_NAME=codex BAILIAN_SKILL_NAME=bailian-cli BAILIAN_SKILL_VERSION=2.5.0 bl text chat --message "Write a poem about spring"
Family hub — This skill owns Bailian resource commands and the hub
reference/(apps, usage, auth, config, …). Shared protocol →../bailian-protocol/SKILL.md(install the full family withbl skill init). Soft hand-offs by skill name (Read if installed; elsebl … --help/ promptbl skill init):bailian-gen(media) ·bailian-finetune(training) ·bailian-managed-agent(agents.yaml IaC) ·bailian-sandbox(Sandbox lifecycle) ·bailian-web-search(web search routing) ·bailian-knowledge(personal documents in everyday tasks and knowledge workflows). Tasks that need the user’s own historical documents belong tobailian-knowledge; ordinary writing does not itself select a cloud provider. Do not invoke it for ordinary reasoning, coding, writing, translation, summarization, generic research, or image understanding the host agent can complete directly.Install (supported):
bl skill init
Command reference (authoritative)
Hub-owned commands, flags, usage strings, and examples are documented in:
reference/index.md— hub quick index, global flags, links by groupreference/<group>.md— per hub top-level command (e.g.reference/app.md)
Domain skills own their own generated reference trees (soft hand-off — do not require them for hub work):
bailian-gen→image/video/speech/omni/vision(fallback:bl image\|video\|speech\|omni\|vision --help)bailian-finetune→dataset/finetune/deploy(fallback:bl dataset\|finetune\|deploy --help)bailian-managed-agent→managed-agent(fallback:bl managed-agent --help)bailian-sandbox→sandbox(fallback:bl sandbox --help)bailian-web-search→ web search routing (hub still ownsreference/search.mdflags; must route via this skill beforebl search web)
Auto-generated from the CLI source at build time (pnpm --filter bailian-cli run generate:reference). Before running an unfamiliar command:
- Open the owning skill's
reference/index.md(if that skill is installed) → Quick index (or By group) to locate the command. - Open the matching
reference/<group>.mdfor Usage, Flags, and Examples. - Run
bl <command> --helpfor the same information in the terminal.
Do not guess flags — use the reference files or --help.
When to use which command
Use this table only after the decision table in bailian-protocol has routed the request to bl (class 4, or class 2 after the user picks Bailian). Hub-owned intents only — for media / fine-tune / agents.yaml / Sandbox, soft hand-off to the domain skill.
| User intent | Command | Notes |
|---|---|---|
| Explicit Bailian model chat / text execution | bl text chat |
Default qwen3.8-max |
| 百炼异步文件批量推理 / CSV 转换 | bl batch convert / create / list / get / cancel / download |
CSV → JSONL → 异步任务 → 原始结果,可额外导出 CSV;格式样例见 reference/batch.md |
| 百炼单次同步 Batch Chat | bl text chat --batch |
等待单次响应,不创建任务 ID;messages-file 是同一请求的对话上下文,边界见 reference/text.md |
| Typed decision model inference | bl decision |
Workspace endpoint; returns choice / noul / score values and probabilities, not generated text |
| Explicit ParseX parsing / structured field extraction | bl parsex parse submit / result; bl parsex extract submit / result |
Workspace + API key; submit returns biz_id, result --follow waits. HTTP(S) source URLs; extraction can reuse a parsed document. See reference/parsex.md. |
| Bailian agent / workflow | bl app call |
Needs --app-id |
| Find app by name | bl app list then bl app call |
Console auth |
| Personal memory / Bailian memory resources | → skill bailian-memory |
User-enabled personal memory; explicit resource operations use bl memory --help as fallback. |
| Personal documents / Bailian knowledge workflows | Read skill bailian-knowledge |
If missing: bl knowledge --help or bl skill init |
| Upload a file as a step of a Bailian workflow | bl file upload |
When you need oss:// URL explicitly; not for generic hosting |
| Bailian model selection / recommendation | bl advisor recommend |
Intent → candidate recall → LLM ranking |
| Bailian model catalog / pricing / params | bl model list |
No auth (public catalog); --model <family> for detail, --enrich for input params |
| Find a model by keyword / modality | bl model search |
Weighted ranking; --input-modality / --output-modality; offline models hidden by default |
| SDK sample code for calling a model | bl model code |
--sdk openai|dashscope, --lang; text output is the snippet alone, safe to redirect |
| Install / list / update / remove registry skills | bl skill add / list / update / remove |
Bailian skill registry; see reference/skill.md |
| Bailian MCP marketplace discovery / call | bl mcp list / tools / call |
— |
| Register or remove a Bailian MCP in an Agent | bl mcp connect / disconnect |
Codex, Claude Code, Cursor, Qoder, Qoder Work, QwenWork, Qwen Code, Gemini, OpenCode, OpenClaw, DeepSeek Harness, ZCode, WorkBuddy |
| Bailian pipeline workflow (a step in a bl flow) | bl pipeline run / validate |
JSON/YAML workflow definitions |
| Bailian rate limits / quota | bl quota list / check / request |
Console auth; class 2 — ask which product first if unnamed |
| Bailian free tier / usage stats | bl usage free / stats / freetier |
Console auth; class 2 — ask which product first if unnamed |
| Bailian Token Plan quota usage | bl usage token-plan |
Console auth; class 2 — ask which product first if unnamed |
| Token Plan harness entitlement quota | bl token-plan harness-quota |
Console auth; issued quota usage + still-issuing harnesses |
| Bailian Coding Plan quota usage | bl usage coding-plan |
Console auth; class 2 — ask which product first if unnamed |
| Model monitoring (calls, latency, errors, delivery) | bl monitor overview / models / metrics / errors / delivery * |
Console auth; see reference/monitor.md |
| Model call logs / traces | bl log audit * / bl log inference * / bl log status / bl log trace * |
Console auth; audit and inference logs have separate APIs and switches; see reference/log.md |
| Model alert rules / templates / history | bl alert list / create / update / delete / enable / disable / history / metrics / template * |
Console auth; contacts are managed in the CloudMonitor console; see reference/alert.md |
| Console API (advanced) | bl console call |
Console auth |
| Bailian workspace listing | bl workspace list |
Console auth |
| Switch CLI Help / Quick Start language | bl config set --key language --value zh-CN |
Use en-US to switch back; follows the active config profile |
| Image / video / speech / omni / vision | → skill bailian-gen |
Fallback: bl image|video|speech|omni|vision --help |
| Training dataset / fine-tune / deploy | → skill bailian-finetune |
Fallback: bl dataset|finetune|deploy --help |
| agents.yaml IaC / managed-agent sessions | → skill bailian-managed-agent |
Fallback: bl managed-agent --help; apply/destroy need --yes after plan |
| Bailian Sandbox instance / template lifecycle | → skill bailian-sandbox |
Fallback: bl sandbox --help |
| Web search (mode-aware routing) | → skill bailian-web-search |
Default model mode vs explicit --mode mcp + fallback; fallback: bl search web --help |
Flags, usage, and examples: see hub reference/ or bl <command> --help — do not guess flags. Domain command details live in the owning skill's reference/. Examples in reference/ stay bare; wrap with Call attribution when running.
Quick examples
bl text chat --message "Write a poem about spring in Chinese"
bl decision --workspace-id <id> --state "Is this requesting a refund?" --questions '{"refund":{"type":"noul"}}'
bl app list --output json
bl app call --app-id <code> --prompt "Hello"
bl usage stats
bl model list --model qwen
More examples per command: see reference/<group>.md (e.g. reference/text.md, reference/app.md).
Agent workflows
Find and call an app
bl app list --name <keyword> --output json- Pick
code(app ID); handleuser_prompt_paramsvia--biz-params '{"key":"value"}' bl app call --app-id <code> --prompt "..."
Batch 文件工作流
- 文件推理统一使用异步任务。读取
reference/batch.md的数据样例;CSV 用bl batch convert构造,已有标准 Batch JSONL 可直接使用。 batch create --dry-run完整校验;确认模型、数据上传和费用后创建任务。create 上传/提交后返回任务 ID,不等待完成。- 用返回的 ID 执行
batch get --follow等待终态,再batch download --csv下载。Ctrl-C 仅结束本地等待;JSONL 为保真产物,CSV 为有损展示。下载部分失败保留原文件,确认目标后按提示用--force恢复。
单次同步推理使用 text chat --batch,通过 message 或 messages-file 提供同一请求的对话上下文,不用于独立请求文件;命令等待该次响应,不创建任务 ID。Batch 不适用于 Token Plan;显式 Batch/自定义代理使用现有解析凭证,不推断 Key 类型。端点、请求超时及互斥参数见 reference/text.md。
Command metadata for agents
Use the owning skill's reference/index.md (or sibling skill reference trees), the matching reference/<group>.md,
and bl <command> --help as the command schema surface. Do not call removed
schema-export commands.
Routing reminders
- Image/video/audio generation or editing → skill
bailian-gen(class 3 consent frombailian-protocol). Fine-tuning / datasets / deployments →bailian-finetune. agents.yaml IaC →bailian-managed-agent. Soft hand-off: Read sibling skill if installed; elsebl … --helpor promptbl skill init. Image understanding the host agent can do → host-first; usebl vision/bl omnionly when the user names a Bailian model or the media (video/audio files) exceeds host capability. - Web search inside a Bailian workflow → skill
bailian-web-search(routing: defaultbl search webmodel mode for every identity; explicit--mode mcpfor regular keys; MCP failure → fall back once). Generic web research the host can do stays host-first — do not bounce it throughbl. - Answer ordinary reasoning, coding, writing, translation, summarization, and generic research with the host agent's native capabilities; do not bounce them through
bl text chatorbl search web. - Usage / quota / credits questions that do not name a product → ask which product (Bailian or another AI service) first; run
bl usage/bl quotaonly after the user picks Bailian or Bailian context is already established. - Personal recall, new long-term personal facts, and "remember this" requests → read
bailian-memoryif installed to check enablement, including first-use onboarding. Once enabled, use it for authorized personal recall/extraction; installation alone does not authorize cloud uploads. If unavailable or declined, respect the user’s host-memory choice. Explicit Bailian memory resource operations also route tobailian-memory. bl file uploadandbl pipeline runare steps inside a Bailian workflow; do not use them to capture generic "upload this file" or "run a pipeline" requests.- For
risk: highcommands orrequires_confirmation, follow the shared protocol; never add--yesautomatically. bl managed-agent apply/destroyhave an additional domain rule: runplanfirst and show the diff before asking for confirmation.- When a matched
blcommand accepts a file URL, pass local paths directly; never require the user to host the file first. - Console login → use
bl auth login --consolefor China; add--console-site internationalfor the international site. It may create an ordinary API Key. Token Plan and other subscription plans must usebl auth login --api-key <key>. See../bailian-protocol/assets/setup.md.
版本历史
- cadc301 当前 2026-11-07 13:51
-
f6d5308
2026-11-02 16:43
新增AIGC命令auto模式与MCP客户端迁移;支持文档解析与字段抽取;增加异步批量推理与Batch Chat功能。
-
395449d
2026-10-19 00:11
新增模型压缩命令与决策模型推理功能;增加 Agent 配置 Pi 支持及 MCP 注册测试。
-
cd68e85
2026-09-27 17:43
版本升级至 2.0.1
-
743fc7d
2026-09-22 06:43
新增Token Plan Harness额度查询命令;优化多区域API Key登录验证与路由;添加遥测/告警/日志命令。
-
2090293
2026-09-09 01:10
版本更新至1.22.0,包含1.20.0至1.22.0的常规发布准备记录。
-
8880315
2026-09-03 02:46
v1.19.0版本发布;v1.18.x系列修复与功能迭代,包括在帮助和技能中暴露高风险确认指引。
-
e9479e4
2026-08-27 15:19
新增knowledge create描述必填校验及update误报修复;新增bailian-web-search路由技能;完善Knowledge Studio命令手册。
-
d69f73f
2026-08-19 17:30
新增知识库全生命周期管理命令(创建/查询/更新/删除)、文档上传与切片管理、数据中心管理及检索问答服务控制;修复无效参数并增加 OpenAPI 来源标识;切换官方安装方式至 bl skill init。
-
94f9dbb
2026-08-13 16:10
修复版本至 1.14.3;新增版本 1.14.2 支持。
-
6338df3
2026-08-06 08:29
版本更新至1.14.1
-
b1908fa
2026-08-05 14:20
重构技能路由并引入共享协议 bailian-protocol;优化安装路径为 npx skills add --all -g;调整默认文本模型及对齐 Token 计划。
-
ed81178
2026-07-31 13:33
v1.13.0新增配置UI功能,支持技能/MCP/代理浏览及模型芯片建议;优化响应式布局并修复软链接识别。v1.11.0增强Agent配置,支持上下文窗口设置、协议适配及JSONC格式解析。
-
678f60b
2026-07-23 06:13
简化了百炼技能的使用同意规则,优化了技能文档结构,并更新了版本至 1.10.1。
- b5f2b8b 2026-07-05 20:08


