更新 API Key
/v1/keys/{hash}更新当前认证用户拥有的 API Key。
hash 来自 GET /v1/key、GET /v1/keys 或 POST /v1/keys。路径参数不接受原始 API Key 字符串。
身份验证
Authorization Bearer <USER_JWT>
必须使用已登录用户 JWT。普通推理 API Key、MANAGEMENT Key 和 PROVISIONING Key 均不支持此接口。企业机器自动化请使用 Enterprise 控制面接口。
路径参数
hashstringrequiredAPI Key hash 标识。
请求体
namestring新的 API Key 名称。空白字符串会被忽略。
disabledbooleantrue 禁用 Key;false 仅在 Key 未过期时重新启用。
limitnumber | nullUSD 花费上限。发送 null 可清除已有上限。
limit_resetstring | null可选重置周期:daily / weekly / monthly,或 null 表示终身。UTC 零点重置;周为周一至周日。
响应
dataobject更新后的 API Key 信息。
data.hashstring管理接口使用的 hash 标识。
data.namestringAPI Key 名称。
data.labelstring展示标签,与 name 一致。
data.disabledboolean当 Key 状态不是 ACTIVE 或 expires_at 已过期时为 true。
data.workspace_idstringKey 所属 workspace code。
data.creator_user_idstring | null所有者用户 ID。
data.created_atstring创建时间,UTC ISO-8601 格式。
data.updated_atstring | null最后更新时间。
data.expires_atstring | nullUTC 过期时间,或 null。
data.usagenumber该 Key 累计消费金额(USD),不是赠送 Credit 余额。
data.usage_dailynumber当前 UTC 日内该 Key 的消费金额(USD)。
data.usage_weeklynumber当前 UTC 周内该 Key 的消费金额(USD),周一开始。
data.usage_monthlynumber当前 UTC 自然月内该 Key 的消费金额(USD)。
data.limitnumber | null配置的 Key 消费上限(USD);未设置时为 null。
data.limit_remainingnumber | null适用限额周期内的剩余预算(USD);未设置上限时为 null。
data.limit_resetstring | nulldaily | weekly | monthly | null(终身)。
data.is_free_tierboolean当前为 false。
data.is_management_keyboolean此响应描述推理 Key,该字段为 false。
data.is_provisioning_keyboolean当前为 false。
data.rate_limitobject每分钟请求限制信息。