CLI 目录 横向对比 FCRS-1.0 标准 /llms.txt
← 返回 CLI 目录

Apify CLI

$ apify 官方出品 中风险
Apify · 办公协作与 SaaS · Apache-2.0 · macos / linux / windows

Apify CLI(apify)用于创建网页抓取与自动化 Actor 项目(create、init)、本地运行测试(apify run)、部署至 Apify Cloud(apify push)以及直接调用 REST 接口(apify api)。支持 APIFY_TOKEN 无头鉴权,但各子命令并未统一提供全局 --json 输出。

FCRS-1.0 综合评分
75 /100
良好 (Good)
中置信度 (源码/文档)
零摩擦安装命令
brew install apify-cli
CLI vs MCP 选型建议 CLI + MCP 搭配

Actor 脚手架、本地 apify run 与 apify push 直接使用 CLI 更佳;读取云端数据集可结合 apify api 或 Apify MCP。

Agent 友好度体检单

— 原生 JSON 输出
— 字段裁剪
✓ 无头非交互
— 支持 Dry-Run
— 只读模式开关
— 支持 NO_COLOR
✓ 自省/Schema 发现
— 官方 SKILL.md

当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。

FCRS-1.0 六维评分拆解

Agent 友好度 18 / 25

支持 APIFY_TOKEN 无头鉴权与 apify api 原生 JSON 返回,但生命周期命令输出人类文本且缺少全局 --json 与 --dry-run。

  • APIFY_TOKEN and apify api JSON responses
  • No global --json across run/push/call
安全与权限边界 18 / 25

本地 apify run --purge 可避免产生云端费用,但 apify call 与 push 会直接变更云端状态并消耗计算额度且无 --dry-run。

  • Local apify run isolation
  • apify call triggers billed cloud runs
安装与运行摩擦 13 / 15

可通过 npm(apify-cli)、npx 与 Homebrew(apify-cli)在 macOS、Linux 与 Windows 安装。

  • npm apify-cli and Homebrew formula
能力覆盖与边际价值 12 / 15

覆盖本地 Actor 测试、多包仓库 push、远程 call 与原生 REST 请求(apify api)。

  • Includes create, run, push, pull, call, and api
维护与来源背书 8 / 10

由 Apify 官方仓库(apify/apify-cli)基于 Apache-2.0 协议持续维护。

  • Official apify/apify-cli repository
文档与可验证性 6 / 10

在 docs.apify.com/cli 与 apify help 中提供基础说明。

  • Official docs at docs.apify.com/cli

安全边界、鉴权与放权指南

鉴权方式
环境变量密钥 浏览器 OAuth 本地配置文件
凭证存储位置

支持通过 APIFY_TOKEN 环境变量无头鉴权,或使用 apify login 将凭证保存在本地 ~/.apify/。

潜在副作用
只读查询 本地写入 远端写入 计费影响
费用与配额提示

Apache-2.0 开源 CLI;Apify Cloud 提供每月免费额度,超出后按计算单元计费。

可复制到 CLAUDE.md / AGENTS.md 的安全护栏
# Apify CLI Agent Rules
- Authenticate with `APIFY_TOKEN` and prefer `apify run --purge` locally before `apify push` or `apify call`.
- Remember `apify call` incurs Apify Cloud compute units; verify Actor input payloads first.

Agent 高频安全命令配方

只读查询(安全推荐)

直接查询 Apify REST 接口
apify api -X GET /v2/acts

以 JSON 格式查询当前账号下的 Apify Actors 列表。

发现可用的 Apify API 端点
apify api --list-endpoints

列出 apify api 支持的接口端点,不修改云端状态。

受控写入与预演

清理本地存储后试运行 Actor
apify run --purge

重置本地 dataset 与 KV 存储并在本地执行当前 Actor 项目。

核心优势

  • + 本地 apify run --purge 支持在部署前验证 Actor 行为。
  • + 内置 apify api --list-endpoints 便于直接发起已鉴权的 JSON REST 调用。

注意事项与踩坑点

  • ! create、push 与 call 缺少全局 --json 与 --dry-run 参数。
  • ! apify call 会在云端触发执行并消耗 Apify Cloud 计算额度。

已验证兼容的 Agent 宿主

Claude Code Codex CLI Gemini CLI