# @contenthero/cli 中文文档

规范地址：https://npmcn.com/package/%40contenthero/cli/

版本：0\.3\.40
npm 元数据更新时间：2026-11-07T06:22:11.525Z
中文译文更新时间：2026-11-10T19:50:07.074Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40contenthero/cli
原文对照：https://npmcn.com/package/%40contenthero/cli/?lang=original
项目主页：https://github.com/contenthero-ai/contenthero-sdk#readme
源码仓库：https://github.com/contenthero-ai/contenthero-sdk

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：693 kB，170 个文件
- 模块格式：ES Module
- TypeScript 类型：包内自带
- Node.js 要求：\>=20
- 运行依赖：3 个
- 首次发布：2026-06-18T15:10:43.101Z
- 最新版本发布：2026-11-07T06:22:11.381Z
- 近 30 天下载量：3065（2026-10-11 至 2026-11-09，npm 官方下载统计）
- 已发布版本数：56（近 12 个月 56 个）

## 中文简介

官方内容英雄CLI. 生成媒体,运行内容管道,并从终端或任何代理外壳读取你的品牌/研究上下文. 旋转 @ contenthero/ sdk 内核 .

## 安装

```sh
npm install @contenthero/cli
```

也可以使用：`pnpm add @contenthero/cli`、`yarn add @contenthero/cli`、`bun add @contenthero/cli`

## README

# @contenthero/ cli (中文(简体) )

官方内容英雄命令行界面. 生成媒体, 运行内容 从终端或任何代理人读取您的品牌和研究背景 壳. 它骑着 [`@contenthero/sdk`](https://www.npmjs.com/package/@contenthero/sdk) 内核,所以它说话相同 `/api/v1` 表面为 SDK 和 [MCP 服务器](https://www.npmjs.com/package/@contenthero/mcp)。 。 。 .

默认为 JSON, 可预测的退出代码和 a `schema` 命令 因此,一个代理可以发现每个命令的输入,而不需要文件.

## 安装

```bash
npm install -g @contenthero/cli
```

需要节点20+. 二进制是 `contenthero`。 。 。 .

## 认证

CLI 按此顺序解决您的 API 密钥 : `--api-key` 旗帜,然后是 `CONTENTHERO_API_KEY` 环境变量,然后是存储的证书.

```bash
# Browser-assisted (recommended): opens your browser, mints a key for this machine
contenthero login

# Bring your own key (CI / headless): create one in the app under API Keys
export CONTENTHERO_API_KEY=ch_live_...
# ...or store it:
contenthero login --with-key ch_live_...     # or: echo "$KEY" | contenthero login --with-key

contenthero auth status        # verify the active key and show the account
contenthero logout             # remove the stored credential
```

存储的证书住在 `~/.contenthero/credentials` (第0600节). 洞穴 var 总是胜过存储文件,因此 CI 可以覆盖本地登录.

## 产出

JSON为默认值(为代理和脚本所建). 添加 `--human` 可读性 表格和关键/价值产出.

```bash
contenthero account get
contenthero model list --type image --human
```

## 生成

`generate` 覆盖图像,视频,音频,相板,和相唇同步. 等待的种类 份额 `--cost` (飞行前,收费无), `--wait` 编号 : `--no-wait` (默认) 等会)和 `--timeout <seconds>`。 。 。 .

```bash
# Model ids come from `contenthero model list`
# Preflight the cost, then generate and wait for the URLs
contenthero generate image "a red ceramic cube on white" --model <imageModelId> --cost
contenthero generate image "a red ceramic cube on white" --model <imageModelId>

# Submit without blocking, then poll
ID=$(contenthero generate video "drone shot over a canyon" --model <videoModelId> --no-wait | jq -r .outputId)
contenthero status "$ID" --no-wait
contenthero status "$ID" --timeout 300

# Chain: feed a previous output id straight in as a reference (URL or output id)
contenthero generate video "slow zoom in" --model <videoModelId> --start-frame "$ID"

# Audio (synchronous) and upscaling
contenthero generate audio --model <audioModelId> --text "Hello there" --voice <voiceId>
contenthero upscale "$ID" --model <upscaleModelId> --factor 2x
```

出站码4意味着一个渲染被接受,但在超时前没有完成. 这个 `outputId` 仍然被排放,所以你可以保持投票.

## 其余的表面

每个命令以它运行的 MCP 工具来命名(`export get` 实值 `get_export`, (中文(简体) ), `post publish` 实值 `publish_post`)),所以一个代理人在一个表面学到的东西在另一个表面读取相同.

```
contenthero view               see what the user is looking at; render, hear or watch your work; see a raw clip
contenthero project            list | get | create | update | duplicate | share | delete | apply
                               | transcript get | edit undo|redo
                               | settings get|update | version list|save|restore|update|delete
contenthero media              list | search | get | zoom | share
contenthero import             <url> | --pptx <url> | --canva <id>: bring a file, video page or deck in
contenthero export             <projectId> | get | list: render a project into a file
contenthero download           <id> [path]: write any file of yours, or an export, to disk (free)
contenthero upload             <file...>: put local files in your library, large ones in parts, a progress line each, `--resume <outputId>` finishes one that stopped
contenthero transcribe         [audioUrl] | --content-id <id> [--slide <n>]: speech to text
contenthero status             <ids...> [--kind <kind>]: where any background job is
contenthero card               list | get | create | update
contenthero post               publish
contenthero tag                list | create | update | delete
contenthero stage              list | create | update | delete
contenthero space              list | get | create | update | delete
contenthero folder             list | get | create | update | delete
contenthero brand-kit          list | get | create | extract | update | knowledge list|get|search|add|remove
contenthero template           list | get | create | update | delete
contenthero kling-element      list | get | create | update | delete
contenthero avatar             list | get | create | update | delete | look add|remove
contenthero voice              list | get
contenthero audio              isolate | enhance | enhance-clips | split | split-clips
contenthero content            list | get | analyze
contenthero tracked-account    list | get | add | update | remove
contenthero connected-account  list | get
contenthero account            get | update
contenthero model              list | get
contenthero schema             get
```

## 对于特工

`schema get commands` 丢弃每个命令的参数和选项为 JSON, 所以代理 可以不读这些文件就监听电话:

```bash
contenthero schema get commands                 # the whole surface
contenthero schema get commands generate image  # just one command
```

## 退出代码

`0` 成功吗, `1` 一般错误, `2` 使用错误, `3` 认证错误, `4` 暂停(工程已接受,但未及时完成), `5` 限额拒绝了(信用,每月) 支出上限、存储、计划限额;没有运行,也没有收取任何费用)。 在 JSON 模式中,限制错误也带有它 `code` 编号 `actions`。 。 。 .

## 图像控制和发现

现有 `generate image` 命令接受 `--quality`, (中文(简体) ), `--output-format`, (中文(简体) ), `--background`, (中文(简体) ), `--frame-count`, (中文(简体) ), `--frame-duration-ms`,以及 `--frame-size`读取 `model list` 财务报告和审定财务报表 `model get <id>` 用于选定模型的当前选择、默认、条件、格式兼容性和GIF工作表规则. `--json` 保留完整的发现反应.

CLI 在 `--frame-count` 提供,发送一个用于滑动控制的数字和一个用于选定控制的字符串。 框架持续时间是一个以毫秒为单位的整数. 仅用 GIF 输出发送 GIF 控制 。 升起的旗帜被忽略了。 使用 `--cost` 在不生成的情况下预览同一请求。 服务器拥有模型验证,其拒绝文本被保存.

## 视频草稿控件

在生成前发现模型声明 。 示范清单和细节包括已接受的投入、投入模式、宣布的决议草案,以及宣布后升级决议和提供情况。 在仍可使用时,更新已完工的草稿。 射击设置是继承的,不能改变。 服务器执行所有权,完成,到期,以及选取的草稿输出是否已经升级.

`generate video` 接受 `--draft`, (中文(简体) ), `--upgrade-from-output-id`, (中文(简体) ), `--upgrade-slot`, (中文(简体) ), `--output-format` 财务报告和审定财务报表 `--return-last-frame`。关闭即时和射击设置进行升级。 选择第一个输出 。 添加 `--cost` 在不生成的情况下预览同一请求.

对于 `generate lip-sync`读取 `model get` 先说 供应 `--image` 模型声明 `singleImage`,或 `--ref-video` 模型声明 `singleVideo`添加 `--audio`,或 `--script` 与 `--voice`。通过 `--cost` 预览同一请求。 服务器验证了模型所需的源.

## 常见问题

### @contenthero/cli 是什么？

官方内容英雄CLI\. 生成媒体,运行内容管道,并从终端或任何代理外壳读取你的品牌/研究上下文\. 旋转 @ contenthero/ sdk 内核 \.

### 如何安装 @contenthero/cli？

在项目目录运行 npm install @contenthero/cli，或使用 pnpm add / yarn add / bun add。它还提供命令行工具 contenthero，可以用 npx contenthero 直接运行。

### @contenthero/cli 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### @contenthero/cli 支持 ESM 还是 CommonJS？

以 ES Module 形式发布，推荐使用 import 引入。在 CommonJS 项目中，Node\.js 20\.19\+ / 22\.12\+ 可以直接 require\(\) 不含顶层 await 的 ES Module，更早的版本需要改用动态 import\(\)。

### @contenthero/cli 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>=20。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### @contenthero/cli 可以商用吗？

@contenthero/cli 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @contenthero/cli 的下载量有多少？

根据 npm 官方下载统计，@contenthero/cli 在 2026/10/11 – 2026/11/09 这 30 天内被下载 3,065 次，日均约 102 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @contenthero/cli 还在维护吗？

最新版本 0\.3\.40 发布于 2026/11/07（3 天前）；至今共发布 56 个版本，其中过去 12 个月发布了 56 个；首次发布于 2026/06/18。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

