runpod-serverless

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

RunPod Serverless Creator

RunPod 无服务器端点创建工具

This skill helps you create and configure serverless endpoints on RunPod.io. It handles both the Template creation (software config) and the Endpoint creation (hardware config).
该技能可帮助你在RunPod.io上创建和配置无服务器端点,同时支持模板创建(软件配置)和端点创建(硬件配置)。

How to Use

使用方法

The primary tool is the
scripts/create_serverless.py
script. It is idempotent: if a template or endpoint with the same name exists, it will reuse the template and update the endpoint.
核心工具是
scripts/create_serverless.py
脚本,它具备幂等性:如果已存在同名的模板或端点,将复用该模板并更新端点。

Prerequisites

前置条件

  • API Key: You need a RunPod API Key.
    • Ask the user to provide it or check if
      RUNPOD_API_KEY
      is in the environment.
    • Security: Do not hardcode the key in the script. Pass it via environment variable
      RUNPOD_API_KEY
      .
  • API密钥:你需要一个RunPod API密钥。
    • 可要求用户提供该密钥,或检查环境变量中是否已设置
      RUNPOD_API_KEY
    • 安全提示:请勿在脚本中硬编码密钥,通过环境变量
      RUNPOD_API_KEY
      传递。

Command

命令

bash
python runpod-serverless/scripts/create_serverless.py \
  --name <NAME> \
  --runtime <python|node> \
  --gpu <GPU_TYPE> \
  [--disk <GB>] \
  [--min-workers <INT>] \
  [--max-workers <INT>]
bash
python runpod-serverless/scripts/create_serverless.py \
  --name <NAME> \
  --runtime <python|node> \
  --gpu <GPU_TYPE> \
  [--disk <GB>] \
  [--min-workers <INT>] \
  [--max-workers <INT>]

Arguments

参数

  • --name
    (Required): Unique name for the template and endpoint.
  • --runtime
    (Required):
    python
    or
    node
    . Maps to standard RunPod serverless base images.
  • --gpu
    (Required): GPU type alias (e.g.,
    3090
    ,
    4090
    ,
    a100
    ,
    a6000
    ) or specific ID (e.g.,
    AMPERE_24
    ).
  • --disk
    : Container disk size in GB (default: 10).
  • --min-workers
    : Minimum active workers (default: 0 for cold-start serverless).
  • --max-workers
    : Maximum active workers (default: 1).
  • --name
    (必填):模板和端点的唯一名称。
  • --runtime
    (必填):
    python
    node
    ,对应RunPod标准无服务器基础镜像。
  • --gpu
    (必填):GPU类型别名(如
    3090
    4090
    a100
    a6000
    )或特定ID(如
    AMPERE_24
    )。
  • --disk
    :容器磁盘大小,单位为GB(默认值:10)。
  • --min-workers
    :最小活跃工作节点数(无服务器冷启动场景默认值:0)。
  • --max-workers
    :最大活跃工作节点数(默认值:1)。

GPU Options (Aliases)

GPU选项(别名)

  • 3090
    ->
    AMPERE_24
    (24GB VRAM)
  • 4090
    ->
    ADA_24
    (24GB VRAM)
  • a4000
    ->
    AMPERE_16
    (16GB VRAM)
  • a6000
    ->
    AMPERE_48
    (48GB VRAM)
  • a100
    ->
    AMPERE_80
    (80GB VRAM)
See
references/runpod_api.md
for full API details and ID mappings.
  • 3090
    ->
    AMPERE_24
    (24GB显存)
  • 4090
    ->
    ADA_24
    (24GB显存)
  • a4000
    ->
    AMPERE_16
    (16GB显存)
  • a6000
    ->
    AMPERE_48
    (48GB显存)
  • a100
    ->
    AMPERE_80
    (80GB显存)
如需完整的API详情和ID映射关系,请查看
references/runpod_api.md

Example Workflow

示例流程

  1. Ask User for:
    • Application Name
    • Runtime (Python/Node)
    • Preferred GPU
    • API Key (if not known)
  2. Run Script:
    bash
    $env:RUNPOD_API_KEY="<USER_KEY>"; python runpod-serverless/scripts/create_serverless.py --name my-ai-api --runtime python --gpu 3090
  3. Verify: The script outputs the Template ID and Endpoint ID upon success.
  1. 向用户收集以下信息:
    • 应用名称
    • 运行时环境(Python/Node)
    • 偏好的GPU类型
    • API密钥(若未获取)
  2. 运行脚本
    bash
    $env:RUNPOD_API_KEY="<USER_KEY>"; python runpod-serverless/scripts/create_serverless.py --name my-ai-api --runtime python --gpu 3090
  3. 验证:脚本执行成功后会输出模板ID和端点ID。