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

# 创建模板



## OpenAPI

````yaml gpus/v2-spec/create-template.json POST /gpus/v2/templates
openapi: 3.0.0
info:
  title: PPIO GPU API v2
  version: 2.0.0
servers:
  - url: https://api.ppio.com
security: []
paths:
  /gpus/v2/templates:
    post:
      summary: 创建模板
      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:
                - name
                - type
                - image
              properties:
                name:
                  type: string
                  description: 模板名称。
                  example: pytorch-2.3-cuda12
                type:
                  type: string
                  description: 模板类型。
                  example: instance
                image:
                  type: string
                  description: 镜像地址。
                  example: registry.example.com/ml/pytorch:2.3-cuda12
                registry_auth_id:
                  type: string
                  description: 镜像仓库认证 ID。
                  example: auth-001
                command:
                  type: string
                  description: 启动命令。
                  example: ''
                entrypoint:
                  type: string
                  description: 镜像入口命令。
                  example: /bin/bash
                rootfs_size_gb:
                  type: integer
                  description: 系统盘大小。单位为 GB。
                  example: 50
                ports:
                  type: array
                  description: 暴露端口配置。
                  items:
                    type: object
                    properties:
                      protocol:
                        type: string
                        description: 协议或端口类型
                        example: http
                      port:
                        type: integer
                        description: 端口
                        example: 8888
                envs:
                  type: array
                  description: 环境变量。
                  items:
                    type: object
                    properties:
                      key:
                        type: string
                        description: 环境变量名
                        example: ENV
                      value:
                        type: string
                        description: 环境变量值
                        example: prod
                metadata:
                  type: object
                  description: 模板元数据。
                  properties:
                    readme:
                      type: string
                      description: 模板说明
                      example: PyTorch 2.3 with CUDA 12
                    logo:
                      type: string
                      description: 图标 URL
                      example: https://example.com/logo.png
                    description:
                      type: string
                      description: 简短描述
                      example: PyTorch development template
                    author:
                      type: string
                      description: 作者
                      example: PAI
                    tags:
                      type: array
                      items:
                        type: string
                      description: 标签
                      example:
                        - pytorch
                        - cuda
                min_cuda_version:
                  type: string
                  description: 最低 CUDA 版本。
                  example: '12.2'
      responses:
        '200':
          description: 创建成功
          content:
            application/json:
              schema:
                type: object
                properties:
                  template_id:
                    type: string
                    description: 模板 ID
                    example: tpl-001

````