@contenthero/cli

中文文档
0.3.40发布于 2026/11/07MITTypeScriptES Module近 30 天下载 3065

Official ContentHero CLI. Generate media, run the content pipeline, and read your brand/research context from the terminal or any agent shell. Rides the @contenthero/sdk kernel.

原始使用文档
文档目录9 节
  1. Install
  2. Authenticate
  3. Output
  4. Generate
  5. The rest of the surface
  6. For agents
  7. Exit codes
  8. Image controls and discovery
  9. Video draft controls

@contenthero/cli

The official ContentHero command-line interface. Generate media, run the content pipeline, and read your brand and research context from the terminal or any agent shell. It rides the @contenthero/sdk kernel, so it talks to the same /api/v1 surface as the SDK and the MCP server.

Built agent-first: JSON by default, predictable exit codes, and a schema command so an agent can discover every command's inputs without docs.

Install

npm install -g @contenthero/cli

Requires Node 20+. The binary is contenthero.

Authenticate

The CLI resolves your API key in this order: the --api-key flag, then the CONTENTHERO_API_KEY environment variable, then a stored credential.

# 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

The stored credential lives at ~/.contenthero/credentials (mode 0600). The env var always wins over the stored file, so CI can override a local login.

Output

JSON is the default (built for agents and scripts). Add --human for readable tables and key/value output.

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

Generate

generate covers image, video, audio, board, and lip-sync. The waitable kinds share --cost (preflight, charges nothing), --wait / --no-wait (default waits), and --timeout <seconds>.

# 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

Exit code 4 means a render was accepted but did not finish before the timeout. The outputId is still emitted, so you can keep polling.

The rest of the surface

Each command is named after the MCP tool it runs (export get is get_export, post publish is publish_post), so what an agent learns on one surface reads the same on the other.

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

For agents

schema get commands dumps every command's arguments and options as JSON, so an agent can wire up calls without reading these docs:

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

Exit codes

0 success, 1 general error, 2 usage error, 3 authentication error, 4 timeout (the work was accepted but did not finish in time), 5 a limit refused it (credits, the monthly spend cap, storage, a plan limit; nothing ran and nothing was charged). In JSON mode a limit error also carries its code and ranked actions.

Image controls and discovery

The existing generate image command accepts --quality, --output-format, --background, --frame-count, --frame-duration-ms, and --frame-size. Read model list and model get <id> for the selected model's current choices, defaults, conditions, format compatibility, and GIF sheet rules. --json retains the complete discovery response.

The CLI reads the selected model when --frame-count is supplied, sending a number for a slider control and a string for a select control. Frame duration is an integer in milliseconds. Send GIF controls only with GIF output. Omitted flags stay omitted. Use --cost to preview the same request without generating. The server owns model validation and its refusal text is preserved.

Video draft controls

Discover the model declaration before generating. Model lists and details include accepted inputs, input modes, the declared Draft resolution, and upgrade resolution and availability when declared. Upgrade a completed draft owned by the caller while it remains available. Shot settings are inherited and cannot change. The server enforces ownership, completion, expiration and whether the selected draft output already has an upgrade.

generate video accepts --draft, --upgrade-from-output-id, --upgrade-slot, --output-format and --return-last-frame. Omit the prompt and shot settings for an upgrade. Omitting the slot selects the first output. Add --cost to preview the same request without generating.

For generate lip-sync, read model get first. Supply --image for a model declaring singleImage, or --ref-video for a model declaring singleVideo. Add --audio, or --script with --voice. Pass --cost to preview the same request. The server validates the source required by the model.

版本与发布记录

@contenthero/cli 共发布 56 个版本,首次发布于 2026/06/18;过去 12 个月发布了 56 个版本。

版本发布日期距今
0.3.40latest2026/11/073 天前
0.3.392026/11/0110 天前
0.3.382026/10/3110 天前
0.3.372026/10/2912 天前
0.3.362026/10/2912 天前
0.3.352026/10/2814 天前

关于 @contenthero/cli 的常见问题

@contenthero/cli 是什么?

Official ContentHero CLI. Generate media, run the content pipeline, and read your brand/research context from the terminal or any agent shell. Rides the @contenthero/sdk kernel.

如何安装 @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 和提交记录判断。