← 返回 Skills 市场
kyriswu

unkey-cli

作者 kyris wu · GitHub ↗ · v1.0.1 · MIT-0
cross-platform ✓ 安全检测通过
63
总下载
0
收藏
0
当前安装
2
版本数
在 OpenClaw 中安装
/install unkey-cli
功能描述
使用 Unkey CLI 在终端中管理 API namespaces、keys、identities、permissions、rate limits 和 analytics 查询。当用户提到 unkey 命令、API key 管理、限流、RBAC 权限、身份分组或 key 验证排查时触发。Use this ski...
使用说明 (SKILL.md)

Unkey CLI Skill

使用 Unkey 官方 CLI 在终端执行管理操作,不要臆造命令输出。

注意:CLI 处于 early 阶段,命令和输出格式可能变化;底层 Unkey API 是稳定版本化的。

何时使用

以下场景应触发本技能:

  • 创建、查询、删除 API namespace
  • 创建、校验、更新、删除 API keys
  • 管理 identities(按用户/团队分组 key)
  • 管理 permissions / roles(RBAC)
  • 配置或排查 ratelimit
  • 查询 key verification analytics(SQL)
  • 用户明确要求使用 unkey 命令行

文档发现规则

在扩展命令细节(参数、边界行为)前,先读取文档索引:

  • https://unkey.com/docs/llms.txt

再根据索引进入对应 CLI 子页面(如 docs/cli/keys/create-key.md)。

安装检查与安装

先检查是否已安装:

unkey --help

若未安装,优先提示以下方式之一:

npm install -g unkey

或从 GitHub Releases 下载对应平台二进制。

鉴权与密钥来源优先级

执行命令前确认 root key 来源,优先级如下:

  1. 命令参数 --root-key
  2. 环境变量 UNKEY_ROOT_KEY
  3. 本地配置 ~/.unkey/config.toml(来自 unkey auth login

首次登录命令:

unkey auth login

如果三者都没有,停止执行并提示用户提供 root key 或先登录。

标准命令形态

所有 API 操作遵循:

unkey api \x3Cresource> \x3Caction> [flags]

Resources

  • apis: API namespace 的创建、查询、删除、列 key
  • keys: key 创建/校验/更新/删除、权限与角色绑定
  • identities: identity 创建/查询/更新/删除
  • permissions: permission 与 role 管理
  • ratelimit: 限流检查与 override 管理
  • analytics: SQL 查询 key verification 数据

常用命令示例

# 创建 API namespace
unkey api apis create-api --name=payment-service-prod

# 创建 key
unkey api keys create-key --api-id=api_1234abcd --name='Production Key' --enabled

# 校验 key
unkey api keys verify-key --key=sk_1234abcdef

# 单标识限流检查
unkey api ratelimit limit --namespace=api.requests --identifier=user_123 --limit=100 --duration=60000

# analytics 查询
unkey api analytics get-verifications --query="SELECT COUNT(*) as total FROM key_verifications_v1 WHERE outcome = 'VALID' AND time >= now() - INTERVAL 7 DAY"

# 创建 permission 并绑定到 key
unkey api permissions create-permission --name=documents.read --slug=documents-read
unkey api keys add-permissions --key-id=key_1234abcd --permissions=documents.read,documents.write

输出与脚本模式

默认输出通常包含:

  • 请求 ID 和耗时(例如 req_xxx (took 45ms)
  • 返回数据对象

用于脚本时,强制使用 JSON:

unkey api apis create-api --name=my-api --output=json | jq '.data.id'

全局参数

所有命令都可使用:

  • --root-key: 覆盖 root key
  • --api-url: 覆盖 API 地址(默认 https://api.unkey.com
  • --config: 指定配置文件路径(默认 ~/.unkey/config.toml
  • --output: 输出格式(脚本场景建议 json

帮助与自检

优先使用内置帮助确定 flags:

unkey --help
unkey api --help
unkey api keys --help
unkey api keys create-key --help

执行准则

  • 在未确认鉴权来源前,不执行会修改资源的命令。
  • 对删除类命令(二次不可逆)先提醒用户确认再执行。
  • 不回显完整 root key;如需展示命令,脱敏处理密钥。
  • 不伪造执行结果;失败时返回原始错误并给出下一步修复建议。

失败处理

常见失败与建议:

  • authentication missing/forbidden: 检查 UNKEY_ROOT_KEY--root-keyunkey auth login
  • api_not_foundkey_not_found: 核对 api-id/key-id 是否属于当前 workspace
  • workspace_rate_limited: 加退避重试并减少高频调用
  • invalid_analytics_query: 修复 SQL 语法,仅允许 SELECT

建议回复格式

# Unkey CLI 执行结果
- command: \x3C实际执行命令(脱敏后)>
- auth_source: \x3Cflag | env | config>
- output_mode: \x3Cdefault | json>

## Result
\x3C关键输出/对象>

## Next Step
\x3C一个可执行的后续动作>
安全使用建议
Install this only if you want the agent to help administer Unkey from your terminal. Verify the Unkey CLI source, use a least-privileged credential where possible, keep root keys redacted, and manually review commands that create, delete, or change keys, permissions, namespaces, or rate limits.
功能分析
Type: OpenClaw Skill Name: unkey-cli Version: 1.0.1 The unkey-cli skill is a legitimate tool for managing Unkey API resources, including keys, permissions, and analytics. It provides clear instructions for the agent to use the official Unkey CLI, handles authentication via standard methods (environment variables, config files, or flags), and includes safety guidelines such as masking sensitive keys and requiring confirmation for destructive actions. No evidence of malicious intent, data exfiltration, or unauthorized execution was found.
能力标签
cryptocan-make-purchasesrequires-sensitive-credentials
能力评估
Purpose & Capability
The stated purpose matches the documented capabilities: managing Unkey APIs, keys, identities, permissions, rate limits, and analytics. These are high-impact account administration actions, but they are disclosed and purpose-aligned.
Instruction Scope
The skill includes safeguards such as confirming an auth source before mutations, confirming irreversible deletes, not echoing full root keys, and not fabricating command output. It still gives the agent authority to run mutating Unkey CLI commands when user-directed.
Install Mechanism
There is no bundled code or install spec, but the instructions suggest installing the external Unkey CLI globally via npm or GitHub Releases. This is expected for a CLI helper, but users should verify the package source.
Credentials
Requiring bash, unkey, and jq is proportionate. The skill also relies on Unkey root key credentials or local CLI auth configuration, which is sensitive but necessary for the stated administration tasks.
Persistence & Privilege
No background persistence or autonomous worker is described. The notable persistent element is the normal Unkey CLI auth config at ~/.unkey/config.toml, which can contain account access material.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install unkey-cli
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /unkey-cli 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.1
No changes detected in this version. - Version 1.0.1 does not introduce any file or documentation updates.
v1.0.0
Unkey CLI Skill v1.0.0 – Initial Release - Provides Unkey CLI management for API namespaces, keys, permissions, rate limits, analytics, identities, and RBAC. - Supports command discovery via the Unkey documentation index before expanding on parameters or behaviors. - Checks for CLI installation and root key authentication source before running commands; guides installation and login if missing. - Enforces safe execution: double-confirms on destructive operations, never echoes full sensitive data, and shows real (unfaked) results only. - Outputs results in standard or JSON format as needed, following best scripting and troubleshooting practices. - Includes clear failure handling with next-step suggestions.
元数据
Slug unkey-cli
版本 1.0.1
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 2
常见问题

unkey-cli 是什么?

使用 Unkey CLI 在终端中管理 API namespaces、keys、identities、permissions、rate limits 和 analytics 查询。当用户提到 unkey 命令、API key 管理、限流、RBAC 权限、身份分组或 key 验证排查时触发。Use this ski... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 63 次。

如何安装 unkey-cli?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install unkey-cli」即可一键安装,无需额外配置。

unkey-cli 是免费的吗?

是的,unkey-cli 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

unkey-cli 支持哪些平台?

unkey-cli 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 unkey-cli?

由 kyris wu(@kyriswu)开发并维护,当前版本 v1.0.1。

💬 留言讨论