创建 API Key

POST/v1/keys

创建新的 Token360 推理 API Key。

原始 API Key 只会在响应的 key 字段中返回一次。请安全保存;后续响应只会返回 key hash。

身份验证

Authorization Bearer

使用 Token360 API Key(sk-token360-...)或已登录用户 JWT。

请求体

namestringrequired

新 API Key 名称。

workspace_idstring

Workspace code,默认 DEFAULT。

expires_atstring | null

可选 UTC ISO-8601 过期时间,例如 2029-11-30T23:59:59Z。非 UTC offset 会被拒绝。

creator_user_idstring | null

接受但忽略。

limitnumber | null

接受但不持久化。

limit_resetstring | null

接受但不持久化。

响应

keystring

原始 API Key,仅展示一次。

dataobject

创建后的 API Key 信息。

data.hashstring

管理接口使用的 hash 标识。

data.namestring

API Key 名称。

data.labelstring

展示标签,与 name 一致。

data.disabledboolean

当 Key 状态不是 ACTIVE 或 expires_at 已过期时为 true。

data.workspace_idstring

Key 所属 workspace code。

data.creator_user_idstring | null

所有者用户 ID。

data.created_atstring

创建时间,UTC ISO-8601 格式。

data.updated_atstring | null

最后更新时间。

data.expires_atstring | null

UTC 过期时间,或 null。

data.usagenumber

Token360 credit 累计使用量(USD)。

data.usage_dailynumber

日使用量,当前为 0。

data.usage_weeklynumber

周使用量,当前为 0。

data.usage_monthlynumber

月使用量,当前为 0。

data.limitnumber | null

额度限制,当前为 null。

data.limit_remainingnumber | null

剩余额度,当前为 null。

data.limit_resetstring | null

额度重置周期,当前为 null。

data.is_free_tierboolean

当前为 false。

data.is_management_keyboolean

当前管理响应中为 true。

data.is_provisioning_keyboolean

当前为 false。

data.rate_limitobject

每分钟请求限制信息。

请求

Shell
1curl -X POST https://api.token360.ai/v1/keys \
2  -H "Authorization: Bearer sk-token360-inf-..." \
3  -H "Content-Type: application/json" \
4  -d '{
5    "name": "Analytics Service Key",
6    "workspace_id": "DEFAULT",
7    "expires_at": "2029-11-30T23:59:59Z",
8    "limit": 100,
9    "limit_reset": "weekly"
10  }'

响应

JSON
1{
2  "key": "sk-token360-inf-...",
3  "data": {
4    "hash": "f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943",
5    "name": "Analytics Service Key",
6    "label": "Analytics Service Key",
7    "disabled": false,
8    "workspace_id": "DEFAULT",
9    "creator_user_id": "42",
10    "created_at": "2026-06-04T00:00:00Z",
11    "updated_at": "2026-06-04T00:00:00Z",
12    "expires_at": "2029-11-30T23:59:59Z",
13    "usage": 0,
14    "usage_daily": 0,
15    "usage_weekly": 0,
16    "usage_monthly": 0,
17    "limit": null,
18    "limit_remaining": null,
19    "limit_reset": null,
20    "is_free_tier": false,
21    "is_management_key": true,
22    "is_provisioning_key": false,
23    "rate_limit": {
24      "interval": "minute",
25      "note": "Token-360 per-minute request limit",
26      "requests": 1000
27    }
28  }
29}
此页面对您有帮助吗?