> ## 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.

# 创建 Endpoint

## 请求头

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

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

## 请求体

<ParamField body="endpoint" type="object" required={true}>
  Endpoint 配置信息。

  <Expandable title="properties" defaultOpen={true}>
    <ParamField body="name" type="string" required={false}>
      Endpoint 名称。字符串，长度限制：0-220 字符。
    </ParamField>

    <ParamField body="appName" type="string" required={false}>
      应用名称(体现在 url 中)。应用名称是 Endpoint URL 的组成部分，支持自定义，默认为 Endpoint ID。
    </ParamField>

    <ParamField body="workerConfig" type="object" required={true}>
      Worker 配置。范围通过参数限制范围接口动态获取。

      <Expandable title="properties" defaultOpen={false}>
        <ParamField body="minNum" type="integer" required={true}>
          最小 worker 数。
        </ParamField>

        <ParamField body="maxNum" type="integer" required={true}>
          最大 worker 数。
        </ParamField>

        <ParamField body="freeTimeout" type="integer" required={true}>
          空闲超时（秒）。
        </ParamField>

        <ParamField body="maxConcurrent" type="integer" required={true}>
          最大并发数。
        </ParamField>

        <ParamField body="gpuNum" type="integer" required={true}>
          GPU 卡数 / Worker。每个 Worker 的 GPU 卡数。
        </ParamField>

        <ParamField body="requestTimeout" type="integer" required={true}>
          请求超时(秒)。
        </ParamField>
      </Expandable>
    </ParamField>

    <ParamField body="ports" type="object[]" required={true}>
      HTTP 端口。仅支持一个。支持的端口号范围：1-65535，其中 2222、2223、2224 为内部端口，不可使用。

      <Expandable title="properties" defaultOpen={false}>
        <ParamField body="port" type="string" required={true}>
          HTTP 端口。
        </ParamField>
      </Expandable>
    </ParamField>

    <ParamField body="policy" type="object" required={true}>
      弹性策略。范围通过参数限制范围接口动态获取。

      <Expandable title="properties" defaultOpen={false}>
        <ParamField body="type" type="string" required={true}>
          弹性策略类型。可选值：

          * `queue`：队列延迟策略，表示根据队列中请求的等待时间调整 Worker 的数量。
          * `concurrency`：队列请求策略，表示根据队列中的请求数，自动调整 Worker 的数量。
        </ParamField>

        <ParamField body="value" type="integer" required={true}>
          根据 type 的取值，value 表示不同。

          * type = queue 时，value 表示队列等待时间，单位为秒。
          * type = concurrency 时，value 表示队列最大请求数。
        </ParamField>
      </Expandable>
    </ParamField>

    <ParamField body="image" type="object" required={true}>
      镜像信息。

      <Expandable title="properties" defaultOpen={false}>
        <ParamField body="image" type="string" required={true}>
          镜像地址。字符串，长度限制：0-511 字符。
        </ParamField>

        <ParamField body="authId" type="string" required={false}>
          私有镜像凭证 ID（公共镜像或者本平台用户镜像可以不用填）。字符串，长度限制：0-255 字符。
        </ParamField>

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

    <ParamField body="products" type="object[]" required={true}>
      产品信息。

      <Expandable title="properties" defaultOpen={false}>
        <ParamField body="id" type="string" required={true}>
          产品 ID。
        </ParamField>
      </Expandable>
    </ParamField>

    <ParamField body="rootfsSize" type="integer" required={true}>
      系统盘大小（GB）。当前填固定值 100。
    </ParamField>

    <ParamField body="volumeMounts" type="object[]" required={true}>
      存储信息（GB）。

      <Expandable title="properties" defaultOpen={false}>
        <ParamField body="type" type="string" required={true}>
          存储类型。可选值：

          * `local`：本地存储。
          * `network`：网络存储。
        </ParamField>

        <ParamField body="size" type="integer" required={false}>
          本地存储大小，当前填固定值 30，网络存储不需要填。
        </ParamField>

        <ParamField body="id" type="string" required={false}>
          网络存储 ID，本地存储不需要填。
        </ParamField>

        <ParamField body="mountPath" type="string" required={true}>
          存储挂载路径。字符串，长度限制：0-255 字符。
        </ParamField>
      </Expandable>
    </ParamField>

    <ParamField body="clusterID" type="string" required={false}>
      集群信息，挂载云存储必填。且需要与云存储所在集群 ID 一致。字符串，长度限制：0-255 字符。
    </ParamField>

    <ParamField body="envs" type="object[]" required={false}>
      环境变量信息。

      <Expandable title="properties" defaultOpen={false}>
        <ParamField body="key" type="string" required={true}>
          环境变量名称。
        </ParamField>

        <ParamField body="value" type="string" required={true}>
          环境变量取值。
        </ParamField>
      </Expandable>
    </ParamField>

    <ParamField body="healthy" type="object" required={true}>
      监控检查接口路径。

      <Expandable title="properties" defaultOpen={false}>
        <ParamField body="path" type="string" required={true}>
          使用 HTTP 请求方式进行健康检查时，要检测的路径。
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>

## 响应参数

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