> For the complete documentation index, see [llms.txt](https://docs.console.zenlayer.com/api-reference/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.console.zenlayer.com/api-reference/cn/compute/zec/instance/inquirypricecreateinstance.md).

# InquiryPriceCreateInstance

## 1. 接口描述

本接口(InquiryPriceCreateInstance)用于创建虚拟机实例询价。

* 查询 GPU 实例询价时，`instanceType` 请传入[`DescribeZoneGpuInstanceConfigInfos`](https://github.com/zenlayer/zenlayercloud-api-doc-cn/blob/main/zec/instance/describezoneGpuinstanceconfiginfos.md)返回的 `instanceType` 字段。此时返回结果中 `gpuPrice` 为 GPU 规格费用，`specPrice` 为空。
* 查询普通实例询价时，`instanceType` 请传入[`DescribeZoneInstanceConfigInfos`](/api-reference/cn/compute/zec/instance/describezoneinstanceconfiginfos.md)返回的 `instanceType` 字段。此时返回结果中 `specPrice` 为规格费用，`gpuPrice` 为空。
* 保底流量包大小仅对计费周期为月有效。

## 2. 请求参数

以下请求参数列表仅列出了接口中需要的请求参数

| 参数名称               | 必选 | 类型                                                                                      | 描述                                                                                                                                                                                                                                                                                                 |
| ------------------ | -- | --------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| zoneId             | 是  | String                                                                                  | 可用区ID。                                                                                                                                                                                                                                                                                             |
| instanceType       | 是  | String                                                                                  | 实例机型。普通实例取值可通过[DescribeZoneInstanceConfigInfos](/api-reference/cn/compute/zec/instance/describezoneinstanceconfiginfos.md)获得；GPU 实例取值可通过[DescribeZoneGpuInstanceConfigInfos](https://github.com/zenlayer/zenlayercloud-api-doc-cn/blob/main/zec/instance/describezoneGpuinstanceconfiginfos.md)获得。 |
| instanceCount      | 是  | Integer                                                                                 | <p>实例数量。</p><p>可选值范围：\[1, 100]</p><p>默认值：1</p>                                                                                                                                                                                                                                                     |
| systemDisk         | 是  | [SystemDisk](/api-reference/cn/compute/zec/datastructure.md#systemdisk)                 | 系统盘相关信息。                                                                                                                                                                                                                                                                                           |
| eipV4Type \[已废弃]   | 否  | [EipNetworkType](/api-reference/cn/compute/zec/datastructure.md#eipnetworktype)         | <p>公网IPv4的线路类型。</p><p>已废弃，请使用<code>networkLineType</code>。</p>                                                                                                                                                                                                                                     |
| networkLineType    | 否  | [NetworkLineType](/api-reference/cn/compute/zec/datastructure.md#networklinetype)       | 公网IPv4的线路类型。当`internetChargeType`有值时必填。                                                                                                                                                                                                                                                            |
| internetChargeType | 否  | [InternetChargeType](/api-reference/cn/compute/zec/datastructure.md#internetchargetype) | 公网IP的网络计费类型。如果不指定，则不会询价公网IP。                                                                                                                                                                                                                                                                       |
| trafficPackageSize | 否  | Float                                                                                   | <p>流量包订购大小。</p><p>单位为TB。</p><p>该值必须在<code>internetChargeType = ByTrafficPackage</code>时才会生效。</p><p>可选值范围：\[0.0, +)</p>                                                                                                                                                                             |
| bandwidth          | 否  | Integer                                                                                 | <p>公网出带宽上限。</p><p>单位：Mbps。</p><p>可选值范围：\[1, +)</p>                                                                                                                                                                                                                                                 |
| dataDisk           | 否  | [DataDisk](/api-reference/cn/compute/zec/datastructure.md#datadisk)                     | 数据盘相关信息。                                                                                                                                                                                                                                                                                           |

## 3. 响应结果

| 参数名称                | 类型                                                                                                               | 描述                                                                                                                             |
| ------------------- | ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| requestId           | String                                                                                                           | <p>唯一请求 ID。</p><p>每次请求都会返回。定位问题时需要提供该次请求的 requestId。</p>                                                                       |
| specPrice           | [PriceItem](/api-reference/cn/compute/zec/datastructure.md#priceitem)                                            | 规格的价格。                                                                                                                         |
| gpuPrice            | [PriceItem](/api-reference/cn/compute/zec/datastructure.md#priceitem)                                            | GPU规格的价格。                                                                                                                      |
| ipv4Price           | [PriceItem](/api-reference/cn/compute/zec/datastructure.md#priceitem)                                            | 公网IPv4的保留价格。仅当`internetChargeType`有值时返回。                                                                                       |
| ipv4BandwidthPrice  | [PriceItem](/api-reference/cn/compute/zec/datastructure.md#priceitem)                                            | 公网IPv4的带宽价格。仅当`internetChargeType`有值时返回。                                                                                       |
| ipv4BandwidthPrices | Array of [BandwidthPriceResponseItem](/api-reference/cn/compute/zec/datastructure.md#bandwidthpriceresponseitem) | 各流量方向的IPv4带宽价格明细。仅当`internetChargeType`有值时返回。PathBasedBandwidthIP 线路返回多项（ipv4BandwidthPrice 为 null）；其他线路返回单项（trafficType=ALL）。 |
| ipv6Price           | [PriceItem](/api-reference/cn/compute/zec/datastructure.md#priceitem)                                            | 公网IPv6的价格。仅当`internetChargeType`有值时返回。                                                                                         |
| ipv6BandwidthPrice  | [PriceItem](/api-reference/cn/compute/zec/datastructure.md#priceitem)                                            | 公网IPv6的带宽价格。仅当`internetChargeType`有值时返回。                                                                                       |
| systemDiskPrice     | [PriceItem](/api-reference/cn/compute/zec/datastructure.md#priceitem)                                            | 系统盘的价格。                                                                                                                        |
| dataDiskPrice       | [PriceItem](/api-reference/cn/compute/zec/datastructure.md#priceitem)                                            | 数据盘的价格。                                                                                                                        |

## 4. 代码示例

{% tabs %}
{% tab title="示例" %}
**1. 查询实例的询价（无公网IP）。**

```json
POST /api/v2/zec HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: InquiryPriceCreateInstance
<Common Request Params>

Request：
{
  "zoneId":"asia-east-1a",
  "instanceType":"z2a.cpu.1",
  "instanceCount": 1,
  "systemDisk":{"diskSize":10}
}

Response：
{
  "response":{
      "specPrice": {"discount": 95.0,"discountPrice": 1444.0,"originalPrice": 1520.0,"unitPrice": null,"discountUnitPrice": null,"chargeUnit": null,"stepPrices": null},
      "gpuPrice": null,"ipv4Price": null,"ipv4BandwidthPrice": null,"ipv4BandwidthPrices": null,
      "ipv6Price": null,"ipv6BandwidthPrice": null,
      "systemDiskPrice": {"discount": 95.0,"discountPrice": 1444.0,"originalPrice": 1520.0,"unitPrice": null,"discountUnitPrice": null,"chargeUnit": null,"stepPrices": null},
      "dataDiskPrice": null
  }
}
```

**2. 查询实例的询价（PremiumBGP 线路，按带宽计费）。**

```json
POST /api/v2/zec HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: InquiryPriceCreateInstance
<Common Request Params>

Request：
{"zoneId":"asia-east-1a","instanceType":"z2a.cpu.1","networkLineType":"PremiumBGP","internetChargeType":"ByBandwidth","bandwidth":1,"instanceCount":1,"systemDisk":{"diskSize":10}}

Response：
{
  "response":{
      "specPrice": {"discount": 95.0,"discountPrice": 1444.0,"originalPrice": 1520.0,"unitPrice": null,"discountUnitPrice": null,"chargeUnit": null,"stepPrices": null},
      "gpuPrice": null,
      "ipv4Price": {"discount": 100,"discountPrice": null,"originalPrice": null,"unitPrice": 0.076389,"discountUnitPrice": 0.076389,"chargeUnit": "HOUR","stepPrices": null},
      "ipv4BandwidthPrice": {"discount": 100,"discountPrice": null,"originalPrice": null,"unitPrice": 0.061112,"discountUnitPrice": 0.061112,"chargeUnit": "HOUR","stepPrices": null},
      "ipv4BandwidthPrices": [{"trafficType":"ALL","price":{"discount":100,"discountPrice":null,"originalPrice":null,"unitPrice":0.061112,"discountUnitPrice":0.061112,"chargeUnit":"HOUR","stepPrices":null}}],
      "ipv6Price": null,"ipv6BandwidthPrice": null,
      "systemDiskPrice": {"discount": 95.0,"discountPrice": 1444.0,"originalPrice": 1520.0,"unitPrice": null,"discountUnitPrice": null,"chargeUnit": null,"stepPrices": null},
      "dataDiskPrice": null
  }
}
```

**3. 查询实例的询价（PathBasedBandwidthIP 线路，按带宽计费）。ipv4BandwidthPrice 为 null，带宽明细见 ipv4BandwidthPrices。**

```json
POST /api/v2/zec HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: InquiryPriceCreateInstance
<Common Request Params>

Request：
{"zoneId":"SEA-A","instanceType":"c.1c2g","networkLineType":"PathBasedBandwidthIP","internetChargeType":"ByBandwidth","bandwidth":1,"instanceCount":1,"systemDisk":{"diskSize":10}}

Response：
{
  "response":{
      "specPrice": {"discount": 95.0,"discountPrice": 1444.0,"originalPrice": 1520.0,"unitPrice": null,"discountUnitPrice": null,"chargeUnit": null,"stepPrices": null},
      "gpuPrice": null,
      "ipv4Price": {"discount": 100,"discountPrice": null,"originalPrice": null,"unitPrice": 0.076389,"discountUnitPrice": 0.076389,"chargeUnit": "HOUR","stepPrices": null},
      "ipv4BandwidthPrice": null,
      "ipv4BandwidthPrices": [
          {"trafficType":"LOCAL","price":{"discount":100,"discountPrice":null,"originalPrice":null,"unitPrice":0.042000,"discountUnitPrice":0.042000,"chargeUnit":"HOUR","stepPrices":null}},
          {"trafficType":"INTERNATIONAL","price":{"discount":100,"discountPrice":null,"originalPrice":null,"unitPrice":0.088000,"discountUnitPrice":0.088000,"chargeUnit":"HOUR","stepPrices":null}}
      ],
      "ipv6Price": null,"ipv6BandwidthPrice": null,
      "systemDiskPrice": {"discount": 95.0,"discountPrice": 1444.0,"originalPrice": 1520.0,"unitPrice": null,"discountUnitPrice": null,"chargeUnit": null,"stepPrices": null},
      "dataDiskPrice": null
  }
}
```

{% endtab %}
{% endtabs %}

## 5. 开发者工具

Zenlayer Cloud API 2.0 提供了配套的[开发工具集（SDK）](/api-reference/cn/api-introduction/toolkit.md)，未来会陆续支持更多开发语言，方便快速接入和使用Zenlayer的产品和服务。

## 6. 错误码

下面包含业务逻辑中遇到的错误码，其他错误码见[公共错误码](/api-reference/cn/api-introduction/instruction/commonerrorcode.md)

| HTTP状态码 | 错误码                                                            | 说明                        |
| ------- | -------------------------------------------------------------- | ------------------------- |
| 400     | INVALID\_DISK\_CATEGORY\_TYPE                                  | 云盘的类型不合法。                 |
| 404     | INVALID\_INSTANCE\_TYPE\_NOT\_FOUND                            | 实例规格不存在。                  |
| 404     | INVALID\_ZONE\_NOT\_FOUND                                      | 可用区不存在。                   |
| 400     | OPERATION\_DENIED\_EIP\_UNSUPPORTED\_NETWORK\_TYPE             | EIP网络计费方式不支持。             |
| 400     | OPERATION\_DENIED\_FLOW\_PACKAGE\_NOT\_SUPPORTED\_HOUR\_PERIOD | 当前产品周期为小时计费，不支持设置保底流量包大小。 |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.console.zenlayer.com/api-reference/cn/compute/zec/instance/inquirypricecreateinstance.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
