Domain name for API request: tokenhub.intl.tencentcloudapi.com.
Batch create TokenPlan API Keys.
Import a name prefix and quantity to automatically generate names in the {Api Key Name}-{serial number} format (for example, aaa-1, aaa-2). Duplicate names are allowed. Partial success is supported for up to 100 entries.
A maximum of 20 requests can be initiated per second for this API.
The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| Action | Yes | String | Common Params. The value used for this API: CreateTokenPlanApiKeys. |
| Version | Yes | String | Common Params. The value used for this API: 2026-03-22. |
| Region | Yes | String | Common Params. For more information, please see the list of regions supported by the product. |
| TeamId | Yes | String | Package ID. You can obtain it through the DescribeTokenPlanList API. |
| ApiKeyName | Yes | String | API key name, up to 128 characters. If the number of API keys created exceeds 1, the actual name format is {ApiKeyName}-{serial number} (for example, mykey-1, mykey-2). |
| Count | Yes | Integer | Number of creations. Value range: 1–10. |
| AllowedModels.N | No | Array of String | List of available models. If the package type is the enterprise edition professional package, you can specify a model or pass in "all". "all" means all models supported by the package are available for use. To specify specific models, pass in Model IDs. "all" and specific Model IDs cannot be specified at the same time. If not provided, it indicates the API Key does not support any models, thereby impacting normal use of the API Key. If the package type is the enterprise edition lite package, this field will be force overwritten to ["auto"] regardless of whether it is provided and what value is passed in. |
| ExclusiveQuota | No | Integer | Exclusive reserved quota. If not passed in, the value is 0, which means no exclusive reserved quota is assigned to the API Key. Measurement units are as follows:-Package type is professional, unit value is points; -Package type is lite package, and the measurement unit is token. |
| TotalQuota | No | Integer | Total credit limit. -1 means unlimited. It must be -1 or greater than or equal to the current ExclusiveQuota of the API Key. If not passed, no upper limit is set. The units are as follows: -Package type is professional, unit value is points; -Package type is lite package, and the measurement unit is token. |
| TPM | No | Integer | TPM (Tokens Per Minute) limit. If not passed, the plan-level TPM is used. Must be >= 0 and <= the package TPM. |
| Parameter Name | Type | Description |
|---|---|---|
| Items | Array of CreateApiKeysResultItem | Item list of successful creation. |
| FailedItems | Array of BatchCreateFailedItem | Item list that failed to be created. |
| RequestId | String | The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. |
POST / HTTP/1.1
Host: tokenhub.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateTokenPlanApiKeys
<Common request parameters>
{
"TeamId": "team-3a834f2dbcf48840115cbf4b48f25342",
"ApiKeyName": "syytest-1",
"Count": 2,
"AllowedModels": [
"glm-5"
]
}
{
"Response": {
"Items": [
{
"ApiKeyId": "ak-tp-20260412-b2ddcfeb599f8345cb7ad22c370b1acd"
},
{
"ApiKeyId": "ak-tp-20260412-c727346e6086cc5c5594b40786957aa1"
}
],
"RequestId": "2c146814-7ca2-494b-8d09-2f4cc6cef3a2"
}
}
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
| Error Code | Description |
|---|---|
| InternalError.InternalError | InternalError.InternalError |
| InvalidParameter.InvalidParameter | InvalidParameter.InvalidParameter |
| InvalidParameterValue.InvalidParameterValue | InvalidParameterValue.InvalidParameterValue |
| MissingParameter.MissingParameter | MissingParameter.MissingParameter |
| OperationDenied | Operation denied. |
| ResourceNotFound | The resource does not exist. |
| UnauthorizedOperation.UnauthorizedOperation | UnauthorizedOperation.UnauthorizedOperation |
Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
masukan