model-add-remove

A repository-specific guide for adding, removing, retiring, or changing the default AI models exposed by a command-line tool. It covers command code, types, generated command references, and user documentation.

In plain words
What is it for?
Use it when changing which Qwen, Wan, CosyVoice, or other models the CLI supports, including model defaults and model-specific request handling.
Why use it?
Changing a model requires updates in several places, including flags, fallback values, supported-model lists, API handling, and documentation. The guide helps keep those parts in sync.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/modelstudioai/cli/model-add-remove
Clone the repo
git clone --depth 1 https://github.com/modelstudioai/cli
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 808 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00808
Opus 5 $0.00000 $0.00404
Sonnet 5 $0.00000 $0.00162
Haiku 4.5 $0.00000 $0.00081

Measured yesterday against content hash 584876976ab6, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

model-add-remove scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

docs/agents/model-add-remove.md · 57 lines

What it actually says

模型上下架

触发条件

  • 上线新的 Qwen / Wan / CosyVoice / 等模型
  • 切换某命令的默认模型(如 bl text chat 默认从 qwen3.7-max 切到 qwen3.7-plus)
  • 废弃旧模型

模型本身是阿里云后端在管,本仓库要做的是让 CLI 能正确调用 + 文档/AI 入口准确反映可用模型清单

必查清单

A. 命令实现

  • packages/commands/src/commands/<group>/<action>.ts:
    • --model flag 的 description 里"default:"反映新默认值
    • 命令内部 const model = flags.model || settings.defaultXxxModel || "<default>" 的 fallback 字符串
    • 如果命令维护一个 supported-models 列表(如 speech/synthesize.ts:MODEL_VOICES),增删条目
    • 如果不同模型有不同 endpoint / 请求体形状,确保 if (model.startsWith("xxx")) 分支覆盖
  • 模型如有特殊 endpoint,看 packages/core/src/client/endpoints.ts
  • 如果新增的是某产品入口专属能力,确认 packages/cli/src/commands.ts 或其它入口 map 是否需要暴露/隐藏

B. 类型层

  • packages/core/src/types/api.ts 的 request/response 类型如果跟模型相关,同步字段

C. 命令手册

  • --model 的 description 含 default,改命令后跑 pnpm --filter bailian-cli run generate:reference 更新对应 skills/<skill>/reference/<group>.md 并提交
  • 同步拥有该命令的领域 skill「When to use which command」表中的 Default model(现主要是 bailian-gen;精调相关看 bailian-finetune 正文示例)。hub bailian-cli 已瘦身,一般不必再写领域默认模型(见 skill-change.md)

D. 用户面文档

  • README.md / README.zh.md:
    • Quick Start 示例如使用了具体型号,确认仍可用
    • 顶部 introduction 段落如提到"Qwen-Omni"等品牌名,无需变(模型代号变化不算品牌变)

E. 测试层

  • cli-e2e-tests.md 维护 e2e:断言不硬编码废弃模型 ID;新模型至少一条 happy-path 集成

完成后自查

# 默认模型走通
pnpm -F bailian-cli exec tsx src/main.ts <command> --message "test"
# 显式指定新模型
pnpm -F bailian-cli exec tsx src/main.ts <command> --model <new-model> --message "test"

常见漏点

  • ✗ 改了命令默认模型,但 SKILL.md frontmatter 或领域路由表 Default model 仍写老型号 → AI agent 调用时仍按老型号宣传
  • ✗ 只改了 reference/ / flag description,忘改 bailian-gen(等) SKILL 路由表
  • ✗ 废弃模型时只删了代码,e2e 测试还在跑,CI 红
  • ✗ 新模型 endpoint 不一致,但只改了 default,没加 endpoint 分支判断
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 57 lines · 0 tokens per session scan A 584876976ab6

Subscribe to this mod's changes

model-add-remove is an agent published in the GitHub repository modelstudioai/cli (320 stars, last pushed 4d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 808 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.