> ## Documentation Index
> Fetch the complete documentation index at: https://ppio.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 创建 GPU 实例

## 请求头

<ParamField header="Content-Type" type="string" required={true}>
  枚举值：application/json。
</ParamField>

<ParamField header="Authorization" type="string" required={true}>
  Bearer 身份验证格式，例如：Bearer \{\{API 密钥}}。
</ParamField>

## 请求体

<ParamField body="name" type="string" required={false}>
  实例名称。字符串，长度限制：0-255 字符。
</ParamField>

<ParamField body="productId" type="string" required={true}>
  GPU 产品 ID。字符串，长度限制：1-255 字符。可以调用[获取 GPU 产品列表接口](/gpus/reference-list-gpu-products)查询。
</ParamField>

<ParamField body="gpuNum" type="integer" required={true}>
  GPU 数量。整数，取值范围：\[1, 8]。
</ParamField>

<ParamField body="rootfsSize" type="integer" required={true}>
  系统盘大小。整数，取值范围：\[10, 6144]。最小值小于 10 GB 时，系统会默认设置为 10GB。最大值上限受可用存储资源限制动态变化，可通过产品列表接口查询。
</ParamField>

<ParamField body="imageUrl" type="string" required={true}>
  镜像地址。字符串，长度限制：1-500 字符。
</ParamField>

<ParamField body="imageAuth" type="string" required={false}>
  镜像认证(username:password)。字符串，长度限制：0-10239 字符。
</ParamField>

<ParamField body="imageAuthId" type="string" required={false}>
  镜像仓库认证ID。
</ParamField>

<ParamField body="ports" type="string" required={false}>
  实例开放端口，示例: 80/http, 3306/tcp。支持的端口号范围：\[1-65535]，其中 2222, 2223, 2224 为内部端口，不可使用。支持的端口类型为 \[tcp、http]。ports + tools 最多使用 15 个端口。
</ParamField>

<ParamField body="envs" type="object[]" required={false}>
  实例环境变量。最多创建 100 组环境变量。

  <Expandable title="properties" defaultOpen={false}>
    <ParamField body="key" type="string" required={false}>
      环境变量名。字符串，长度限制：0-511 字符。
    </ParamField>

    <ParamField body="value" type="string" required={false}>
      环境变量值。字符串，长度限制：0-4095 字符。
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="tools" type="object[]" required={false}>
  是否开启官方镜像支持工具。目前部分官方镜像仅包含 Jupyter。ports + tools 最多使用 15 个端口。

  <Expandable title="properties" defaultOpen={false}>
    <ParamField body="name" type="string" required={false}>
      工具名称。取值范围：\[Jupyter]。
    </ParamField>

    <ParamField body="port" type="string" required={false}>
      工具使用端口。支持的端口号范围：\[1-65535]，其中 2222, 2223, 2224 为内部端口，不可使用。
    </ParamField>

    <ParamField body="type" type="string" required={false}>
      工具使用端口类型。支持的端口类型为 \[tcp、http]。
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="command" type="string" required={false}>
  实例启动命令。字符串，长度限制：0-2047 字符。
</ParamField>

<ParamField body="entrypoint" type="string" required={false}>
  实例启动 entrypoint。该配置会覆盖 Docker 镜像的 ENTRYPOINT。字符串，长度限制：0-2047 字符。
</ParamField>

<ParamField body="clusterId" type="string" required={false}>
  指定集群 ID 创建实例，填空值则随机在一个集群创建实例。
</ParamField>

<ParamField body="networkStorages" type="object[]" required={false}>
  云挂载配置。最多支持挂载 30 个云存储。

  <Expandable title="properties" defaultOpen={false}>
    <ParamField body="Id" type="string" required={false}>
      网络存储ID。
    </ParamField>

    <ParamField body="mountPoint" type="string" required={false}>
      网络存储挂载路径，默认值："/network"。字符串，长度限制：1-4095 字符。
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="networkId" type="string" required={false}>
  vpc网络ID，不使用 vpc 网络则填空值。
</ParamField>

<ParamField body="kind" type="string" required={true}>
  实例类型。取值范围：\[gpu、cpu]。
</ParamField>

<ParamField body="month" type="integer" required={false}>
  包年包月实例月份，填 0 则创建按量付费实例。整数，取值范围：大于等于 0。
</ParamField>

<ParamField body="billingMode" type="string" required={false}>
  实例的计费方式。可选值：`onDemand`（按量计费）、`monthly`（包年包月）、`spot`（抢占式计费）。<br />
  默认值：`onDemand`。<br />
  注意：如果设置了 month > 0，则强制为 `monthly` 计费方式。

  * `onDemand`：按量计费
  * `monthly`：包年包月计费
  * `spot`：抢占式计费
</ParamField>

<ParamField body="autoRenew" type="boolean" required={false}>
  是否自动续费。布尔值，默认值：false。<br />
  注意：只有包年包月计费生效时，该参数才有效。
</ParamField>

<ParamField body="autoRenewMonth" type="integer" required={false}>
  自动续费月数。整数，取值范围：1-12。<br />
  注意：只有包年包月计费生效并且自动续费开启时，该参数才有效。
</ParamField>

<ParamField body="minCudaVersion" type="string" required={false}>
  创建实例支持的最小 CUDA 版本，需填写指定格式，例如：11.8、12.4。长度：\[0-255]。
</ParamField>

## 响应参数

<ResponseField name="id" type="string" required={false}>
  创建的实例 ID。
</ResponseField>
