name: agentuity-cli-cloud-apikey-create description: 创建新的API密钥。需要身份验证。用于Agentuity云平台操作 version: “0.0.103” license: Apache-2.0 allowed-tools: “Bash(agentuity:*)” metadata: command: “agentuity cloud apikey create” tags: “destructive creates-resource slow requires-auth”
云平台API密钥创建
创建新的API密钥
前提条件
- 已通过
agentuity auth login完成身份验证 - 需要组织上下文(
--org-id或默认组织)
使用方法
agentuity cloud apikey create [options]
选项参数
| 选项 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
--name |
字符串 | 是 | - | API密钥的名称 |
--expires-at |
字符串 | 是 | - | 过期时间,支持ISO 8601格式(2025-12-31T23:59:59Z)或时长表示(1h, 2d, 30d, 1y) |
--confirm |
布尔值 | 是 | - | 跳过确认提示(非TTY环境必需) |
示例
创建有效期1年的API密钥:
bunx @agentuity/cli cloud apikey create --name "我的API密钥" --expires-at 1y
创建有效期30天的API密钥:
bunx @agentuity/cli cloud apikey create --name "短期密钥" --expires-at 30d
创建指定日期过期的API密钥并跳过确认:
bunx @agentuity/cli cloud apikey create --name "生产环境密钥" --expires-at 2026-01-01T00:00:00Z --confirm
输出结果
返回JSON对象:
{
"id": "string",
"value": "string"
}
| 字段 | 类型 | 描述 |
|---|---|---|
id |
字符串 | API密钥ID |
value |
字符串 | API密钥值 |