{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://rentgpu.link/gpupln/schema.json",
  "title": "GPUPLN v0.1 — GPU 租用价格数据规范",
  "description": "GPU Price Listing Notation v0.1。用于交换「一张 GPU 跑一小时」的可比价格数据。规范正文：https://rentgpu.link/spec 。本 schema 以 CC BY 4.0 发布，可自由复制、修改与再分发（需署名 rentgpu.link）。",
  "type": "object",
  "required": [
    "gpupln_version",
    "publisher",
    "offers"
  ],
  "properties": {
    "gpupln_version": {
      "const": "0.1",
      "description": "规范版本。当前唯一有效值 0.1。"
    },
    "publisher": {
      "type": "object",
      "required": [
        "name",
        "url"
      ],
      "properties": {
        "name": {
          "type": "string",
          "description": "发布方名称"
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "发布方主页"
        },
        "contact": {
          "type": "string",
          "description": "联系邮箱或页面"
        }
      }
    },
    "updated_at": {
      "type": "string",
      "description": "本份数据的生成时刻，ISO 8601 且带时区。"
    },
    "license": {
      "type": "string",
      "description": "数据授权协议。GPUPLN 推荐 CC BY 4.0。",
      "default": "CC BY 4.0"
    },
    "conformance_level": {
      "enum": [
        "L0",
        "L1",
        "L2",
        "L3"
      ],
      "description": "一致性等级，见规范第 1 节。L0=仅可读；L1=字段齐全；L2=口径正确且区分实时/参考；L3=附带历史序列与库存。"
    },
    "currency_base": {
      "const": "CNY",
      "description": "折算基准币种。GPUPLN 要求所有价格先折算为人民币「单卡·小时」。"
    },
    "offers": {
      "type": "array",
      "description": "报价行。每行是一张卡在一个平台上的一条价格。",
      "items": {
        "$ref": "#/$defs/offer"
      }
    },
    "gpus": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/gpu"
      }
    },
    "platforms": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/platform"
      }
    },
    "citation": {
      "$ref": "#/$defs/citation"
    },
    "endpoints": {
      "type": "object",
      "description": "可选的机器可读端点清单，便于聚合方自动发现。",
      "properties": {
        "prices": {
          "type": "string",
          "format": "uri"
        },
        "history": {
          "type": "string",
          "format": "uri"
        },
        "resolve": {
          "type": "string",
          "format": "uri"
        },
        "mcp": {
          "type": "string",
          "format": "uri"
        }
      }
    },
    "payment": {
      "type": "object",
      "description": "可选。买数据的人怎么付钱。这一段是「可插拔」的：可用 x402 / mpp / ap2 中任意一个或多个，也可以完全省略（免费公开的数据源不需要支付段）。规范只定义怎么挂，不规定必须挂哪个。",
      "properties": {
        "protocols": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "x402",
              "mpp",
              "ap2",
              "other"
            ]
          },
          "description": "启用的支付协议，可并列多个。"
        },
        "network": {
          "type": "string",
          "description": "结算网络标识，例如 eip155:8453。"
        },
        "asset": {
          "type": "string",
          "description": "结算资产，例如 USDC。"
        },
        "price_per_call": {
          "type": "string",
          "description": "单次调用价格，例如 $0.05。"
        },
        "endpoint": {
          "type": "string",
          "description": "付费端点 URL。"
        }
      }
    }
  },
  "$defs": {
    "offer": {
      "type": "object",
      "required": [
        "platform",
        "gpu_model",
        "price_hour_cny",
        "price_type",
        "stock",
        "billing_notes",
        "src",
        "fetched_at"
      ],
      "properties": {
        "platform": {
          "type": "string",
          "pattern": "^[a-z0-9-]+$",
          "description": "平台唯一标识，kebab-case，如 gpushare。同一平台在任何实现中必须用同一个 id。"
        },
        "gpu_model": {
          "type": "string",
          "description": "卡型规范名，如 RTX 4090。必须同名同代；显存变体（4090 48G）不得冒充实标准卡型。"
        },
        "price_hour_cny": {
          "type": "number",
          "exclusiveMinimum": 0,
          "description": "一张卡跑一小时的人民币价格。整机价须先除以卡数；包月价除以 720 折算并注明。"
        },
        "price_hour_original": {
          "type": "number",
          "description": "可选。原币种原价，便于复核折算过程。"
        },
        "currency_original": {
          "type": "string",
          "description": "可选。price_hour_original 的币种，ISO 4217，如 USD。"
        },
        "price_type": {
          "enum": [
            "ondemand",
            "spot",
            "monthly"
          ],
          "description": "ondemand=按量，spot=竞价/可抢占，monthly=包月（须折算为小时）。ondemand 与 spot 不得混排。"
        },
        "stock": {
          "enum": [
            "available",
            "scarce",
            "soldout"
          ],
          "description": "库存状态。第三方应如实标注。"
        },
        "billing_notes": {
          "type": "string",
          "minLength": 1,
          "description": "必须说明数据来源与计费方式，如「官方挂牌按需价 $2.25/GPU·小时折算，按分钟计费」。"
        },
        "src": {
          "enum": [
            "crawler",
            "seed",
            "official",
            "partner"
          ],
          "description": "数据取得方式。crawler=自动抓取成功；seed=人工录入/兜底参考价；official=平台官方发布；partner=合作方直供。"
        },
        "fetched_at": {
          "type": "string",
          "description": "该价格的实际取得时刻（ISO 8601 带时区），不是页面生成时刻。时效判定以此为准。"
        },
        "data_status": {
          "enum": [
            "fresh",
            "stale",
            "suspect"
          ],
          "description": "stale=超过 7 天未刷新，仅作参考且不参与最低价排名；suspect=较 7 日均价波动 >40%，不上榜。"
        },
        "platform_region": {
          "type": "string",
          "description": "平台主要服务区域，如「中国」「北美」。"
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "可选。该报价的落地页，便于复核。"
        }
      }
    },
    "gpu": {
      "type": "object",
      "required": [
        "name",
        "vram_gb"
      ],
      "properties": {
        "name": {
          "type": "string",
          "description": "规范名，与 offer.gpu_model 对应"
        },
        "vram_gb": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "description": "显存容量（GB）"
        },
        "tier": {
          "type": "string",
          "description": "定位分层，如「消费级旗舰」「数据中心训练卡」"
        },
        "use": {
          "type": "string",
          "description": "典型用途一句话"
        }
      }
    },
    "platform": {
      "type": "object",
      "required": [
        "id",
        "name",
        "url"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9-]+$",
          "description": "与 offer.platform 对应"
        },
        "name": {
          "type": "string",
          "description": "展示名"
        },
        "region": {
          "type": "string",
          "description": "主要服务区域"
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "官网"
        }
      }
    },
    "citation": {
      "type": "object",
      "description": "引用块。GPUPLN 强烈建议随数据一起分发，使任何复用方（人 / Agent / 媒体）在转述时自动携带署名。",
      "required": [
        "required",
        "license",
        "source",
        "source_url"
      ],
      "properties": {
        "required": {
          "const": true,
          "description": "署名是否为硬性要求"
        },
        "license": {
          "type": "string",
          "default": "CC BY 4.0"
        },
        "license_url": {
          "type": "string",
          "format": "uri"
        },
        "source": {
          "type": "string"
        },
        "source_url": {
          "type": "string",
          "format": "uri"
        },
        "canonical_url": {
          "type": "string",
          "format": "uri"
        },
        "conforms_to": {
          "type": "string"
        },
        "cite_en": {
          "type": "string"
        },
        "cite_zh": {
          "type": "string"
        },
        "note": {
          "type": "string"
        }
      }
    }
  }
}
