Todos os produtos
Search
Central de documentação

:ALIYUN::Bailian::ApiKey

Última atualização: Jul 20, 2026

O recurso ALIYUN::Bailian::ApiKey cria uma chave de API do Bailian.

Sintaxe

{
  "Type": "ALIYUN::Bailian::ApiKey",
  "Properties": {
    "AuthSetModel": Map,
    "Description": String
  }
}

Propriedades

Propriedade

Tipo

Obrigatória

Permite atualização

Descrição

Restrições

AuthSetModel

Map

Não

Não

Modelo de autenticação desta chave de API.

Para obter mais informações, consulte AuthSetModel properties.

Description

String

Não

Não

Descrição da chave de API.

Nenhuma

Sintaxe de AuthSetModel

"AuthSetModel": {
  "AccessIps": List,
  "AuthSetMode": String
}

Propriedades de AuthSetModel

Propriedade

Tipo

Obrigatória

Permite atualização

Descrição

Restrições

AccessIps

List

Não

Não

Endereços IP permitidos para acesso.

Nenhuma

AuthSetMode

String

Não

Não

Modo do método de autenticação.

Valores válidos:

  • Custom

  • All

Valores de retorno

Fn::GetAtt

  • ApiKeyId: ID da chave de API.

  • Key: valor da chave de API.

Exemplos

Cenário 1: Crie uma chave de API do Bailian

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: 创建百炼API-KEY,用于调用通义千问等大模型API。
  en: Create a Bailian API key for calling large model APIs such as Qwen.
Parameters:
  ApiKeyDescription:
    Type: String
    Label:
      zh-cn: API-KEY描述
      en: API Key Description
    Description:
      zh-cn: API-KEY的描述信息,便于识别用途,1~128个字符。
      en: The description of the API key for identification, 1-128 characters.
    Default: 百炼平台大模型API-KEY
Resources:
  BailianApiKey:
    Type: ALIYUN::Bailian::ApiKey
    Properties:
      Description:
        Ref: ApiKeyDescription
Outputs:
  ApiKeyId:
    Label:
      zh-cn: API-KEY ID
      en: API Key ID
    Description:
      zh-cn: 创建的API-KEY唯一标识ID。
      en: The unique ID of the created API key.
    Value:
      Fn::GetAtt:
        - BailianApiKey
        - ApiKeyId
  ApiKey:
    Label:
      zh-cn: API-KEY
      en: API Key
    Description:
      zh-cn: 创建的API-KEY值,用于调用百炼大模型API,请妥善保管。
      en: The value of the created API key for calling Bailian model APIs. Keep it safe.
    Value:
      Fn::GetAtt:
        - BailianApiKey
        - Key
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "创建百炼API-KEY,用于调用通义千问等大模型API。",
    "en": "Create a Bailian API key for calling large model APIs such as Qwen."
  },
  "Parameters": {
    "ApiKeyDescription": {
      "Type": "String",
      "Label": {
        "zh-cn": "API-KEY描述",
        "en": "API Key Description"
      },
      "Description": {
        "zh-cn": "API-KEY的描述信息,便于识别用途,1~128个字符。",
        "en": "The description of the API key for identification, 1-128 characters."
      },
      "Default": "百炼平台大模型API-KEY"
    }
  },
  "Resources": {
    "BailianApiKey": {
      "Type": "ALIYUN::Bailian::ApiKey",
      "Properties": {
        "Description": {
          "Ref": "ApiKeyDescription"
        }
      }
    }
  },
  "Outputs": {
    "ApiKeyId": {
      "Label": {
        "zh-cn": "API-KEY ID",
        "en": "API Key ID"
      },
      "Description": {
        "zh-cn": "创建的API-KEY唯一标识ID。",
        "en": "The unique ID of the created API key."
      },
      "Value": {
        "Fn::GetAtt": [
          "BailianApiKey",
          "ApiKeyId"
        ]
      }
    },
    "ApiKey": {
      "Label": {
        "zh-cn": "API-KEY",
        "en": "API Key"
      },
      "Description": {
        "zh-cn": "创建的API-KEY值,用于调用百炼大模型API,请妥善保管。",
        "en": "The value of the created API key for calling Bailian model APIs. Keep it safe."
      },
      "Value": {
        "Fn::GetAtt": [
          "BailianApiKey",
          "Key"
        ]
      }
    }
  }
}

Cenário 2: Crie uma chave de API do Bailian e configure uma lista de permissões de IP para restringir chamadas à API de modelos a endereços específicos

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: 创建百炼API-KEY并配置IP访问白名单,限制仅指定IP可调用大模型API。
  en: Create a Bailian API key with an IP whitelist to restrict model API access.
Parameters:
  ApiKeyDescription:
    Type: String
    Label:
      zh-cn: API-KEY描述
      en: API Key Description
    Description:
      zh-cn: API-KEY的描述信息,便于识别用途,1~128个字符。
      en: The description of the API key for identification, 1-128 characters.
    Default: 百炼平台大模型API-KEY(IP白名单)
  AuthSetMode:
    Type: String
    Label:
      zh-cn: 访问控制模式
      en: Access Control Mode
    Description:
      zh-cn: >-
        API-KEY的访问控制模式。
        Custom:仅白名单内IP可调用;All:不限制IP。
      en: >-
        The access control mode of the API key.
        Custom: only whitelisted IPs can call; All: no IP restriction.
    Default: Custom
    AllowedValues:
      - Custom
      - All
  AccessIps:
    Type: Json
    Label:
      zh-cn: IP访问白名单
      en: IP Access Whitelist
    Description:
      zh-cn: >-
        允许调用该API-KEY的IP地址或CIDR段列表。
        访问控制模式为Custom时生效,默认0.0.0.0/0表示允许所有IP,请按需收敛。
      en: >-
        The IP addresses or CIDR blocks allowed to call this API key.
        Effective when the access control mode is Custom.
        Default 0.0.0.0/0 allows all IPs; narrow it down as needed.
    Default: ["0.0.0.0/0"]
    AssociationProperty: List[Parameter]
    AssociationPropertyMetadata:
      Parameter:
        Type: String
        Required: true
        Label:
          zh-cn: IP地址
          en: IP Address
Resources:
  BailianApiKey:
    Type: ALIYUN::Bailian::ApiKey
    Properties:
      Description:
        Ref: ApiKeyDescription
      AuthSetModel:
        AuthSetMode:
          Ref: AuthSetMode
        AccessIps:
          Ref: AccessIps
Outputs:
  ApiKeyId:
    Label:
      zh-cn: API-KEY ID
      en: API Key ID
    Description:
      zh-cn: 创建的API-KEY唯一标识ID。
      en: The unique ID of the created API key.
    Value:
      Fn::GetAtt:
        - BailianApiKey
        - ApiKeyId
  ApiKey:
    Label:
      zh-cn: API-KEY
      en: API Key
    Description:
      zh-cn: 创建的API-KEY值,用于调用百炼大模型API,请妥善保管。
      en: The value of the created API key for calling Bailian model APIs. Keep it safe.
    Value:
      Fn::GetAtt:
        - BailianApiKey
        - Key
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "创建百炼API-KEY并配置IP访问白名单,限制仅指定IP可调用大模型API。",
    "en": "Create a Bailian API key with an IP whitelist to restrict model API access."
  },
  "Parameters": {
    "ApiKeyDescription": {
      "Type": "String",
      "Label": {
        "zh-cn": "API-KEY描述",
        "en": "API Key Description"
      },
      "Description": {
        "zh-cn": "API-KEY的描述信息,便于识别用途,1~128个字符。",
        "en": "The description of the API key for identification, 1-128 characters."
      },
      "Default": "百炼平台大模型API-KEY(IP白名单)"
    },
    "AuthSetMode": {
      "Type": "String",
      "Label": {
        "zh-cn": "访问控制模式",
        "en": "Access Control Mode"
      },
      "Description": {
        "zh-cn": "API-KEY的访问控制模式。Custom:仅白名单内IP可调用;All:不限制IP。",
        "en": "The access control mode of the API key. Custom: only whitelisted IPs can call; All: no IP restriction."
      },
      "Default": "Custom",
      "AllowedValues": [
        "Custom",
        "All"
      ]
    },
    "AccessIps": {
      "Type": "Json",
      "Label": {
        "zh-cn": "IP访问白名单",
        "en": "IP Access Whitelist"
      },
      "Description": {
        "zh-cn": "允许调用该API-KEY的IP地址或CIDR段列表。访问控制模式为Custom时生效,默认0.0.0.0/0表示允许所有IP,请按需收敛。",
        "en": "The IP addresses or CIDR blocks allowed to call this API key. Effective when the access control mode is Custom. Default 0.0.0.0/0 allows all IPs; narrow it down as needed."
      },
      "Default": [
        "0.0.0.0/0"
      ],
      "AssociationProperty": "List[Parameter]",
      "AssociationPropertyMetadata": {
        "Parameter": {
          "Type": "String",
          "Required": true,
          "Label": {
            "zh-cn": "IP地址",
            "en": "IP Address"
          }
        }
      }
    }
  },
  "Resources": {
    "BailianApiKey": {
      "Type": "ALIYUN::Bailian::ApiKey",
      "Properties": {
        "Description": {
          "Ref": "ApiKeyDescription"
        },
        "AuthSetModel": {
          "AuthSetMode": {
            "Ref": "AuthSetMode"
          },
          "AccessIps": {
            "Ref": "AccessIps"
          }
        }
      }
    }
  },
  "Outputs": {
    "ApiKeyId": {
      "Label": {
        "zh-cn": "API-KEY ID",
        "en": "API Key ID"
      },
      "Description": {
        "zh-cn": "创建的API-KEY唯一标识ID。",
        "en": "The unique ID of the created API key."
      },
      "Value": {
        "Fn::GetAtt": [
          "BailianApiKey",
          "ApiKeyId"
        ]
      }
    },
    "ApiKey": {
      "Label": {
        "zh-cn": "API-KEY",
        "en": "API Key"
      },
      "Description": {
        "zh-cn": "创建的API-KEY值,用于调用百炼大模型API,请妥善保管。",
        "en": "The value of the created API key for calling Bailian model APIs. Keep it safe."
      },
      "Value": {
        "Fn::GetAtt": [
          "BailianApiKey",
          "Key"
        ]
      }
    }
  }
}