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



## OpenAPI

````yaml gpus/v2-spec/create-endpoint.json POST /gpus/v2/endpoints
openapi: 3.0.0
info:
  title: PPIO GPU API v2
  version: 2.0.0
servers:
  - url: https://api.ppio.com
security: []
paths:
  /gpus/v2/endpoints:
    post:
      summary: 创建 Endpoint
      parameters:
        - name: Content-Type
          in: header
          required: true
          schema:
            type: string
          description: 枚举值：application/json。
        - name: Authorization
          in: header
          required: true
          schema:
            type: string
          description: Bearer 身份验证格式，例如：Bearer `{{API 密钥}}`。
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - type
                - name
                - product_id
                - image
                - worker_config
              properties:
                type:
                  type: string
                  enum:
                    - sync
                    - async
                  description: Endpoint 类型
                  example: sync
                name:
                  type: string
                  description: Endpoint 名称。字符串，长度限制：1-255 字符。
                  example: example-endpoint
                product_id:
                  type: string
                  description: Serverless 产品 ID。字符串，长度限制：1-255 字符。
                  example: product-id
                image:
                  type: string
                  description: 镜像地址。字符串，长度限制：1-500 字符。
                  example: registry.example.com/namespace/image:tag
                worker_config:
                  type: object
                  description: Worker 配置。
                  required:
                    - max_replicas
                  properties:
                    max_replicas:
                      type: integer
                      description: 最大 Worker 数量。整数，取值范围：[0, 1000]。
                      example: 2
                    min_replicas:
                      type: integer
                      description: 最小 Worker 数量。整数，取值范围：[0, 1000]。
                      example: 0
                    idle_timeout:
                      type: integer
                      description: 空闲释放时间。整数，取值范围：[1, 1000]。
                      example: 300
                    max_concurrent_per_worker:
                      type: integer
                      description: 单个 Worker 最大并发请求数。整数，取值范围：[1, 1000]。
                      example: 10
                    gpu_num:
                      type: integer
                      description: GPU 数量。整数，取值范围：[1, 8]。
                      example: 1
                    rootfs_size_gb:
                      type: integer
                      description: 系统盘大小。整数，取值范围：[10, 100]。单位为 GB。
                      example: 20
                    min_cuda_version:
                      type: string
                      enum:
                        - '12.4'
                        - '12.6'
                        - '12.8'
                        - '12.9'
                        - '13.0'
                      description: 最低 CUDA 版本。
                      example: '12.4'
                    request_timeout:
                      type: integer
                      description: 请求超时时间。整数，取值范围：[1, 1800]。
                      example: 60
                app_name:
                  type: string
                  description: 应用名称。字符串，长度限制：0-255 字符。
                  example: example-app
                registry_auth_id:
                  type: string
                  description: 已保存的镜像认证 ID。字符串，长度限制：0-255 字符。
                  example: registry-auth-id
                entrypoint:
                  type: string
                  description: 容器 entrypoint。
                  example: ''
                command:
                  type: string
                  description: 启动命令。
                  example: ''
                policy:
                  type: object
                  description: 调度/请求策略。
                  properties:
                    type:
                      type: string
                      enum:
                        - queue
                        - concurrency
                      description: 策略类型。
                      example: queue
                    value:
                      type: integer
                      description: >-
                        策略值。整数，取值范围：[1, 1000]。`queue` 表示队列等待时间，`concurrency`
                        表示请求数。
                      example: 100
                volumes:
                  type: array
                  description: 挂载卷列表。
                  items:
                    type: object
                    properties:
                      id:
                        type: string
                        description: 存储 ID。
                        example: storage-id
                      type:
                        type: string
                        enum:
                          - local
                          - network
                        description: 存储类型。注意：`local` 类型即将废弃。
                        example: network
                      size:
                        type: integer
                        description: 存储大小。仅当 `type=local` 时返回。注意：`local` 类型即将废弃。
                      mount_point:
                        type: string
                        description: 挂载路径。字符串，长度限制：0-4095 字符。
                        example: /data
                envs:
                  type: array
                  description: 环境变量列表。
                  items:
                    type: object
                    properties:
                      key:
                        type: string
                        description: 环境变量名。字符串，长度限制：0-511 字符。
                        example: ENV_NAME
                      value:
                        type: string
                        description: 环境变量值。字符串，长度限制：0-4095 字符。
                        example: ENV_VALUE
                ports:
                  type: array
                  items:
                    type: integer
                  description: 端口号列表。每项取值范围：[1, 65535]。
                  example:
                    - 8080
                health_check:
                  type: object
                  description: 健康检查配置。
                  properties:
                    path:
                      type: string
                      description: 健康检查路径。
                      example: /healthz
                    port:
                      type: integer
                      description: 健康检查端口。整数，取值范围：[0, 65535]。
                      example: 8080
                region_id:
                  type: string
                  description: 区域 ID。
                  example: region-id
      responses:
        '200':
          description: 创建成功
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: 创建成功后的 Endpoint ID
                    example: endpoint-id

````