Einen API-Schlüssel aktualisieren
Aktualisieren Sie einen CometAPI-API-Schlüssel, indem Sie die Schlüssel-ID und bearbeitbare Felder im JSON-Body senden.
Verwenden Sie diesen Endpoint, um den Namen, Status, das Kontingent, den Ablauf, Modellbeschränkungen, die IP-Allowlist und die Gruppeneinstellungen eines API-Schlüssels zu aktualisieren.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. Stellen Sie ihm nicht Bearer voran.Request body
| Field | Type | Description |
|---|---|---|
id | integer | Erforderlich. API-Schlüssel-ID, die von List API keys zurückgegeben wird. |
name | string | Benutzerlesbarer Anzeigename für den Schlüssel. Darf höchstens 50 Zeichen lang sein. |
status | integer | Betriebsstatus. 1 aktiviert den Schlüssel für Modellanfragen. 2 deaktiviert ihn. 3 markiert ihn als abgelaufen. 4 markiert ihn als Kontingent ausgeschöpft. Deaktivierte, abgelaufene oder ausgeschöpfte Schlüssel werden von Modell-Endpoints abgelehnt. |
expired_time | integer | Unix-Zeitstempel in Sekunden, zu dem der Schlüssel abläuft. Verwenden Sie -1 für kein Ablaufdatum. Ein Zeitstempel in der Vergangenheit blockiert Modellanfragen. |
remain_quota | integer | Verbleibendes Kontingent in internen Kontingenteinheiten von CometAPI. Wenn dieser Wert 0 erreicht und unlimited_quota false ist, werden Modellanfragen mit diesem Schlüssel als Kontingent ausgeschöpft abgelehnt. |
unlimited_quota | boolean | Ob der Schlüssel Prüfungen des verbleibenden Kontingents umgeht. Setzen Sie true nur, wenn der Schlüssel weiter funktionieren soll, selbst wenn remain_quota 0 ist. |
model_limits_enabled | boolean | Ob dieser Schlüssel auf bestimmte Modelle beschränkt werden soll. Wenn false, wird model_limits ignoriert. |
model_limits | string | Kommagetrennte model IDs, die für diesen Schlüssel erlaubt sind, wenn model_limits_enabled true ist. Verwenden Sie model IDs, die von /v1/models zurückgegeben werden; verwenden Sie einen leeren String für keine Modellbeschränkung. |
allow_ips | string or null | Optionale IP-Allowlist. Geben Sie einen JSON-String an, bei dem Einträge durch Zeilenumbruchzeichen (\n) getrennt sind. Jeder Eintrag kann eine einzelne IPv4-Adresse, eine einzelne IPv6-Adresse, ein IPv4-CIDR oder ein IPv6-CIDR sein. Verwenden Sie null oder "", um IP-Beschränkungen zu deaktivieren. |
group | string | Optionale Einschränkung auf eine Kontogruppe. Verwenden Sie einen leeren String, wenn keine explizite Gruppe verwendet werden soll. Nicht-leere Werte müssen für das Konto verfügbar sein, sonst gibt die API success: false zurück. |
cross_group_retry | boolean | Ob ein gruppenübergreifender Retry für das automatische Gruppen-Routing aktiviert ist. Das ist nur relevant, wenn der Schlüssel eine automatisch geroutete Gruppe verwendet. |
Allowlist-Format
Um mehrere IPs oder CIDR-Bereiche zuzulassen, senden Sie sie als einen JSON-String mit\n zwischen den Einträgen:
Autorisierungen
Personal access token copied from CometAPI Console > Personal Settings. Send the raw token value; do not prefix it with Bearer.
Body
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