{
  "openapi": "3.1.0",
  "info": {
    "title": "689API",
    "version": "0.14.30",
    "description": "人民币图片/视频 API 与充值接口。1 元 = 1,000,000 微元。生成接口使用用户 API Key；网页充值与管理员配置使用登录 Cookie，写操作另需 CSRF。微信 Native 与支付宝电脑网站支付已实现验签与服务端入账；只有商户凭据、公开 HTTPS 回调和开关就绪后才可下单。配置就绪不代表已完成真实商户验收。退款尚未实现。 新任务仅开放689API002，单位售价按上游单位成本 × 1.3 向上取整到分，按秒型号先计算单位售价再乘时长，历史任务保留原渠道及报价。 客户端发布支持集星AI制作与集星短剧自动剪辑，两款产品共用 Ed25519 验证公钥。"
  },
  "servers": [
    {
      "url": "https://689api.com",
      "description": "正式服务地址；以站点可用状态为准"
    },
    {
      "url": "http://127.0.0.1:6890",
      "description": "本机部署"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/v1/models": {
      "get": {
        "operationId": "listModels",
        "summary": "启用的同ID模型目录",
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "price_micros": {
                            "type": "integer"
                          },
                          "unit": {
                            "enum": [
                              "request",
                              "second"
                            ]
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/videos": {
      "post": {
        "operationId": "createVideo",
        "summary": "创建一条视频",
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200,
              "pattern": "^[\\w.:-]+$"
            },
            "description": "同一逻辑创作始终使用同一值；不能以新键自动重投"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "model",
                  "prompt"
                ],
                "description": "未声明默认时长的模型必须提供 duration 或 seconds",
                "additionalProperties": false,
                "properties": {
                  "videos": {
                    "type": "array",
                    "maxItems": 10,
                    "items": {
                      "type": "string",
                      "format": "uri",
                      "pattern": "^https://"
                    },
                    "description": "仅支持 reference_media_mode=https-urls 的模型；有序公网 HTTPS 媒体直链"
                  },
                  "audios": {
                    "type": "array",
                    "maxItems": 10,
                    "items": {
                      "type": "string",
                      "format": "uri",
                      "pattern": "^https://"
                    },
                    "description": "仅支持 reference_media_mode=https-urls 的模型；有序公网 HTTPS 媒体直链"
                  },
                  "model": {
                    "type": "string"
                  },
                  "prompt": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 16000
                  },
                  "duration": {
                    "type": "integer",
                    "description": "模型支持的秒数"
                  },
                  "seconds": {
                    "type": "integer",
                    "description": "duration别名，两者同时提供必须相同"
                  },
                  "ratio": {
                    "type": "string"
                  },
                  "aspect_ratio": {
                    "type": "string"
                  },
                  "images": {
                    "type": "array",
                    "maxItems": 30,
                    "items": {
                      "type": "string",
                      "format": "uri",
                      "pattern": "^https://"
                    },
                    "description": "只有目录明确支持参考图且数量未超限的模型接受；以模型元数据为准"
                  },
                  "image_urls": {
                    "type": "array",
                    "maxItems": 30,
                    "items": {
                      "type": "string",
                      "format": "uri",
                      "pattern": "^https://"
                    },
                    "description": "只有目录明确支持参考图且数量未超限的模型接受；以模型元数据为准"
                  },
                  "referenceImages": {
                    "type": "array",
                    "maxItems": 30,
                    "items": {
                      "type": "string",
                      "format": "uri",
                      "pattern": "^https://"
                    },
                    "description": "只有目录明确支持参考图且数量未超限的模型接受；以模型元数据为准"
                  },
                  "image_url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "resolution": {
                    "type": "string",
                    "description": "必须匹配该模型报价档位"
                  },
                  "seed": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 4294967295
                  },
                  "max_price_micros": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100000000000,
                    "description": "用户确认的最高总价，单位微元。生成时若现价超过它，412 PRICE_CHANGED且不预占不提交；该字段不传上游。"
                  },
                  "routing_mode": {
                    "type": "string",
                    "enum": [
                      "price_first",
                      "balanced"
                    ],
                    "default": "price_first",
                    "description": "智能视频默认先试兼容最低价，同价依据上游统计排序。可安全换线时，按近24小时成片率、样本量和价格挑选预算内备选。balanced 从首档就综合比较。"
                  }
                }
              },
              "example": {
                "model": "689API002/seedance-2.5-bd-2",
                "prompt": "蓝色陶瓷杯，晨光，镜头缓慢推进",
                "seconds": 30,
                "ratio": "9:16",
                "resolution": "720p"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                }
              }
            }
          },
          "202": {
            "description": "已提交，查询同一任务",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                }
              }
            }
          },
          "400": {
            "description": "请求参数、能力或模型未确认",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "密钥失效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "余额不足",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "自己的任务不存在",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等键或请求状态冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "现价超过max_price_micros，请重新报价确认；未创建任务或预占余额",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "已建门户任务，上游明确拒绝，预占已释放",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                }
              }
            }
          },
          "429": {
            "description": "限流",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "尚未开放收费或上游未配置",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/images/generations": {
      "post": {
        "operationId": "createImage",
        "summary": "生成一张图片，URL输出",
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200,
              "pattern": "^[\\w.:-]+$"
            },
            "description": "同一逻辑创作始终使用同一值；不能以新键自动重投"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "model",
                  "prompt"
                ],
                "additionalProperties": false,
                "properties": {
                  "model": {
                    "type": "string"
                  },
                  "prompt": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 16000
                  },
                  "n": {
                    "const": 1,
                    "default": 1
                  },
                  "response_format": {
                    "const": "url",
                    "default": "url"
                  },
                  "size": {
                    "type": "string",
                    "description": "仅接受目录已核价枚举"
                  },
                  "quality": {
                    "type": "string",
                    "description": "仅接受目录已核价枚举"
                  },
                  "max_price_micros": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100000000000,
                    "description": "用户确认的最高总价，单位微元。生成时若现价超过它，412 PRICE_CHANGED且不预占不提交；该字段不传上游。"
                  }
                }
              },
              "example": {
                "model": "gpt-image-2",
                "prompt": "一只蓝色陶瓷杯，产品摄影",
                "n": 1,
                "response_format": "url"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                }
              }
            }
          },
          "202": {
            "description": "已提交，查询同一任务",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                }
              }
            }
          },
          "400": {
            "description": "请求参数、能力或模型未确认",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "密钥失效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "余额不足",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "自己的任务不存在",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等键或请求状态冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "现价超过max_price_micros，请重新报价确认；未创建任务或预占余额",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "已建门户任务，上游明确拒绝，预占已释放",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                }
              }
            }
          },
          "429": {
            "description": "限流",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "尚未开放收费或上游未配置",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/tasks/{id}": {
      "get": {
        "operationId": "getTask",
        "summary": "查询自己的图片或视频任务",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                }
              }
            }
          },
          "202": {
            "description": "已提交，查询同一任务",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                }
              }
            }
          },
          "400": {
            "description": "请求参数、能力或模型未确认",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "密钥失效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "余额不足",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "自己的任务不存在",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等键或请求状态冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "现价超过max_price_micros，请重新报价确认；未创建任务或预占余额",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "已建门户任务，上游明确拒绝，预占已释放",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                }
              }
            }
          },
          "429": {
            "description": "限流",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "尚未开放收费或上游未配置",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/videos/{id}": {
      "get": {
        "operationId": "getVideo",
        "summary": "查询自己的视频任务",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                }
              }
            }
          },
          "202": {
            "description": "已提交，查询同一任务",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                }
              }
            }
          },
          "400": {
            "description": "请求参数、能力或模型未确认",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "密钥失效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "余额不足",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "自己的任务不存在",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等键或请求状态冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "现价超过max_price_micros，请重新报价确认；未创建任务或预占余额",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "已建门户任务，上游明确拒绝，预占已释放",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                }
              }
            }
          },
          "429": {
            "description": "限流",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "尚未开放收费或上游未配置",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/videos/{id}/content": {
      "get": {
        "operationId": "downloadVideo",
        "summary": "获取自己的已完成视频",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "Range",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "视频流",
            "content": {
              "video/mp4": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "206": {
            "description": "部分视频内容"
          },
          "302": {
            "description": "跳转到供应商公开HTTPS结果"
          },
          "401": {
            "description": "密钥失效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "自己的任务不存在",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等键或请求状态冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "head": {
        "operationId": "downloadVideoHead",
        "summary": "读取已完成原件的下载响应头",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "完整文件元数据，无响应体"
          },
          "302": {
            "description": "公开 HTTPS 成品地址"
          },
          "401": {
            "description": "密钥失效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "自己的任务不存在",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等键或请求状态冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "原件暂时不可读取"
          }
        }
      }
    },
    "/api/public/config": {
      "get": {
        "operationId": "publicConfig",
        "summary": "公开开关与可用充值渠道",
        "security": [],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "brand": {
                      "const": "689API"
                    },
                    "recharge_tiers": {
                      "type": "array",
                      "items": {
                        "enum": [
                          50,
                          100,
                          300,
                          500,
                          1000
                        ]
                      }
                    },
                    "payment_mode": {
                      "enum": [
                        "online",
                        "manual_review"
                      ]
                    },
                    "payment_channels": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PaymentChannel"
                      }
                    },
                    "payment_notice": {
                      "type": "string"
                    },
                    "base_url": {
                      "type": "string"
                    },
                    "registration_enabled": {
                      "type": "boolean"
                    },
                    "email_registration_required": {
                      "const": true
                    },
                    "mail_configured": {
                      "type": "boolean"
                    },
                    "generation_enabled": {
                      "type": "boolean"
                    },
                    "password_policy": {
                      "type": "object",
                      "properties": {
                        "min_length": {
                          "const": 6
                        },
                        "max_length": {
                          "const": 128
                        },
                        "login_max_length": {
                          "const": 256
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/orders": {
      "get": {
        "operationId": "listOwnOrders",
        "summary": "自己的充值订单记录",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "orders": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Order"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createRechargeOrder",
        "summary": "创建固定金额充值订单",
        "description": "微信或支付宝必须沿用稳定 request_id；网络超时不要换键重复下单，查询原订单核验。人工订单只创建待审核申请。订单状态只能由验签查询/通知或人工渠道核实真实收款后改变。",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "X-CSRF-Token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "登录或 /api/me 返回的 csrf；不能使用 API Key 代替网页登录"
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9_.:-]+$"
            },
            "description": "在线订单 request_id 的替代；body 优先"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "amount"
                ],
                "properties": {
                  "amount": {
                    "enum": [
                      50,
                      100,
                      300,
                      500,
                      1000
                    ]
                  },
                  "channel": {
                    "enum": [
                      "manual",
                      "wechat",
                      "alipay"
                    ],
                    "default": "manual"
                  },
                  "request_id": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 128,
                    "pattern": "^[A-Za-z0-9_.:-]+$",
                    "description": "在线渠道必填，可用 Idempotency-Key 代替"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "订单已建立或返回同一幂等订单；不代表已付款",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Order"
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/orders/{id}": {
      "get": {
        "operationId": "getOwnOrder",
        "summary": "查询自己的充值订单并核验商户状态",
        "description": "服务端限制每单至少 5 秒查询间隔。只核验原订单，不重新下单。请求失败保持待核验；过期不自动关单。支付宝未到期入口可按同一商户当前凭据重签，原订单号与绝对到期时间保持不变。",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Order"
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/orders/{id}": {
      "get": {
        "operationId": "adminQueryOrder",
        "summary": "管理员核验任意用户的原商户订单",
        "description": "需要管理员会话；执行与用户查单相同的签名和金额校验，不提供强制入账。",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Order"
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/orders/{id}/confirm": {
      "post": {
        "operationId": "confirmManualRecharge",
        "summary": "管理员审核实际收款或发放测试额度",
        "description": "仅人工待审订单；credit_source=manual_payment要求真实收款凭证，test_credit明确记为测试额度而非第三方到账。交易/测试凭证编号全局唯一，余额、账本、来源与审计在同一事务写入，重复确认不会重复充值。在线商户订单不可人工确认。",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-CSRF-Token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "登录或 /api/me 返回的 csrf；不能使用 API Key 代替网页登录"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "transaction_id",
                  "note"
                ],
                "properties": {
                  "transaction_id": {
                    "type": "string",
                    "minLength": 6,
                    "maxLength": 150
                  },
                  "note": {
                    "type": "string",
                    "minLength": 4,
                    "maxLength": 500
                  },
                  "credit_source": {
                    "enum": [
                      "manual_payment",
                      "test_credit"
                    ],
                    "default": "manual_payment"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Order"
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/payment-settings": {
      "get": {
        "operationId": "getMerchantSettings",
        "summary": "管理员查看支付就绪条件与凭据存在状态",
        "description": "私钥、APIv3 密钥和验签公钥均不回传；ready 只表示本地配置满足，不表示真实商户或公网回调已验收。",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentSettings"
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "saveMerchantSettings",
        "summary": "安全保存加密商户配置",
        "description": "需要管理员会话、CSRF、localhost 或可信 HTTPS。密钥空值保留；clear_字段显式清除。只接受固定官方网关、RSA2/RSA-SHA256，不能关闭验签。待核验订单禁止换商户身份，可在同一商户下修复非空凭据；旧验签材料不会继续被信任，原单可通过当前配置查询恢复。退款未实现。",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "X-CSRF-Token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "登录或 /api/me 返回的 csrf；不能使用 API Key 代替网页登录"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PaymentSettingsUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentSettings"
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/payments/wechat/notify": {
      "post": {
        "operationId": "wechatPaymentNotify",
        "summary": "微信支付 APIv3 官方异步通知入口",
        "description": "不使用登录 Cookie 或用户 API Key。原始 body 按配置平台公钥验签，校验 serial、时间戳 ±300 秒，再解密 AES-256-GCM resource。仅 TRANSACTION.SUCCESS 且 appid/mchid/订单号/交易号/整分金额/CNY 全部匹配才事务入账。重复合法通知不会重复充值。必须持久提交后返回 204。",
        "security": [],
        "parameters": [
          {
            "in": "header",
            "name": "Wechatpay-Timestamp",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "Wechatpay-Nonce",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "Wechatpay-Serial",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "Wechatpay-Signature",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "event_type",
                  "resource"
                ],
                "properties": {
                  "event_type": {
                    "const": "TRANSACTION.SUCCESS"
                  },
                  "resource": {
                    "type": "object",
                    "required": [
                      "algorithm",
                      "original_type",
                      "ciphertext",
                      "nonce"
                    ],
                    "properties": {
                      "algorithm": {
                        "const": "AEAD_AES_256_GCM"
                      },
                      "original_type": {
                        "const": "transaction"
                      },
                      "ciphertext": {
                        "type": "string"
                      },
                      "nonce": {
                        "type": "string"
                      },
                      "associated_data": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "签名与订单核验通过并已持久入账，或相同交易已入账"
          },
          "400": {
            "description": "通知未通过核验，不入账",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "const": "FAIL"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "内部或持久化失败，未确认入账"
          },
          "503": {
            "description": "暂时无法确认，商户应重试原通知"
          }
        }
      }
    },
    "/api/payments/alipay/notify": {
      "post": {
        "operationId": "alipayPaymentNotify",
        "summary": "支付宝电脑网站支付官方异步通知入口",
        "description": "表单只解码一次，拒绝重复字段，RSA2 验签排除 sign/sign_type。校验 app_id、seller_id、out_trade_no、trade_no 和精确两位内人民币金额；仅 TRADE_SUCCESS/TRADE_FINISHED 可充值。国内 CNY 通道不接受其它币种。浏览器 return_url 不参与入账。",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "app_id",
                  "seller_id",
                  "out_trade_no",
                  "trade_no",
                  "total_amount",
                  "notify_type",
                  "trade_status",
                  "sign_type",
                  "sign"
                ],
                "properties": {
                  "app_id": {
                    "type": "string"
                  },
                  "seller_id": {
                    "type": "string"
                  },
                  "out_trade_no": {
                    "type": "string"
                  },
                  "trade_no": {
                    "type": "string"
                  },
                  "total_amount": {
                    "type": "string",
                    "pattern": "^(0|[1-9][0-9]{0,8})(\\.[0-9]{1,2})?$"
                  },
                  "notify_type": {
                    "const": "trade_status_sync"
                  },
                  "trade_status": {
                    "enum": [
                      "TRADE_SUCCESS",
                      "TRADE_FINISHED"
                    ]
                  },
                  "sign_type": {
                    "const": "RSA2"
                  },
                  "sign": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "已持久入账或相同交易已入账",
            "content": {
              "text/plain": {
                "schema": {
                  "const": "success"
                }
              }
            }
          },
          "400": {
            "description": "未通过核验，不入账",
            "content": {
              "text/plain": {
                "schema": {
                  "const": "failure"
                }
              }
            }
          },
          "500": {
            "description": "内部或持久化失败，返回 failure"
          },
          "503": {
            "description": "暂时无法确认，返回 failure"
          }
        }
      }
    },
    "/v1/images/edits": {
      "post": {
        "operationId": "editImage",
        "summary": "上传一张真实参考图进行图片编辑",
        "description": "仅gpt-image-2且目录supports_image_edits。门户接收JSON data URI，验证PNG/JPEG/WebP魔数与MIME、每图最多20MiB，再转供应商multipart image；不在门户下载任意HTTPS URL。不支持的图片或声音参数直接拒绝，不删图重提。n固定1、当前输出1024x1024，沿用已核定按次报价、锁价、幂等与同一账本。不得以reference_images_count代替真实图片。",
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200,
              "pattern": "^[\\w.:-]+$"
            },
            "description": "同一逻辑创作始终使用同一值；不能以新键自动重投"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "model",
                  "prompt",
                  "images"
                ],
                "additionalProperties": false,
                "properties": {
                  "model": {
                    "const": "gpt-image-2"
                  },
                  "prompt": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 16000
                  },
                  "images": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 1,
                    "items": {
                      "type": "string",
                      "pattern": "^data:image/(png|jpeg|webp);base64,"
                    }
                  },
                  "n": {
                    "const": 1,
                    "default": 1
                  },
                  "response_format": {
                    "const": "url",
                    "default": "url"
                  },
                  "size": {
                    "const": "1024x1024",
                    "default": "1024x1024"
                  },
                  "max_price_micros": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100000000000,
                    "description": "用户确认的最高总价，单位微元。生成时若现价超过它，412 PRICE_CHANGED且不预占不提交；该字段不传上游。"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                }
              }
            }
          },
          "202": {
            "description": "已提交，查询同一任务",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                }
              }
            }
          },
          "400": {
            "description": "请求参数、能力或模型未确认",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "密钥失效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "余额不足",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "自己的任务不存在",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等键或请求状态冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "现价超过max_price_micros，请重新报价确认；未创建任务或预占余额",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "已建门户任务，上游明确拒绝，预占已释放",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                }
              }
            }
          },
          "429": {
            "description": "限流",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "尚未开放收费或上游未配置",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/account": {
      "get": {
        "operationId": "getGatewayAccount",
        "summary": "当前密钥所属账户余额和生成开关",
        "description": "只返回当前密钥所属账户，不返回其它密钥、密码或上游成本。",
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "email": {
                      "type": "string",
                      "format": "email"
                    },
                    "role": {
                      "enum": [
                        "admin",
                        "user"
                      ]
                    },
                    "balance_micros": {
                      "type": "integer",
                      "description": "人民币微元；1元=1,000,000微元"
                    },
                    "held_micros": {
                      "type": "integer",
                      "description": "人民币微元；1元=1,000,000微元"
                    },
                    "available_micros": {
                      "type": "integer",
                      "description": "人民币微元；1元=1,000,000微元"
                    },
                    "email_verified": {
                      "type": "boolean"
                    },
                    "generation_enabled": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "密钥失效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/tasks": {
      "get": {
        "operationId": "listOwnGatewayTasks",
        "summary": "分页查询自己的任务并恢复断连请求",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 1000000,
              "default": 0
            }
          },
          {
            "in": "query",
            "name": "kind",
            "schema": {
              "enum": [
                "all",
                "image",
                "video"
              ]
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "enum": [
                "all",
                "dispatching",
                "queued",
                "processing",
                "completed",
                "failed",
                "unknown"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Task"
                      }
                    },
                    "total": {
                      "type": "integer"
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "请求参数、能力或模型未确认",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "密钥失效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/quotes": {
      "post": {
        "operationId": "quoteGeneration",
        "summary": "按同一参数校验器计算当前生成售价",
        "description": "不调用上游、不预占、不扣费。不保证提交时价格不变；正式生成仍按提交瞬间保存价格快照。prompt可省略。尚未上传本机图片时可仅传reference_images_count执行相同能力校验；同时提供实际图片时数量必须一致。计数字段仅允许用于报价，正式生成必须提交真实参考素材，不能以计数替代。其余时长和规格校验与生成一致。 智能报价返回本次首选价 price_micros、最低兼容价 min_price_micros 和最高预占 hold_cap_micros。提交时可用 max_price_micros 限制总预算。",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "kind",
                  "model"
                ],
                "properties": {
                  "videos": {
                    "type": "array",
                    "maxItems": 10,
                    "items": {
                      "type": "string",
                      "format": "uri",
                      "pattern": "^https://"
                    },
                    "description": "仅支持 reference_media_mode=https-urls 的模型；有序公网 HTTPS 媒体直链"
                  },
                  "audios": {
                    "type": "array",
                    "maxItems": 10,
                    "items": {
                      "type": "string",
                      "format": "uri",
                      "pattern": "^https://"
                    },
                    "description": "仅支持 reference_media_mode=https-urls 的模型；有序公网 HTTPS 媒体直链"
                  },
                  "model": {
                    "type": "string"
                  },
                  "prompt": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 16000
                  },
                  "duration": {
                    "type": "integer",
                    "description": "模型支持的秒数"
                  },
                  "seconds": {
                    "type": "integer",
                    "description": "duration别名，两者同时提供必须相同"
                  },
                  "ratio": {
                    "type": "string"
                  },
                  "aspect_ratio": {
                    "type": "string"
                  },
                  "images": {
                    "type": "array",
                    "maxItems": 30,
                    "items": {
                      "type": "string",
                      "format": "uri",
                      "pattern": "^https://"
                    },
                    "description": "只有目录明确支持参考图且数量未超限的模型接受；以模型元数据为准"
                  },
                  "image_urls": {
                    "type": "array",
                    "maxItems": 30,
                    "items": {
                      "type": "string",
                      "format": "uri",
                      "pattern": "^https://"
                    },
                    "description": "只有目录明确支持参考图且数量未超限的模型接受；以模型元数据为准"
                  },
                  "referenceImages": {
                    "type": "array",
                    "maxItems": 30,
                    "items": {
                      "type": "string",
                      "format": "uri",
                      "pattern": "^https://"
                    },
                    "description": "只有目录明确支持参考图且数量未超限的模型接受；以模型元数据为准"
                  },
                  "image_url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "resolution": {
                    "type": "string",
                    "description": "必须匹配该模型报价档位"
                  },
                  "seed": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 4294967295
                  },
                  "max_price_micros": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100000000000,
                    "description": "用户确认的最高总价，单位微元。生成时若现价超过它，412 PRICE_CHANGED且不预占不提交；该字段不传上游。"
                  },
                  "kind": {
                    "enum": [
                      "image",
                      "video"
                    ]
                  },
                  "operation": {
                    "enum": [
                      "generate",
                      "edit"
                    ],
                    "default": "generate",
                    "description": "edit仅图片编辑，需模型supports_image_edits且至少一张引用"
                  },
                  "reference_images_count": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100,
                    "description": "仅报价使用；和实际图片同时提供时必须与合计张数一致；不证明素材已上传或可访问"
                  },
                  "n": {
                    "const": 1
                  },
                  "response_format": {
                    "const": "url"
                  },
                  "size": {
                    "type": "string"
                  },
                  "quality": {
                    "type": "string"
                  },
                  "routing_mode": {
                    "type": "string",
                    "enum": [
                      "price_first",
                      "balanced"
                    ],
                    "default": "price_first",
                    "description": "智能视频默认先试兼容最低价，同价依据上游统计排序。可安全换线时，按近24小时成片率、样本量和价格挑选预算内备选。balanced 从首档就综合比较。"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Quote"
                }
              }
            }
          },
          "400": {
            "description": "请求参数、能力或模型未确认",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "密钥失效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "限流",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/tasks/{id}/content": {
      "get": {
        "operationId": "downloadTaskContent",
        "summary": "认证获取自己的图片或视频结果",
        "description": "返回本地图片或上游内容流，支持单段Range；外部公开HTTPS结果返回302。客户端跟随跨域跳转时必须移除689API Authorization。上游b64图片只接收不超过20MiB的PNG/JPEG/WebP，持久保存后才结算原任务。",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "Range",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "已完成图片或视频内容流"
          },
          "206": {
            "description": "部分内容"
          },
          "302": {
            "description": "公开HTTPS结果地址；跨域不转发密钥"
          },
          "401": {
            "description": "密钥失效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "自己的任务不存在",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等键或请求状态冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "416": {
            "description": "字节范围不正确"
          }
        }
      },
      "head": {
        "operationId": "downloadTaskContentHead",
        "summary": "读取已完成原件的下载响应头",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "完整文件元数据，无响应体"
          },
          "302": {
            "description": "公开 HTTPS 成品地址"
          },
          "401": {
            "description": "密钥失效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "自己的任务不存在",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等键或请求状态冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "原件暂时不可读取"
          }
        }
      }
    },
    "/api/tasks/{id}/content": {
      "get": {
        "operationId": "browserDownloadTaskContent",
        "summary": "网页通过会话获取自己的媒体结果",
        "description": "任务拥有者或管理员可下载，使用Cookie；不在URL放API Key。",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "已完成图片或视频内容流"
          },
          "302": {
            "description": "公开HTTPS结果地址"
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "head": {
        "operationId": "browserDownloadTaskContentHead",
        "summary": "读取已完成原件的下载响应头",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "responses": {
          "200": {
            "description": "完整文件元数据，无响应体"
          },
          "302": {
            "description": "公开 HTTPS 成品地址"
          },
          "401": {
            "description": "密钥失效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "自己的任务不存在",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等键或请求状态冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "原件暂时不可读取"
          }
        }
      }
    },
    "/api/admin/users/{id}": {
      "get": {
        "operationId": "adminMemberDetail",
        "summary": "会员余额、密钥和用量明细",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "user": {
                      "$ref": "#/components/schemas/Member"
                    },
                    "summary": {
                      "type": "object",
                      "properties": {
                        "active_key_count": {
                          "type": "integer"
                        },
                        "key_count": {
                          "type": "integer"
                        },
                        "task_count": {
                          "type": "integer"
                        },
                        "completed_task_count": {
                          "type": "integer"
                        },
                        "spent_micros": {
                          "type": "integer"
                        },
                        "credited_micros": {
                          "type": "integer"
                        },
                        "test_credit_micros": {
                          "type": "integer"
                        },
                        "pending_order_count": {
                          "type": "integer"
                        }
                      }
                    },
                    "keys": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AdminKey"
                      }
                    },
                    "orders": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Order"
                      }
                    },
                    "tasks": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AdminTask"
                      }
                    },
                    "ledger": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Ledger"
                      }
                    },
                    "totals": {
                      "type": "object",
                      "description": "keys/orders/tasks/ledger各自总数"
                    },
                    "truncated": {
                      "type": "object",
                      "description": "各预览是否已截断"
                    },
                    "preview_limit": {
                      "const": 50
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/users/{id}/keys": {
      "post": {
        "operationId": "adminCreateMemberKey",
        "summary": "为指定会员创建一次显示的密钥",
        "description": "仅管理员+CSRF；密钥归属目标会员，仅创建响应返回明文，列表和审计不保存明文；不读取或重置用户密码。每会员最多30个有效密钥。",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-CSRF-Token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "登录或 /api/me 返回的 csrf；不能使用 API Key 代替网页登录"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "note"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "note": {
                    "type": "string",
                    "minLength": 4,
                    "maxLength": 500
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "user_id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "key": {
                      "type": "string",
                      "description": "仅本次响应，请私密交付会员"
                    },
                    "warning": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/keys/{id}/revoke": {
      "post": {
        "operationId": "adminRevokeMemberKey",
        "summary": "撤销会员密钥并审计原因",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-CSRF-Token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "登录或 /api/me 返回的 csrf；不能使用 API Key 代替网页登录"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "note"
                ],
                "properties": {
                  "note": {
                    "type": "string",
                    "minLength": 4,
                    "maxLength": 500
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "already_revoked": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/orders/{id}/reject": {
      "post": {
        "operationId": "adminRejectManualOrder",
        "summary": "拒绝待审人工充值申请",
        "description": "不扣款也不入账。仅manual+pending_review可变更，重复拒绝幂等；已付款订单不可通过拒绝撤销。",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-CSRF-Token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "登录或 /api/me 返回的 csrf；不能使用 API Key 代替网页登录"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "note"
                ],
                "properties": {
                  "note": {
                    "type": "string",
                    "minLength": 4,
                    "maxLength": 500
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Order"
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/users": {
      "get": {
        "operationId": "adminListUsers",
        "summary": "管理员分页查询会员",
        "description": "服务器过滤后再分页；返回安全字段，不包含密码或密钥哈希。limit默认50，最多100。overview仅作100条预览。",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 1000000,
              "default": 0
            }
          },
          {
            "in": "query",
            "name": "search",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "in": "query",
            "name": "user_id",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string"
            },
            "description": "资源状态或all"
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "users": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Member"
                      }
                    },
                    "total": {
                      "type": "integer"
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/keys": {
      "get": {
        "operationId": "adminListKeys",
        "summary": "管理员分页查询密钥",
        "description": "服务器过滤后再分页；返回安全字段，不包含密码或密钥哈希。limit默认50，最多100。overview仅作100条预览。",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 1000000,
              "default": 0
            }
          },
          {
            "in": "query",
            "name": "search",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "in": "query",
            "name": "user_id",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string"
            },
            "description": "active/revoked/all；也接受state别名"
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "keys": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AdminKey"
                      }
                    },
                    "total": {
                      "type": "integer"
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/orders": {
      "get": {
        "operationId": "adminListOrders",
        "summary": "管理员分页查询订单",
        "description": "服务器过滤后再分页；返回安全字段，不包含密码或密钥哈希。limit默认50，最多100。overview仅作100条预览。",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 1000000,
              "default": 0
            }
          },
          {
            "in": "query",
            "name": "search",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "in": "query",
            "name": "user_id",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string"
            },
            "description": "资源状态或all"
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "orders": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Order"
                      }
                    },
                    "total": {
                      "type": "integer"
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/tasks": {
      "get": {
        "operationId": "adminListTasks",
        "summary": "管理员分页查询任务",
        "description": "服务器过滤后再分页；返回安全字段，不包含密码或密钥哈希。limit默认50，最多100。overview仅作100条预览。",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 1000000,
              "default": 0
            }
          },
          {
            "in": "query",
            "name": "search",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "in": "query",
            "name": "user_id",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string"
            },
            "description": "资源状态或all"
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "tasks": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AdminTask"
                      }
                    },
                    "total": {
                      "type": "integer"
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/ledger": {
      "get": {
        "operationId": "adminListLedger",
        "summary": "管理员分页查询账本",
        "description": "服务器过滤后再分页；返回安全字段，不包含密码或密钥哈希。limit默认50，最多100。overview仅作100条预览。",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 1000000,
              "default": 0
            }
          },
          {
            "in": "query",
            "name": "search",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "in": "query",
            "name": "user_id",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string"
            },
            "description": "账本type或all"
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ledger": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Ledger"
                      }
                    },
                    "total": {
                      "type": "integer"
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/auth/register": {
      "post": {
        "operationId": "registerAccount",
        "summary": "邮箱验证注册",
        "security": [],
        "description": "新密码6–128字符；必须已成功发出的独立register用途邮件验证码。",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "email",
                  "password",
                  "email_code"
                ],
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email",
                    "maxLength": 254
                  },
                  "password": {
                    "type": "string",
                    "minLength": 6,
                    "maxLength": 128,
                    "writeOnly": true
                  },
                  "email_code": {
                    "type": "string",
                    "pattern": "^[0-9]{6}$"
                  },
                  "referrer": {
                    "type": "string",
                    "maxLength": 200,
                    "description": "选填邀请码或推荐人的完整注册邮箱。注册成功即绑定，只奖励直接推荐人；可以留空。无效推荐人将使注册和验证码消费一同回滚。"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/auth/reset-password": {
      "post": {
        "operationId": "resetPassword",
        "summary": "邮箱验证码重设密码",
        "security": [],
        "description": "新密码6–128字符；成功后撤销该用户旧会话与全部API密钥。",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "email",
                  "password",
                  "email_code"
                ],
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email",
                    "maxLength": 254
                  },
                  "password": {
                    "type": "string",
                    "minLength": 6,
                    "maxLength": 128,
                    "writeOnly": true
                  },
                  "email_code": {
                    "type": "string",
                    "pattern": "^[0-9]{6}$"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/auth/login": {
      "post": {
        "operationId": "loginAccount",
        "summary": "邮箱密码登录",
        "security": [],
        "description": "保持旧密码兼容，登录接受6–256字符；新注册和改密仅6–128。",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "email",
                  "password"
                ],
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email",
                    "maxLength": 254
                  },
                  "password": {
                    "type": "string",
                    "minLength": 6,
                    "maxLength": 256,
                    "writeOnly": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "user": {
                      "$ref": "#/components/schemas/Member"
                    },
                    "csrf": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/client/releases": {
      "get": {
        "summary": "已发布客户端与更新记录（按产品分组）",
        "security": [],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "releases": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ClientRelease"
                      }
                    },
                    "products": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "key": {
                            "type": "string",
                            "enum": [
                              "ai-studio",
                              "auto-edit"
                            ]
                          },
                          "name": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "product",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ai-studio",
                "auto-edit"
              ],
              "default": "ai-studio"
            },
            "description": "客户端产品；省略时 latest 默认 ai-studio，list 返回全部产品"
          }
        ]
      }
    },
    "/api/client/releases/latest": {
      "get": {
        "summary": "最新稳定版及 Ed25519 签名更新清单",
        "security": [],
        "parameters": [
          {
            "in": "query",
            "name": "platform",
            "schema": {
              "const": "win32",
              "default": "win32"
            }
          },
          {
            "in": "query",
            "name": "arch",
            "schema": {
              "const": "x64",
              "default": "x64"
            }
          },
          {
            "in": "query",
            "name": "product",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ai-studio",
                "auto-edit"
              ],
              "default": "ai-studio"
            },
            "description": "客户端产品；省略时 latest 默认 ai-studio，list 返回全部产品"
          }
        ],
        "description": "客户端仅使用固定可信公钥验证 signed_payload 原始字节后解出的JSON；不可自动信任本站公钥端点。signed_payload是base64url，signature是base64；key_id为公钥SPKI DER的完整小写SHA256。download_path相对同一可信源。撤回后返回前一published版本，客户端必须独立拒绝降级。",
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "release": {
                      "$ref": "#/components/schemas/ClientRelease"
                    },
                    "update": {
                      "type": "object",
                      "properties": {
                        "algorithm": {
                          "const": "Ed25519"
                        },
                        "key_id": {
                          "type": "string"
                        },
                        "signed_payload": {
                          "type": "string"
                        },
                        "signature": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/client/releases/signing-key": {
      "get": {
        "summary": "公开验证公钥，供运维固定到客户端",
        "security": [],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "algorithm": {
                      "const": "Ed25519"
                    },
                    "key_id": {
                      "type": "string"
                    },
                    "public_key_pem": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/client/releases/{id}/download": {
      "get": {
        "summary": "下载已发布安装包，撤回后不可访问",
        "security": [],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "Range",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "EXE安装包流，含size/ETag/Accept-Ranges"
          },
          "206": {
            "description": "单段Range响应"
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "416": {
            "description": "Range无效或超出范围"
          }
        }
      },
      "head": {
        "summary": "安装包长度与ETag，不传文件体",
        "security": [],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "Range",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "EXE安装包流，含size/ETag/Accept-Ranges"
          },
          "206": {
            "description": "单段Range响应"
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "416": {
            "description": "Range无效或超出范围"
          }
        }
      }
    },
    "/api/admin/client/releases": {
      "get": {
        "summary": "管理员客户端版本、上传状态及公开签名资料",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "创建不可覆盖版本草稿",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "X-CSRF-Token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "登录或 /api/me 返回的 csrf；不能使用 API Key 代替网页登录"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "version",
                  "notes",
                  "size"
                ],
                "properties": {
                  "version": {
                    "type": "string",
                    "pattern": "^\\d+\\.\\d+\\.\\d+$"
                  },
                  "notes": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 10000
                  },
                  "size": {
                    "type": "integer",
                    "minimum": 128,
                    "maximum": 1073741824
                  },
                  "sha256": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "platform": {
                    "const": "win32"
                  },
                  "arch": {
                    "const": "x64"
                  },
                  "product": {
                    "type": "string",
                    "enum": [
                      "ai-studio",
                      "auto-edit"
                    ],
                    "default": "ai-studio",
                    "description": "省略时按 ai-studio 创建"
                  }
                },
                "description": "同一产品内版本号唯一；(product, version, platform, arch) 唯一，不同产品可共用版本号。"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "release": {
                      "$ref": "#/components/schemas/ClientRelease"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/client/releases/{id}/artifact": {
      "put": {
        "summary": "流式上传EXE，SHA256和PE格式核验",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-CSRF-Token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "登录或 /api/me 返回的 csrf；不能使用 API Key 代替网页登录"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/octet-stream": {
              "schema": {
                "type": "string",
                "format": "binary",
                "maxLength": 1073741824
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "release": {
                      "$ref": "#/components/schemas/ClientRelease"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "超过声明大小或1GiB"
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/client/releases/{id}/publish": {
      "post": {
        "summary": "校验原安装包并签名发布",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-CSRF-Token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "登录或 /api/me 返回的 csrf；不能使用 API Key 代替网页登录"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "maxProperties": 0
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "release": {
                      "$ref": "#/components/schemas/ClientRelease"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/client/releases/{id}/withdraw": {
      "post": {
        "summary": "撤回下载且保留审计，不覆盖版本",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-CSRF-Token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "登录或 /api/me 返回的 csrf；不能使用 API Key 代替网页登录"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "note"
                ],
                "properties": {
                  "note": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1000
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "release": {
                      "$ref": "#/components/schemas/ClientRelease"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/client/releases/{id}/recover": {
      "post": {
        "summary": "核验中断上传，保护期21分钟，绝不自动发布",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-CSRF-Token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "登录或 /api/me 返回的 csrf；不能使用 API Key 代替网页登录"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "maxProperties": 0
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "release": {
                      "$ref": "#/components/schemas/ClientRelease"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/catalog/sync": {
      "post": {
        "summary": "只读同步上游模型与价格，按上游单位成本加价30%、向上取整到分，不提交生成",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "X-CSRF-Token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "登录或 /api/me 返回的 csrf；不能使用 API Key 代替网页登录"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "maxProperties": 0
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/finance": {
      "get": {
        "summary": "财务与利润管理报表",
        "description": "现金收款与测试额度分开；已结算任务按结算日，余额为当前快照。现金消耗按完整账本FIFO分摊。未核对成本和未登记费用明确标注，估算净贡献不是审计净利润。",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "from",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "北京时间日期，最多367天"
          },
          {
            "in": "query",
            "name": "to",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "北京时间日期，最多367天"
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/finance/export": {
      "get": {
        "summary": "导出财务CSV",
        "description": "带UTF-8 BOM并防公式注入；所有金额列均为整数微元。",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "from",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "北京时间日期，最多367天"
          },
          {
            "in": "query",
            "name": "to",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "北京时间日期，最多367天"
          },
          {
            "in": "query",
            "name": "kind",
            "schema": {
              "enum": [
                "tasks",
                "orders",
                "expenses"
              ],
              "default": "tasks"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "财务数据",
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/finance/tasks/{id}/cost": {
      "post": {
        "summary": "追加原任务最终成本对账记录",
        "description": "仅已终态任务；保留每次修订及审计，不向服务商提交请求或扣费。",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-CSRF-Token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "登录或 /api/me 返回的 csrf；不能使用 API Key 代替网页登录"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "amount_micros",
                  "reference",
                  "note"
                ],
                "properties": {
                  "amount_micros": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000000000000
                  },
                  "reference": {
                    "type": "string",
                    "minLength": 6,
                    "maxLength": 500
                  },
                  "note": {
                    "type": "string",
                    "minLength": 4,
                    "maxLength": 500
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/finance/expenses": {
      "post": {
        "summary": "登记已发生费用或上游资金预付",
        "description": "凭证编号全局唯一；上游充值不重复计入生成成本。",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "X-CSRF-Token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "登录或 /api/me 返回的 csrf；不能使用 API Key 代替网页登录"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "amount_micros",
                  "reference",
                  "note",
                  "category",
                  "date"
                ],
                "properties": {
                  "amount_micros": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000000000000
                  },
                  "reference": {
                    "type": "string",
                    "minLength": 6,
                    "maxLength": 500
                  },
                  "note": {
                    "type": "string",
                    "minLength": 4,
                    "maxLength": 500
                  },
                  "category": {
                    "enum": [
                      "payment_fee",
                      "operating_expense",
                      "upstream_topup"
                    ]
                  },
                  "date": {
                    "type": "string",
                    "format": "date"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/finance/expenses/{id}/void": {
      "post": {
        "summary": "保留记录并冲销费用登记",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-CSRF-Token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "登录或 /api/me 返回的 csrf；不能使用 API Key 代替网页登录"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "note"
                ],
                "properties": {
                  "note": {
                    "type": "string",
                    "minLength": 4,
                    "maxLength": 500
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/payments/alipay/setup": {
      "get": {
        "summary": "支付宝开通状态与应用公钥",
        "description": "只返回安全字段，商户支付验收状态来自相同AppID和商户PID的真实支付订单。",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/payments/alipay/prepare-key": {
      "post": {
        "summary": "安全生成RSA2应用密钥，仅返回公钥",
        "description": "已有私钥或待支付订单时拒绝覆盖；私钥加密落盘。",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "X-CSRF-Token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "登录或 /api/me 返回的 csrf；不能使用 API Key 代替网页登录"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "maxProperties": 0
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/payments/alipay/check": {
      "post": {
        "summary": "无扣款签名连接检测",
        "description": "仅查询随机不存在订单并验证支付宝响应签名，不创建或确认交易；不替代签约和真实付款验收。",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "X-CSRF-Token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "登录或 /api/me 返回的 csrf；不能使用 API Key 代替网页登录"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "maxProperties": 0
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/referrals": {
      "get": {
        "summary": "我的推广码、积分和分页明细",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "page",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100000,
              "default": 1
            }
          },
          {
            "in": "query",
            "name": "kind",
            "schema": {
              "enum": [
                "invites",
                "redemptions",
                "ledger"
              ],
              "default": "invites"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/referrals/redemptions": {
      "post": {
        "summary": "冻结积分并申请兑换",
        "description": "每100元真实充值奖励10积分；1积分兑换1元使用额度，审核后入账。积分金额用百万分之一积分，最小0.01积分；每人最多一笔待审核申请。request_id重放返回原申请，不重复冻结。",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "X-CSRF-Token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "登录或 /api/me 返回的 csrf；不能使用 API Key 代替网页登录"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "amount_micros",
                  "request_id"
                ],
                "properties": {
                  "amount_micros": {
                    "type": "integer",
                    "minimum": 10000,
                    "maximum": 1000000000000,
                    "multipleOf": 10000
                  },
                  "request_id": {
                    "type": "string",
                    "pattern": "^[-\\w]{8,100}$"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/referrals/redemptions/{id}/cancel": {
      "post": {
        "summary": "本人撤回待审核申请并释放积分",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-CSRF-Token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "登录或 /api/me 返回的 csrf；不能使用 API Key 代替网页登录"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "maxProperties": 0
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/referrals": {
      "get": {
        "summary": "管理员推广汇总、邀请关系、奖励及兑换审核列表",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "page",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100000,
              "default": 1
            }
          },
          {
            "in": "query",
            "name": "kind",
            "schema": {
              "enum": [
                "redemptions",
                "rewards",
                "bindings",
                "reversals"
              ]
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "enum": [
                "pending",
                "all",
                "approved",
                "rejected",
                "cancelled"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/referrals/redemptions/{id}/approve": {
      "post": {
        "summary": "审核通过并兑换使用额度",
        "description": "仅管理员；不能审核自己的申请；同结果重放幂等，已终态不可改写。积分、余额、账本和审计在同一事务中完成。",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-CSRF-Token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "登录或 /api/me 返回的 csrf；不能使用 API Key 代替网页登录"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "note"
                ],
                "properties": {
                  "note": {
                    "type": "string",
                    "minLength": 4,
                    "maxLength": 500
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/referrals/redemptions/{id}/reject": {
      "post": {
        "summary": "拒绝并释放冻结积分",
        "description": "仅管理员；不能审核自己的申请；同结果重放幂等，已终态不可改写。积分、余额、账本和审计在同一事务中完成。",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-CSRF-Token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "登录或 /api/me 返回的 csrf；不能使用 API Key 代替网页登录"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "note"
                ],
                "properties": {
                  "note": {
                    "type": "string",
                    "minLength": 4,
                    "maxLength": 500
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/referrals/orders/{id}/reverse": {
      "post": {
        "summary": "按已发生现金退款冲回推广积分",
        "description": "id为原充值订单。只登记已核实现金退款，不发起支付退款或直接扣减钱包。累计金额不可倒退，不能超过原金额；不足时取消待审核兑换并记积分欠额。",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-CSRF-Token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "登录或 /api/me 返回的 csrf；不能使用 API Key 代替网页登录"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "refunded_micros",
                  "reference",
                  "note"
                ],
                "properties": {
                  "refunded_micros": {
                    "type": "integer",
                    "minimum": 10000,
                    "maximum": 1000000000000,
                    "multipleOf": 10000
                  },
                  "reference": {
                    "type": "string",
                    "minLength": 6,
                    "maxLength": 150
                  },
                  "note": {
                    "type": "string",
                    "minLength": 4,
                    "maxLength": 500
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/analytics": {
      "get": {
        "summary": "当前账户的完整用量趋势和模型统计",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/activity": {
      "get": {
        "summary": "当前账户操作日志",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/security": {
      "get": {
        "summary": "当前账户安全与登录会话",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/status": {
      "get": {
        "summary": "本站服务与每日目录同步状态",
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/announcements": {
      "get": {
        "summary": "平台公告",
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/catalog/status": {
      "get": {
        "summary": "管理员查看每日04:00模型同步记录、新增下架与调价",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "参数或支付证明无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "请登录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "权限、CSRF 或传输安全校验失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "订单不存在或不属于当前用户",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等冲突、商户身份锁定或订单状态不允许",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求过于频繁",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "商户尚未就绪或暂时不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/studio/video": {
      "post": {
        "summary": "站内创作；登录会话与CSRF校验、相同账户余额及幂等生成",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "X-CSRF-Token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "登录或 /api/me 返回的 csrf；不能使用 API Key 代替网页登录"
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                }
              }
            }
          },
          "202": {
            "description": "已提交，查询同一任务",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                }
              }
            }
          },
          "400": {
            "description": "请求参数、能力或模型未确认",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "密钥失效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "余额不足",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "自己的任务不存在",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等键或请求状态冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "现价超过max_price_micros，请重新报价确认；未创建任务或预占余额",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "已建门户任务，上游明确拒绝，预占已释放",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                }
              }
            }
          },
          "429": {
            "description": "限流",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "尚未开放收费或上游未配置",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/studio/image": {
      "post": {
        "summary": "站内创作；登录会话与CSRF校验、相同账户余额及幂等生成",
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "X-CSRF-Token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "登录或 /api/me 返回的 csrf；不能使用 API Key 代替网页登录"
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                }
              }
            }
          },
          "202": {
            "description": "已提交，查询同一任务",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                }
              }
            }
          },
          "400": {
            "description": "请求参数、能力或模型未确认",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "密钥失效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "余额不足",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "自己的任务不存在",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "幂等键或请求状态冲突",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "412": {
            "description": "现价超过max_price_micros，请重新报价确认；未创建任务或预占余额",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "已建门户任务，上游明确拒绝，预占已释放",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                }
              }
            }
          },
          "429": {
            "description": "限流",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "尚未开放收费或上游未配置",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/client/products": {
      "get": {
        "summary": "可下载的客户端产品目录",
        "security": [],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "products": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "product": {
                            "type": "string",
                            "enum": [
                              "ai-studio",
                              "auto-edit"
                            ]
                          },
                          "name": {
                            "type": "string"
                          },
                          "manifest": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/public/video-routing-health": {
      "get": {
        "operationId": "getPublicVideoRoutingHealth",
        "summary": "按平台视频规格匹配上游24小时已结束任务统计",
        "security": [],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "state": {
                      "enum": [
                        "fresh",
                        "stale",
                        "unavailable"
                      ]
                    },
                    "as_of": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "window_hours": {
                      "type": "integer",
                      "enum": [
                        24
                      ]
                    },
                    "models": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "model_id": {
                            "type": "string"
                          },
                          "upstream_id": {
                            "type": "string"
                          },
                          "completed": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "minimum": 0
                          },
                          "succeeded": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "minimum": 0
                          },
                          "failed": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "minimum": 0
                          },
                          "success_rate_pct": {
                            "type": [
                              "number",
                              "null"
                            ],
                            "minimum": 0,
                            "maximum": 100
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/models/recommendations": {
      "get": {
        "operationId": "recommendModels",
        "summary": "按任务规格和预算推荐已启用模型",
        "description": "初次视频推荐按兼容总价排序，同价看成片表现。确认原任务失败后可传 after_failure 或 exclude，按近24小时同型号成片记录、样本量和价格排序。",
        "parameters": [
          {
            "name": "kind",
            "in": "query",
            "required": true,
            "schema": {
              "enum": [
                "video",
                "image"
              ]
            },
            "description": "任务类型"
          },
          {
            "name": "duration",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0
            },
            "description": "秒数"
          },
          {
            "name": "reference_images",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0
            },
            "description": "参考图片数"
          },
          {
            "name": "max_price",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0
            },
            "description": "单次最高价格，单位为微元"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0
            },
            "description": "返回条数，最多 5 条"
          },
          {
            "name": "after_failure",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "1 表示确认失败后换模型"
          },
          {
            "name": "face",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "1 表示需要真人脸"
          },
          {
            "name": "exclude",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "排除的模型 ID，逗号分隔"
          },
          {
            "name": "ratio",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "视频画幅"
          },
          {
            "name": "resolution",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "视频清晰度"
          },
          {
            "name": "size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "图像尺寸"
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "generated_at": {
                      "type": "string"
                    },
                    "candidates": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "model": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string"
                          },
                          "quote_micros": {
                            "type": "integer"
                          },
                          "why": {
                            "type": "string"
                          },
                          "supplier_success": {
                            "type": "object",
                            "properties": {
                              "state": {
                                "enum": [
                                  "fresh",
                                  "stale",
                                  "unavailable"
                                ]
                              },
                              "as_of": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "format": "date-time"
                              },
                              "window_hours": {
                                "type": "integer",
                                "enum": [
                                  24
                                ]
                              },
                              "completed": {
                                "type": [
                                  "integer",
                                  "null"
                                ],
                                "minimum": 0
                              },
                              "succeeded": {
                                "type": [
                                  "integer",
                                  "null"
                                ],
                                "minimum": 0
                              },
                              "failed": {
                                "type": [
                                  "integer",
                                  "null"
                                ],
                                "minimum": 0
                              },
                              "success_rate_pct": {
                                "type": [
                                  "number",
                                  "null"
                                ],
                                "minimum": 0,
                                "maximum": 100
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "689API用户Key"
      },
      "sessionCookie": {
        "type": "apiKey",
        "in": "cookie",
        "name": "api666888_session",
        "description": "沿用旧 Cookie 名以兼容升级；登录时由服务器设置 HttpOnly Cookie"
      }
    },
    "schemas": {
      "Task": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "enum": [
              "image",
              "video"
            ]
          },
          "operation": {
            "enum": [
              "generate",
              "edit"
            ]
          },
          "model": {
            "type": "string"
          },
          "status": {
            "enum": [
              "dispatching",
              "queued",
              "processing",
              "completed",
              "failed",
              "unknown"
            ]
          },
          "url": {
            "type": [
              "string",
              "null"
            ]
          },
          "video_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "download_path": {
            "type": [
              "string",
              "null"
            ]
          },
          "price_micros": {
            "type": "integer"
          },
          "charged_micros": {
            "type": "integer"
          },
          "held_micros": {
            "type": "integer"
          },
          "unit_price_micros": {
            "type": "integer"
          },
          "unit": {
            "enum": [
              "request",
              "second"
            ]
          },
          "units": {
            "type": "integer"
          },
          "duration": {
            "type": [
              "integer",
              "null"
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "url": {
                  "type": "string",
                  "format": "uri"
                }
              }
            }
          },
          "idempotency_key": {
            "type": "string",
            "description": "只对任务拥有者或管理员返回；断连后查找同一请求，避免重复生成"
          },
          "content_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "统一认证媒体地址；使用本门户Key请求，跨域302不得继续携带Key"
          },
          "diagnostic": {
            "type": "object",
            "description": "已核实的供应商终态可携带安全分类。以交付状态和钱包字段分别确认成片和实际扣费。",
            "properties": {
              "category": {
                "type": "string",
                "description": "供应商失败分类；unspecified 表示原因尚无可靠证据。"
              },
              "source": {
                "type": "string"
              },
              "upstream_code": {
                "type": "string"
              },
              "safe_message": {
                "type": "string"
              },
              "reference_index": {
                "type": "integer",
                "minimum": 1,
                "maximum": 30
              },
              "observed_at": {
                "type": "string",
                "format": "date-time"
              }
            }
          },
          "progress": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0,
            "maximum": 100,
            "description": "上游真实百分比；未提供时为null。100%也可能失败。以result_state=available及下载地址确认交付。"
          },
          "provider_status": {
            "type": [
              "string",
              "null"
            ]
          },
          "progress_updated_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_poll_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "sync_stale": {
            "type": "boolean"
          },
          "poll_failures": {
            "type": "integer"
          },
          "progress_source": {
            "enum": [
              "provider",
              "unavailable"
            ]
          },
          "result_state": {
            "enum": [
              "pending",
              "verifying",
              "available",
              "failed"
            ]
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      },
      "PaymentChannel": {
        "type": "object",
        "properties": {
          "id": {
            "enum": [
              "manual",
              "wechat",
              "alipay"
            ]
          },
          "label": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "configured": {
            "type": "boolean"
          },
          "ready": {
            "type": "boolean"
          },
          "reason": {
            "type": "string"
          }
        }
      },
      "Order": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "amount_micros": {
            "type": "integer",
            "description": "充值本金，单位微元"
          },
          "channel": {
            "enum": [
              "manual",
              "wechat",
              "alipay"
            ]
          },
          "status": {
            "enum": [
              "pending_review",
              "creating",
              "pending",
              "create_unknown",
              "create_failed",
              "paid",
              "closed",
              "rejected"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "paid_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "transaction_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "付款入口显示期限，不是商户已关单证明。过期后仍可能收到合法支付通知"
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "error_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "payment": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "required": [
                  "type",
                  "code_url"
                ],
                "properties": {
                  "type": {
                    "const": "qr"
                  },
                  "code_url": {
                    "type": "string",
                    "description": "微信原始支付链接，由客户端本地编码 QR，不能发送给第三方编码服务"
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "type",
                  "redirect_url"
                ],
                "properties": {
                  "type": {
                    "const": "redirect"
                  },
                  "redirect_url": {
                    "type": "string",
                    "format": "uri",
                    "description": "支付宝签名官方跳转 URL。浏览器返回站点不代表支付成功"
                  }
                }
              }
            ]
          },
          "credit_source": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "manual_payment",
              "test_credit",
              "merchant_payment",
              null
            ],
            "description": "实际人工收款、管理员测试额度、已验签商户收款；历史未知来源为null，不能当作已核实现金"
          }
        }
      },
      "PaymentSettings": {
        "type": "object",
        "properties": {
          "wechat": {
            "type": "object",
            "properties": {
              "enabled": {
                "type": "boolean"
              },
              "configured": {
                "type": "boolean",
                "readOnly": true
              },
              "ready": {
                "type": "boolean",
                "readOnly": true
              },
              "real_merchant_verified": {
                "const": false,
                "description": "本地配置检查不能代表真实商户付款验收"
              },
              "missing_fields": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "callback_url": {
                "type": "string",
                "format": "uri"
              },
              "pending_orders": {
                "type": "integer",
                "description": "最多显示 100 笔待核验订单"
              },
              "pending_order_refs": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "merchant_order_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "expires_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              },
              "credential_rotation_notice": {
                "type": "string"
              },
              "app_id": {
                "type": "string"
              },
              "mchid": {
                "type": "string"
              },
              "merchant_serial_no": {
                "type": "string"
              },
              "platform_key_id": {
                "type": "string"
              },
              "private_key_configured": {
                "type": "boolean",
                "readOnly": true
              },
              "api_v3_key_configured": {
                "type": "boolean",
                "readOnly": true
              },
              "platform_public_key_configured": {
                "type": "boolean",
                "readOnly": true
              }
            }
          },
          "alipay": {
            "type": "object",
            "properties": {
              "enabled": {
                "type": "boolean"
              },
              "configured": {
                "type": "boolean",
                "readOnly": true
              },
              "ready": {
                "type": "boolean",
                "readOnly": true
              },
              "real_merchant_verified": {
                "const": false,
                "description": "本地配置检查不能代表真实商户付款验收"
              },
              "missing_fields": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "callback_url": {
                "type": "string",
                "format": "uri"
              },
              "pending_orders": {
                "type": "integer",
                "description": "最多显示 100 笔待核验订单"
              },
              "pending_order_refs": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "merchant_order_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "expires_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              },
              "credential_rotation_notice": {
                "type": "string"
              },
              "app_id": {
                "type": "string"
              },
              "seller_id": {
                "type": "string"
              },
              "private_key_configured": {
                "type": "boolean",
                "readOnly": true
              },
              "alipay_public_key_configured": {
                "type": "boolean",
                "readOnly": true
              }
            }
          }
        }
      },
      "PaymentSettingsUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "wechat": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "enabled": {
                "type": "boolean"
              },
              "app_id": {
                "type": "string"
              },
              "mchid": {
                "type": "string"
              },
              "merchant_serial_no": {
                "type": "string"
              },
              "platform_key_id": {
                "type": "string"
              },
              "private_key": {
                "type": "string",
                "writeOnly": true,
                "maxLength": 16000,
                "description": "仅写入；省略或空字符串保留当前值。请勿写入聊天、日志或 URL"
              },
              "api_v3_key": {
                "type": "string",
                "writeOnly": true,
                "maxLength": 16000,
                "description": "32 字节 APIv3 密钥；留空保留"
              },
              "platform_public_key": {
                "type": "string",
                "writeOnly": true,
                "maxLength": 16000,
                "description": "仅写入；省略或空字符串保留当前值。请勿写入聊天、日志或 URL"
              },
              "clear_private_key": {
                "type": "boolean"
              },
              "clear_api_v3_key": {
                "type": "boolean"
              },
              "clear_platform_public_key": {
                "type": "boolean"
              }
            }
          },
          "alipay": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "enabled": {
                "type": "boolean"
              },
              "app_id": {
                "type": "string"
              },
              "seller_id": {
                "type": "string"
              },
              "private_key": {
                "type": "string",
                "writeOnly": true,
                "maxLength": 16000,
                "description": "仅写入；省略或空字符串保留当前值。请勿写入聊天、日志或 URL"
              },
              "alipay_public_key": {
                "type": "string",
                "writeOnly": true,
                "maxLength": 16000,
                "description": "仅写入；省略或空字符串保留当前值。请勿写入聊天、日志或 URL"
              },
              "clear_private_key": {
                "type": "boolean"
              },
              "clear_alipay_public_key": {
                "type": "boolean"
              }
            }
          }
        }
      },
      "Member": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "role": {
            "enum": [
              "admin",
              "user"
            ]
          },
          "balance_micros": {
            "type": "integer",
            "description": "人民币微元；1元=1,000,000微元"
          },
          "held_micros": {
            "type": "integer",
            "description": "人民币微元；1元=1,000,000微元"
          },
          "available_micros": {
            "type": "integer",
            "description": "人民币微元；1元=1,000,000微元"
          },
          "email_verified": {
            "type": "boolean"
          },
          "active_key_count": {
            "type": "integer"
          },
          "key_count": {
            "type": "integer"
          },
          "task_count": {
            "type": "integer"
          },
          "completed_task_count": {
            "type": "integer"
          },
          "spent_micros": {
            "type": "integer"
          },
          "credited_micros": {
            "type": "integer"
          },
          "test_credit_micros": {
            "type": "integer"
          },
          "pending_order_count": {
            "type": "integer"
          }
        }
      },
      "AdminKey": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "user_id": {
            "type": "string"
          },
          "user_email": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "prefix": {
            "type": "string",
            "description": "仅掩码前缀与尾部，不可用于调用"
          },
          "status": {
            "enum": [
              "active",
              "revoked"
            ]
          },
          "created_at": {
            "type": "string"
          },
          "revoked_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_used_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "task_count": {
            "type": "integer"
          },
          "charged_micros": {
            "type": "integer",
            "description": "人民币微元；1元=1,000,000微元"
          },
          "held_micros": {
            "type": "integer",
            "description": "人民币微元；1元=1,000,000微元"
          }
        }
      },
      "AdminTask": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Task"
          },
          {
            "type": "object",
            "properties": {
              "user_id": {
                "type": "string"
              },
              "email": {
                "type": "string"
              },
              "key_id": {
                "type": "string"
              },
              "key_name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "key_prefix": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "estimated_cost_micros": {
                "type": "integer",
                "description": "人民币微元；1元=1,000,000微元"
              },
              "cost_basis": {
                "const": "published_estimate"
              }
            }
          }
        ]
      },
      "Ledger": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "user_id": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "type": {
            "enum": [
              "recharge",
              "generation_hold",
              "generation_charge",
              "generation_release"
            ]
          },
          "delta_micros": {
            "type": "integer",
            "description": "人民币微元；1元=1,000,000微元"
          },
          "amount_micros": {
            "type": "integer",
            "description": "人民币微元；1元=1,000,000微元"
          },
          "held_delta_micros": {
            "type": "integer",
            "description": "人民币微元；1元=1,000,000微元"
          },
          "balance_after_micros": {
            "type": "integer",
            "description": "人民币微元；1元=1,000,000微元"
          },
          "held_after_micros": {
            "type": "integer",
            "description": "人民币微元；1元=1,000,000微元"
          },
          "related_id": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "credit_source": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "manual_payment",
              "test_credit",
              "merchant_payment",
              null
            ],
            "description": "实际人工收款、管理员测试额度、已验签商户收款；历史未知来源为null，不能当作已核实现金"
          },
          "created_at": {
            "type": "string"
          }
        }
      },
      "Quote": {
        "type": "object",
        "properties": {
          "object": {
            "const": "quote"
          },
          "kind": {
            "enum": [
              "image",
              "video"
            ]
          },
          "operation": {
            "enum": [
              "generate",
              "edit"
            ]
          },
          "model": {
            "type": "string"
          },
          "price_micros": {
            "type": "integer",
            "description": "人民币微元；1元=1,000,000微元"
          },
          "unit_price_micros": {
            "type": "integer",
            "description": "人民币微元；1元=1,000,000微元"
          },
          "unit": {
            "enum": [
              "request",
              "second"
            ]
          },
          "units": {
            "type": "integer"
          },
          "reference_images_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "duration": {
            "type": [
              "integer",
              "null"
            ]
          },
          "available": {
            "type": "integer",
            "description": "人民币微元；1元=1,000,000微元"
          },
          "available_micros": {
            "type": "integer",
            "description": "人民币微元；1元=1,000,000微元"
          },
          "enough": {
            "type": "boolean"
          },
          "generation_enabled": {
            "type": "boolean"
          },
          "source_version": {
            "type": [
              "string",
              "null"
            ]
          },
          "pricing_at": {
            "type": "string"
          },
          "notice": {
            "type": "string"
          },
          "smart_ladder": {
            "type": "boolean",
            "description": "智能报价时为 true。"
          },
          "min_price_micros": {
            "type": "integer",
            "minimum": 1,
            "description": "此次条件匹配的最低档总价，单位微元。"
          },
          "hold_cap_micros": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9000000,
            "description": "本次兼容候选的最高总价。平台以该上限预占，成功后按实际档位结算并释放差额。"
          },
          "ceiling_micros": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9000000,
            "description": "智能阶梯的有效预算上限，最高人民币9元。"
          },
          "candidate_ladder": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "price_micros"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "price_micros": {
                  "type": "integer",
                  "minimum": 1
                },
                "resolution": {
                  "type": "string"
                },
                "circuit": {
                  "type": "string"
                }
              }
            }
          },
          "quote_revision": {
            "type": "string",
            "description": "此组参数的报价标识。"
          },
          "routing_advice": {
            "type": "object",
            "properties": {
              "state": {
                "enum": [
                  "fresh",
                  "stale",
                  "unavailable"
                ]
              },
              "as_of": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "window_hours": {
                "type": "integer",
                "enum": [
                  24
                ]
              },
              "mode": {
                "type": "string",
                "enum": [
                  "price_first",
                  "balanced"
                ],
                "default": "price_first",
                "description": "智能视频默认先试兼容最低价，同价依据上游统计排序。可安全换线时，按近24小时成片率、样本量和价格挑选预算内备选。balanced 从首档就综合比较。"
              },
              "fallback_policy": {
                "enum": [
                  "live_success_per_price"
                ]
              },
              "minimum_price_micros": {
                "type": "integer"
              },
              "reason": {
                "type": "string"
              },
              "first": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "model_id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "price_micros": {
                    "type": "integer"
                  },
                  "completed": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0
                  },
                  "succeeded": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0
                  },
                  "failed": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0
                  },
                  "success_rate_pct": {
                    "type": [
                      "number",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 100
                  }
                }
              }
            }
          }
        }
      },
      "ClientRelease": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^rel_[a-f0-9]{32}$"
          },
          "version": {
            "type": "string"
          },
          "platform": {
            "const": "win32"
          },
          "arch": {
            "const": "x64"
          },
          "notes": {
            "type": "string"
          },
          "status": {
            "enum": [
              "draft",
              "uploading",
              "ready",
              "published",
              "withdrawn"
            ]
          },
          "size": {
            "type": [
              "integer",
              "null"
            ],
            "maximum": 1073741824
          },
          "sha256": {
            "type": [
              "string",
              "null"
            ]
          },
          "published_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "download_path": {
            "type": [
              "string",
              "null"
            ]
          },
          "product": {
            "type": "string",
            "enum": [
              "ai-studio",
              "auto-edit"
            ]
          },
          "product_name": {
            "type": "string",
            "description": "集星AI制作 / 集星短剧自动剪辑"
          }
        }
      }
    }
  }
}
