Public API

API キーの利用上限を置換

Management key required. 使用量をリセットせず、無制限、固定、または期間ごとの利用上限を設定します。

URL の api_key_id は、モデル API キーの作成(POST /public/v1/api-keys)のレスポンスに含まれる id(ak_... 形式)です。 無効化、削除、利用上限の設定、使用量の照会に使うため保存してください。レスポンスの key(apikey-...)はモデル呼び出し用です。管理操作の認証ヘッダーには引き続き mgmt-... を指定します。

PUT
/public/v1/api-keys/{api_key_id}/allowance

Management key required. Use a Management API Key (mgmt-...) for your Team, created by a Team Owner. Requests use the Team associated with that key.

Follows Console allowance semantics. Fixed allowances count from key creation; periodic allowances use UTC calendar days, Monday-based weeks, or months. Preserves credentials, enabled state, creation time and usage. Lowering the limit below existing usage is allowed; enforcement follows the existing gateway cache and in-flight settlement behavior. Disabled, expired and archived-project keys may be updated; deleted keys return 404.

Authorization

ManagementKeyBearer
AuthorizationBearer <token>

Management key required. Send Authorization: Bearer mgmt-....

In: header

Path Parameters

api_key_id*string

The id returned by Create a model API key (POST /public/v1/api-keys). Copy the complete ak_... value into this path parameter. Use the mgmt-... management key in the authorization header; the returned key (apikey-...) is for model calls.

Match^ak_[0-9A-Za-z]{22}$

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

unlimited requires no period and zero/omitted/null amount. fixed requires a positive amount and no period. periodic requires a positive amount and daily, weekly or monthly period. Amounts retain eight fractional digits.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X PUT "https://example.com/public/v1/api-keys/ak_0123456789ABCDEFGHIJKL/allowance" \  -H "Content-Type: application/json" \  -d '{    "type": "periodic",    "period": "monthly",    "amount": {      "value": "100.00",      "currency": "usd"    }  }'
{  "object": "api_key_allowance",  "api_key_id": "ak_0123456789ABCDEFGHIJKL",  "type": "periodic",  "period": "monthly",  "amount": {    "value": "100.00000000",    "currency": "usd"  },  "request_id": "req_example"}

Last updated on