# 批量创建api key - BatchCreateUMInferAPIKey

## 简介

批量创建api key




## 使用方法

您可以选择以下方式中的任意一种，发起 API 请求：
- 多语言 OpenSDK / [Go](https://github.com/ucloud/ucloud-sdk-go) / [Java](https://github.com/ucloud/ucloud-sdk-java) / [Python](https://github.com/ucloud/ucloud-sdk-python3) / [JavaScript](https://github.com/ucloud/ucloud-sdk-js) / [PHP](https://github.com/ucloud/ucloud-sdk-php) /
- [CloudShell 云命令行](https://shell.ucloud.cn/)

## 定义

### 公共参数

| 参数名 | 类型 | 描述信息 | 必填 |
|:---|:---|:---|:---|
| **Action**     | string  | 对应的 API 指令名称，当前 API 为 `BatchCreateUMInferAPIKey`                        | **Yes** |
| **PublicKey**  | string  | 用户公钥，可从 [控制台](https://console.ucloud.cn/uaccount/api_manage) 获取                                             | **Yes** |
| **Signature**  | string  | 根据公钥及 API 指令生成的用户签名，参见 [签名算法](https://docs.ucloud.cn/api/summary/signature)  | **Yes** |

### 请求参数

| 参数名 | 类型 | 描述信息 | 必填 |
|:---|:---|:---|:---|
| **Region** | string | 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) |**Yes**|
| **ProjectId** | string | 项目ID。不填写为默认项目，子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) |No|
| **Zone** | string | 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist) |**Yes**|
| **Prefix** | string | 名称前缀 |**Yes**|
| **Start** | int | 开始序号 |**Yes**|
| **Count** | int | 创建个数 |**Yes**|
| **ModelverseDisabled** | int | 是否modelverse可用 0: 启用 1: 禁用 |No|
| **SandBoxDisabled** | int | 是否沙盒可用 0: 启用 1: 禁用(astraflow 沙盒控制未上线，暂时无效) |No|
| **DailyLimitAmount** | string | 日限额，单位随用户所在渠道。126渠道单位为美元 |No|
| **MonthlyLimitAmount** | string | 月限额，单位随用户所在渠道。126渠道单位为美元 |No|
| **GrantAllModels** | boolean | 全部模型访问开关，开启不受 GrantedModels 参数控制，关闭只能访问 GrantedModels 中添加模型 |No|
| **GrantedModels** | string | 授权模型，内容为数组格式。当 GrantAllModels 为false时 当前key只可访问数组中模型。例：["deepseek-ai/DeepSeek-V3.2-Think"] |No|
| **IPWhitelist** | string | ip白名单，换行分割的多组ip。支持IPv4和网段,输入后回车生效,最多100个, 示例: ﻿ 192.168.1.1 192.168.1.10-192.168.1.100 192.168.1.10/24 |No|
| **InferenceLogEnabled** | int | 是否开启推理日志 |No|
| **TotalLimitAmount** | string | 总限额，单位随用户所在渠道。126渠道单位为美元 |No|
| **ExpireTime** | int | 过期时间（秒级 Unix 时间戳）。缺省 = -1 永不过期；必须为 -1 或未来时间，且 ≤ 253402300799（9999-12-31 23:59:59 UTC） |No|
| **ModelAccessMode** | string | 访问模式：whitelist（默认）/ blacklist |No|
| **DeniedModels** | string | 黑名单模型，仅 blacklist 模式生效，["deepseek-ai/DeepSeek-V3.2-Think"，"gemini-4-neon"] |No|
| **IPBlacklist** | string | ip黑名单，换行分割的多组ip。支持IPv4和网段,输入后回车生效,最多100个, 示例: ﻿ 192.168.1.1 192.168.1.10-192.168.1.100 192.168.1.10/24 |No|
| **DailyQuotaAlertThreshold** | int | 日配额告警阈值 0~100（百分比） |No|
| **MonthlyQuotaAlertThreshold** | int | 月配额告警阈值 0~100 |No|
| **TotalQuotaAlertThreshold** | int | 总配额告警阈值 0~100 |No|
| **QuotaAlertChannels** | string | []string；告警渠道：email / sms / phone（去重、转小写）。任一阈值 >0 时必填 |No|
| **QuotaAlertEmail** | string | 渠道含 email 时必填且需合法邮箱 |No|
| **QuotaAlertPhone** | string | 渠道含 sms/phone 时必填 |No|
| **QuotaAlertEmailVerificationToken** | string | 启用 email 渠道时必填，需先调验证码接口获取，服务端校验并一次性消费 |No|
| **QuotaAlertPhoneVerificationToken** | string | 启用 sms/phone 渠道时必填，同上 |No|

### 响应字段

| 字段名 | 类型 | 描述信息 | 必填 |
|:---|:---|:---|:---|
| **RetCode** | int | 返回状态码，为 0 则为成功返回，非 0 为失败 |**Yes**|
| **Action** | string | 操作指令名称 |**Yes**|
| **Message** | string | 返回错误消息，当 `RetCode` 非 0 时提供详细的描述信息 |No|
| **Data** | array[[*BatchCreateUMInferAPIKey*](#batchcreateuminferapikey)] | 创建的key列表 |No|

#### 数据模型

#### BatchCreateUMInferAPIKey

| 字段名 | 类型 | 描述信息 | 必填 |
|:---|:---|:---|:---|
| **KeyId** | string | KeyId |No|
| **Name** | string | 名称 |No|
| **APIKey** | string | 密钥 |No|
| **Success** | boolean | 是否成功 |No|

## 示例

### 请求示例
```
https://api.ucloud.cn/?Action=BatchCreateUMInferAPIKey
&Region=cn-zj
&Zone=cn-zj-01
&ProjectId=iXZbCebH
&Prefix=OLkgFDPC
&Start=6
&Count=5
&ModelverseDisabled=5
&SandBoxDisabled=7
&DailyLimitAmount=UgIsTmJi
&MonthlyLimitAmount=Jmacqfra
&GrantAllModels=true
&GrantedModels=fEZbqvkL
&IPWhitelist=jQJFgVUQ
&InferenceLogEnabled=8
&TotalLimitAmount=YqZWkNZP
&ExpireTime=6
&ModelAccessMode=NitlOwRH
&DeniedModels=ekgtywyG
&IPBlacklist=StDZyiCk
&DailyQuotaAlertThreshold=7
&MonthlyQuotaAlertThreshold=5
&TotalQuotaAlertThreshold=9
&QuotaAlertChannels=PxKUuAMC
&QuotaAlertEmail=ticiEuNh
&QuotaAlertPhone=LPfSovIk
&QuotaAlertEmailVerificationToken=cHkkVYxB
&QuotaAlertPhoneVerificationToken=quBgpTcD
```

### 响应示例
```json
{
  "Action": "BatchCreateUMInferAPIKeyResponse",
  "Count": 3,
  "DailyLimitAmount": "fURAcSnH",
  "GrantAllModels": false,
  "GrantedModels": "qqHMiGDb",
  "IPWhitelist": "qimWFhke",
  "ModelverseDisabled": 5,
  "MonthlyLimitAmount": "puAvkNEH",
  "Prefix": "COehxXIT",
  "RetCode": 0,
  "SandBoxDisabled": 9,
  "Start": 1
}
```
