360 Secure SkillHub
360 安全技能中心

bailian-cli

提供 bl 命令参考与路由:调用和管理百炼应用、文本/向量/重排序/决策模型推理、批量推理与文件上传、模型目录与评测、监控日志、配额用量、MCP 与 pipeline、登录鉴权与配置;高风险命令需用户显式确认。

分类:自动化
modelstudioai
热度 49.05
最近更新 2026-12-04 23:37:33

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add modelstudioai/cli/bailian-cli
兼容性
通用兼容
联网要求
需要联网
数据出网
必须出网
Metadata
name
bailian-cli
metadata
{"version":"2.18.1","requires":{"bins":["bl"]}}
description
阿里云百炼 / Aliyun Bailian / DashScope 资源管理与 `bl` CLI hub: 应用调用与管理(bl flow-agent:调用/创建/更新/发布/删除/复制/版本、工作流画布;旧 bl app call/list 已废弃)、决策模型推理(bl decision)、 文本/多模态向量(bl embedding create)、候选文档重排序(bl rerank)、模型目录/模型列表、用量/额度/配额、免费额度、 工作空间、MCP 市场、pipeline、文件上传、ParseX 文档/音视频解析与字段抽取、Batch 批量推理与 CSV 转换、同步 Batch Chat、console API、登录鉴权与配置、 模型评测(bl eval:评测维度/评分器、自定义评测任务、报告对比、Case 与人工标注、榜单) 云端 Skill 检索与详情(bl skill search|get),Agent Skill 安装/列表/更新/卸载(bl skill add|list|update|remove,百炼 skill registry)。 用户点名百炼 / DashScope / `bl`,或继续既有 `bl` 工作流时直接使用。 共享协议(consent / 版本预检 / 鉴权 / 错误上报)在 bailian-protocol;官方安装 `bl skill init`。 家族路由:生图/生视频/配音/语音合成/转写/图片翻译/文档翻译/PDF 翻译 → bailian-gen;精调/微调/训练/训练数据集 → bailian-finetune; 百炼模型智能路由(智能选模、smart routing / model routing)、吞吐预留(PTU)、ModelCode 容量购买与扩缩容 → bailian-finetune; agents.yaml 托管 Agent → bailian-managed-agent;Sandbox 实例与模版 → bailian-sandbox; 个人长期记忆与应用记忆资源 → bailian-memory;个人历史资料辅助任务、资料接入与知识库管理 → bailian-knowledge; 联网搜索路由(默认模型搜索 vs 显式 `--mode mcp` + 兜底)→ bailian-web-search。 点名百炼 / Qwen-MT / `bl text translate` 的专用文本翻译走本技能。 不要用于普通问答、编程、写作、宿主能直接完成的纯文本翻译、摘要、泛搜索,或图片理解等宿主自己能做的任务 (普通问答、编程、写作、宿主可完成的纯文本翻译、摘要、泛搜索不触发)。 未命名用量/额度问题:先问用户使用哪个产品,再运行 `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). When copying commands into a reusable script / template / task definition, switch to the protocol script template (never keep agent); the sample below is for this-turn inline execution only. Strip attribution when handing a command to the user to paste.

BAILIAN_CALLER_TYPE=agent BAILIAN_CALLER_NAME=codex BAILIAN_SKILL_NAME=bailian-cli BAILIAN_SKILL_VERSION=<metadata.version> 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 with bl skill init). Soft hand-offs by skill name (Read if installed; else bl … --help / prompt bl skill init): bailian-gen (media / image·doc·PDF translation) · bailian-finetune (training) · bailian-opd (guided end-to-end OPD distillation workflow) · 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 to bailian-knowledge; ordinary writing does not itself select a cloud provider. Do not invoke it for ordinary reasoning, coding, writing, host-capable plain-text translation, summarization, generic research, or image understanding the host agent can complete directly. Named Bailian / Qwen-MT / bl text translate text translation stays here; image / document / PDF translation → bailian-gen.

Install (supported): bl skill init

Command reference (authoritative)

Hub-owned commands, flags, usage strings, and examples are documented in:

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 owns reference/search.md flags; must route via this skill before bl search web)

Auto-generated from the CLI source at build time (pnpm --filter bailian-cli run generate:reference). Before running an unfamiliar command:

  1. Open the owning skill's reference/index.md (if that skill is installed) → Quick index (or By group) to locate the command.
  2. Open the matching reference/<group>.md for Usage, Flags, and Examples.
  3. Run bl <command> --help for 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
Built-in tools (web extract / code interpreter / text-to-image search / image-to-image search) bl text chat --builtin-tool … (+ --api responses / --image as needed) Prefer Responses for extractor / image tools; Chat maps web_search and code_interpreter only; see reference/text.md. Ordinary web search routing stays bailian-web-search.
Create text / multimodal embeddings directly bl embedding create Default text-embedding-v4 (text) / qwen3-vl-embedding (media); full vectors in JSON/--out. For knowledge-base indexing / retrieval → bailian-knowledge, not this command. See reference/embedding.md.
Rerank candidate documents for a query bl rerank Default qwen3-rerank; scores comparable only within one request. For knowledge-base retrieval / server-side hybrid ranking → bailian-knowledge, not this command. See reference/rerank.md.
Dedicated text translation (Qwen-MT) bl text translate --target-lang <English name> Default qwen-mt-flash; language names are English full names (Chinese/English), not zh/en; only user messages; see reference/text.md
百炼异步文件批量推理 / 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 flow-agent call Needs --app-id
Find app by name bl flow-agent list then bl flow-agent call Console auth; --type workflow lists workflows
Create / update / publish / delete / copy an app bl flow-agent create / update / publish / delete / copy / get / versions Console auth; agent config via --model/--instructions/--config-json; delete needs --yes; see reference/flow-agent.md
Workflow canvas read / save / publish / export bl flow-agent workflow get / save / publish / export Console auth; save replaces the whole draft canvas; see reference/flow-agent.md
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
Resolve a Console file key / error-report URL bl file url Console auth; use the returned business file key, not a file ID or upload URI. Resolves only; no download or fixed expiry. Existing URLs need no resolution.
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 OSS --name, cloud --code. add --all installs the registry. update --all updates installed OSS skills. Filter by --agent / --scope. Reference
Find cloud skills or inspect local installation paths bl skill search / bl skill get Search the cloud with a Bailian API key. Pass the returned skill_code to get --code. Use get --name for an OSS skill.
Find and run a workspace connector tool bl connector tools --query → schema → call Use the discovered toolRef and authorized instanceId. Pass the returned traceId to both subsequent commands.
Inspect activated MCP servers, details or tools bl mcp list / get / tools / call —
Find MCP tools by task or inspect a server's tools bl mcp tool search / bl mcp tool list Search with --query or list with --server. Both operations may trigger OneKey activation. Preview with --dry-run.
Call a tool by server code and tool name bl mcp tool call / bl mcp call Use --server and --tool for OpenAPI, or --target <server.tool> for an MCP session.
Activate or stop MCP servers bl mcp activate / deactivate API key. Use --server <code,...> to select servers and --dry-run to preview the batch.
Manage a custom Bailian MCP server bl mcp create / update / delete API key. Preview changes with --dry-run. Deleting a server requires --yes.
Register or remove a Bailian MCP in an Agent bl mcp connect / disconnect Choose --agent and --scope user|project. Connect previews the workspace endpoint and any activation. Disconnect uses the local registration.
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 evaluation (evaluation sets, dimensions, tasks, reports, rankings) bl eval * Console auth; evaluation sets come from bl dataset create --schema eval-* + dataset publish (skill bailian-finetune), tasks accept published versions only; task create is risk: high; see reference/eval.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
百炼模型智能路由 / smart routing / model routing → skill bailian-finetune 独立于精调流程;fallback: bl deploy router --help。
吞吐预留(PTU)/ ModelCode 容量购买与扩缩容 → skill bailian-finetune 独立于精调流程;包括容量查询、购买、扩缩容、续费、释放、退订与溢出策略;fallback: bl deploy --help。
Guided end-to-end OPD distillation workflow → skill bailian-opd Authorize → validate → preflight → consent → submit → wait; fallback: bl finetune opd --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 embedding create --text "城市夜景" --text "繁忙街道" --dimensions 1024 --output json
bl rerank --query "城市夜景" --document "白天的田野" --document "霓虹街道与夜空" --top-n 1 --output json
bl decision --workspace-id <id> --state "Is this requesting a refund?" --questions '{"refund":{"type":"noul"}}'
bl flow-agent list --output json
bl flow-agent call --app-id <code> --prompt "Hello"
bl flow-agent create --name "My agent" --model qwen3-max
bl usage stats
bl model list --model qwen

More examples per command: see reference/<group>.md (e.g. reference/text.md, reference/flow-agent.md).


Agent workflows

Find and call an app

  1. bl flow-agent list --name <keyword> --output json
  2. Pick code (app ID); handle user_prompt_params via --biz-params '{"key":"value"}'
  3. bl flow-agent call --app-id <code> --prompt "..."

Create and configure an app

  1. bl flow-agent create --name <name> [--type workflow] --output json → returns app_code
  2. Agent: bl flow-agent update --app-id <code> --model <model> --instructions "..." (reads the draft, merges, writes)
  3. bl flow-agent publish --app-id <code> to release; bl flow-agent get --app-id <code> to inspect
  4. Workflow canvas: bl flow-agent workflow get --app-id <code> --output-file canvas.json → edit → bl flow-agent workflow save --app-id <code> --config-file canvas.json → bl flow-agent workflow publish --app-id <code>

bl app call / bl app list are deprecated aliases of bl flow-agent call / bl flow-agent list; the rest of the app group moved to flow-agent.

Batch 文件工作流

  1. 文件推理统一使用异步任务。读取 reference/batch.md 的数据样例;CSV 用 bl batch convert 构造,已有标准 Batch JSONL 可直接使用。
  2. batch create --dry-run 完整校验;确认模型、数据上传和费用后创建任务。create 上传/提交后返回任务 ID,不等待完成。
  3. 用返回的 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。

意图理解模型(tongyi-intent-detect-v3)

走 bl text chat,没有独立的 intent 命令。它是 OpenAI 兼容 Chat 模型:候选意图与槽位写在 system message 里,响应是标签化伪 XML(tags / tool_call / content 三段)由调用方解析。模型卡明确不支持 Function Calling,所以不要把意图映射成 tools 数组。官方文档只给 SDK 示例,端点路径可由兼容模式推出;文档「支持的模型」写最大输出 1024、模型卡写 4096,二者矛盾,长度敏感场景先实测。地域仅见北京示例。

# 意图 + 槽位联合预测(响应含 tool_call 块与 content)
bl text chat --model tongyi-intent-detect-v3 \
  --system 'You are a helpful assistant. The tools you can use are as follows: [{"name":"alarm_set","description":"设置闹钟","parameters":{"time":{"type":"string","description":"时间,HH:mm"}}}]. Response in INTENT_MODE.' \
  --message "明天七点半叫我" --output json

# 纯意图分类(答案就是列表里的一个 tag)
bl text chat --model tongyi-intent-detect-v3 \
  --system 'You should choose one tag from the tag list: [查询天气,设置闹钟,取消设置] just reply with the chosen tag.' \
  --message "明天七点半叫我" --output json

第一种取 tool_call / content 块解析;第二种直接读单个 tag。多轮补槽可用——把历史轮次一并放进 --message。

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 from bailian-protocol). Fine-tuning / datasets / deployments → bailian-finetune. agents.yaml IaC → bailian-managed-agent. Soft hand-off: Read sibling skill if installed; else bl … --help or prompt bl skill init. Image understanding the host agent can do → host-first; use bl vision / bl omni only 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: default bl search web model mode for every identity; explicit --mode mcp for regular keys; MCP failure → fall back once). Generic web research the host can do stays host-first — do not bounce it through bl.
  • Answer ordinary reasoning, coding, writing, translation, summarization, and generic research with the host agent's native capabilities; do not bounce them through bl text chat or bl 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 quota only after the user picks Bailian or Bailian context is already established.
  • Personal recall, new long-term personal facts, and "remember this" requests → read bailian-memory if 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 to bailian-memory.
  • bl file upload and bl pipeline run are steps inside a Bailian workflow; do not use them to capture generic "upload this file" or "run a pipeline" requests.
  • For risk: high commands or requires_confirmation, follow the shared protocol; never add --yes automatically.
  • bl managed-agent apply / destroy have an additional domain rule: run plan first and show the diff before asking for confirmation.
  • When a matched bl command accepts a file URL, pass local paths directly; never require the user to host the file first.
  • Auth login → prefer bl auth login --oauth for China; add --console-site international for the international site (covers Console session + OpenAPI STS). Keep bl auth login --console as a compatible console browser path (it may create an ordinary API Key). For model consumption, Token Plan and other subscription plans must use bl auth login --api-key <key> (not for Token Plan seat/member management). See ../bailian-protocol/assets/setup.md.