API キーを更新する
JSON ボディでキー ID と編集可能なフィールドを送信して、CometAPI の API キーを更新します。
このエンドポイントを使用して、API キーの名前、ステータス、quota、有効期限、モデル制限、IP 許可リスト、グループ設定を更新します。Documentation Index
Fetch the complete documentation index at: https://apidoc.cometapi.com/llms.txt
Use this file to discover all available pages before exploring further.
Authorization ヘッダー値として送信してください。Bearer を先頭に付けないでください。リクエストボディ
| Field | Type | Description |
|---|---|---|
id | integer | 必須。API キーを一覧表示 で返される API キー ID。 |
name | string | キーのユーザー向け表示名。50 文字以下である必要があります。 |
status | integer | 動作ステータス。1 は model リクエスト用にキーを有効化します。2 は無効化します。3 は期限切れとして扱います。4 は quota 枯渇として扱います。無効、期限切れ、または枯渇したキーは model エンドポイントで拒否されます。 |
expired_time | integer | キーの有効期限となる秒単位の Unix タイムスタンプ。期限なしの場合は -1 を使用します。過去のタイムスタンプでは model リクエストがブロックされます。 |
remain_quota | integer | CometAPI の内部 quota 単位での残り quota。これが 0 に達し、かつ unlimited_quota が false の場合、このキーでの model リクエストは quota 枯渇として拒否されます。 |
unlimited_quota | boolean | このキーが残り quota のチェックをバイパスするかどうか。remain_quota が 0 でもキーを継続して動作させる必要がある場合にのみ true を設定してください。 |
model_limits_enabled | boolean | このキーを特定のモデルに制限するかどうか。false の場合、model_limits は無視されます。 |
model_limits | string | model_limits_enabled が true のときにこのキーで許可される model ID のカンマ区切り文字列。/v1/models が返す model ID を使用してください。モデル制限なしの場合は空文字列を使用します。 |
allow_ips | string or null | 任意の IP 許可リスト。改行文字 (\n) でエントリを区切った 1 つの JSON 文字列を指定します。各エントリには、単一の IPv4 アドレス、単一の IPv6 アドレス、IPv4 CIDR、または IPv6 CIDR を指定できます。IP 制限を無効にするには null または "" を使用します。 |
group | string | 任意のアカウントグループ制限。明示的なグループを指定しない場合は空文字列を使用します。空でない値はアカウントで利用可能である必要があり、そうでない場合 API は success: false を返します。 |
cross_group_retry | boolean | 自動グループルーティングのためのクロスグループ再試行が有効かどうか。これはキーが自動ルーティングされるグループを使用している場合にのみ意味があります。 |
許可リストの形式
複数の IP または CIDR 範囲を許可するには、各エントリの間に\n を入れた 1 つの JSON 文字列として送信します。
承認
Personal access token copied from CometAPI Console > Personal Settings. Send the raw token value; do not prefix it with Bearer.
ボディ
Numeric API key ID returned by the list endpoint. For updates, send this value in the JSON body, not in the URL.
1234
User-readable display name for the API key. The backend accepts up to 50 Unicode characters; longer names return success: false with token name is too long.
50"production"
Operational status for the key. 1 enables the key for model requests, 2 disables it, 3 marks it expired, and 4 marks it quota exhausted. Disabled, expired, or exhausted keys are rejected by model endpoints.
1, 2, 3, 4 1
Unix timestamp in seconds when the key expires. Use -1 for no expiration. A past timestamp blocks model requests with this key.
-1
Remaining quota to assign to the key in CometAPI internal quota units. If this reaches 0 while unlimited_quota is false, model requests with this key are rejected as quota exhausted.
100000
Whether the key bypasses remaining-quota checks. Set true only when the key should keep working even if remain_quota is 0.
false
Whether to restrict this key to specific models. When true, only model IDs listed in model_limits are allowed. When false, model_limits is ignored.
false
Comma-separated model IDs allowed by this key when model_limits_enabled is true. Use model IDs returned by /v1/models, for example <model-id-1>,<model-id-2>. Use an empty string for no model restriction.
""
Optional IP allowlist. Provide one JSON string with entries separated by newline characters (\n). Each entry can be a single IPv4 address, single IPv6 address, IPv4 CIDR, or IPv6 CIDR. Example for three allowlist entries: 198.51.100.10\n203.0.113.0/24\n2001:db8::/32. CometAPI compares the model request client IP to this list. Use null or "" to disable IP restrictions.
"198.51.100.10\n203.0.113.0/24\n2001:db8::/32"
Optional account group restriction. Use an empty string for no explicit group restriction. Non-empty values must be available to the account, or the API returns success: false with a no access to group message.
""
Whether cross-group retry is enabled for automatic group routing. This is only meaningful when the key uses an auto-routed group such as auto.
false