Zaktualizuj klucz API
Zaktualizuj klucz API CometAPI, wysyłając ID klucza i edytowalne pola w treści JSON.
Użyj tego endpointu, aby zaktualizować nazwę klucza API, status, limit, datę wygaśnięcia, ograniczenia modeli, listę dozwolonych adresów IP oraz ustawienia grupy.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. Nie dodawaj prefiksu Bearer.Treść żądania
| Field | Type | Description |
|---|---|---|
id | integer | Wymagane. ID klucza API zwrócone przez List API keys. |
name | string | Czytelna dla użytkownika nazwa wyświetlana klucza. Musi mieć maksymalnie 50 znaków. |
status | integer | Status operacyjny. 1 włącza klucz dla żądań modeli. 2 wyłącza go. 3 oznacza go jako wygasły. 4 oznacza wyczerpanie limitu. Klucze wyłączone, wygasłe lub z wyczerpanym limitem są odrzucane przez endpointy modeli. |
expired_time | integer | Znacznik czasu Unix w sekundach określający moment wygaśnięcia klucza. Użyj -1, aby ustawić brak wygaśnięcia. Znacznik czasu z przeszłości blokuje żądania modeli. |
remain_quota | integer | Pozostały limit w wewnętrznych jednostkach limitu CometAPI. Jeśli ta wartość osiągnie 0, a unlimited_quota ma wartość false, żądania modeli z tym kluczem będą odrzucane jako limit wyczerpany. |
unlimited_quota | boolean | Określa, czy klucz pomija sprawdzanie pozostałego limitu. Ustaw true tylko wtedy, gdy klucz ma nadal działać nawet wtedy, gdy remain_quota wynosi 0. |
model_limits_enabled | boolean | Określa, czy ograniczyć ten klucz do określonych modeli. Gdy ma wartość false, model_limits jest ignorowane. |
model_limits | string | Rozdzielona przecinkami lista model ID dozwolonych dla tego klucza, gdy model_limits_enabled ma wartość true. Używaj model ID zwróconych przez /v1/models; użyj pustego ciągu, aby nie stosować ograniczeń modeli. |
allow_ips | string or null | Opcjonalna lista dozwolonych adresów IP. Podaj jeden ciąg JSON z wpisami rozdzielonymi znakami nowej linii (\n). Każdy wpis może być pojedynczym adresem IPv4, pojedynczym adresem IPv6, zakresem IPv4 CIDR lub zakresem IPv6 CIDR. Użyj null lub "", aby wyłączyć ograniczenia IP. |
group | string | Opcjonalne ograniczenie do grupy konta. Użyj pustego ciągu, jeśli nie ma być ustawiona jawna grupa. Niepuste wartości muszą być dostępne dla konta, w przeciwnym razie API zwróci success: false. |
cross_group_retry | boolean | Określa, czy włączone jest ponawianie między grupami dla automatycznego routingu grup. Ma to znaczenie tylko wtedy, gdy klucz używa grupy z automatycznym routingiem. |
Format listy dozwolonych adresów
Aby zezwolić na wiele adresów IP lub zakresów CIDR, wyślij je jako jeden ciąg JSON z\n pomiędzy wpisami:
Autoryzacje
Personal access token copied from CometAPI Console > Personal Settings. Send the raw token value; do not prefix it with Bearer.
Treść
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