概覽
這個 endpoint 可更新既有 API Key 的名稱、額度、模型白名單、過期時間或狀態。請求主體
PATCH 請求至少需要提供一個欄位。| 欄位 | 型別 | 預設值 / 限制 | 說明 |
|---|---|---|---|
status | enum | - | active, inactive, revoked |
name | string | 長度 1-50 | 更新後的顯示名稱 |
limitAmount | number | null | 最小 0,輸入上限 1000000 | null = 不限額,0 = 零額度,正數會被規範化為一個儲存上限,且不能超過 100000 USD 等值 |
limitCurrency | 列舉 | 預設 USD | 僅限 USD。傳送 CNY 會回傳 400 currency_retired。 |
models | string[] | - | 更新後的模型白名單 |
expiresAt | string | null | RFC3339 datetime | null 表示移除過期時間 |
說明
- Management API v1 故意不支援硬刪除。
revoked通常視為終態;若需要重新使用,通常建議直接建立一把新的 Key。
範例
請求 / 回應
精確 schema 與回應欄位,請使用上方的互動式 OpenAPI 面板。Response example
Important fields
API key identifier used in follow-up Management API calls.
Display name for the API key.
Non-secret key prefix for display and support.
One of
active, inactive, or revoked.Spending cap in USD as a JSON number for display.
null means unlimited.Exact spending cap in USD as a decimal string.
null means unlimited.Accumulated usage in USD as a JSON number for display.
Exact accumulated usage in USD as a decimal string.
Per-key model allowlist. Empty array means no additional key-level model restriction.
ISO timestamp when the key expires, or
null for no expiry.ISO timestamp for the most recent use, or
null when unused.ISO creation timestamp.