{
  "openapi": "3.1.0",
  "info": {
    "title": "OneAster API",
    "version": "0.28.0",
    "description": "Implemented external OneAster Core APIs. Authentication and runtime capability switches apply. Models and prices come from the current account catalog; internal services and unimplemented provider APIs are excluded."
  },
  "servers": [
    {
      "url": "https://api.oneaster.ai"
    }
  ],
  "paths": {
    "/core/v1/billing/stripe-test": {
      "get": {
        "operationId": "get_core_v1_billing_stripe_test",
        "summary": "隔离环境Stripe测试支付能力；真实收款保持关闭",
        "tags": [
          "session"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "隔离环境Stripe测试支付能力；真实收款保持关闭",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/StripeTestCapabilities"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/core/v1/topup-orders": {
      "post": {
        "operationId": "post_core_v1_topup_orders",
        "summary": "创建测试订单并单次创建Checkout；同意图返回原订单",
        "tags": [
          "session"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "创建测试订单并单次创建Checkout；同意图返回原订单",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/TopupOrderResult"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "201": {
            "description": "创建测试订单并单次创建Checkout；同意图返回原订单",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/TopupOrderResult"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TopupOrderInput"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "get_core_v1_topup_orders",
        "summary": "本人测试充值订单；不是实际支付收据",
        "tags": [
          "session"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000000,
              "default": 1
            }
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "state",
            "in": "query",
            "schema": {
              "enum": [
                "creating",
                "unknown",
                "open",
                "paid",
                "expired",
                "failed"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "本人测试充值订单；不是实际支付收据",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/TopupOrderPage"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/core/v1/topup-orders/{id}": {
      "get": {
        "operationId": "get_core_v1_topup_orders__id_",
        "summary": "本人测试订单详情；越权404",
        "tags": [
          "session"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "本人测试订单详情；越权404",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/TopupOrder"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/core/v1/admin/topup-orders": {
      "get": {
        "operationId": "get_core_v1_admin_topup_orders",
        "summary": "管理员测试订单；不返回支付链接",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000000,
              "default": 1
            }
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "state",
            "in": "query",
            "schema": {
              "enum": [
                "creating",
                "unknown",
                "open",
                "paid",
                "expired",
                "failed"
              ]
            }
          },
          {
            "name": "user_id",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]*$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "管理员测试订单；不返回支付链接",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/TopupOrderPage"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      }
    },
    "/core/v1/admin/topup-orders/{id}/reconcile": {
      "post": {
        "operationId": "post_core_v1_admin_topup_orders__id__reconcile",
        "summary": "对已知Session只读查证并原子核账；不创建付款会话",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "对已知Session只读查证并原子核账；不创建付款会话",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/TopupOrderResult"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      }
    },
    "/core/v1/billing/stripe-test/webhook": {
      "post": {
        "operationId": "post_core_v1_billing_stripe_test_webhook",
        "summary": "原始字节验签、服务端查证与幂等测试入账",
        "tags": [
          "public"
        ],
        "security": [],
        "parameters": [
          {
            "name": "Stripe-Signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 4096
            },
            "description": "Stripe官方签名；不能由前端代填或改写原始body。"
          }
        ],
        "responses": {
          "200": {
            "description": "原始字节验签、服务端查证与幂等测试入账",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/StripeWebhookResult"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StripeWebhook"
              }
            }
          }
        }
      }
    },
    "/core/v1/admin/tasks/{id}/content": {
      "get": {
        "operationId": "get_core_v1_admin_tasks__id__content",
        "summary": "平台负责人预览已结算归档PNG；审计提交成功后才返回字节",
        "tags": [
          "owner"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "已结算且归档的PNG；固定UUID文件名、image/png、no-store、nosniff、ETag为原产物SHA256。不存在404，未结算/未归档409 artifact_unavailable，视频409 provider_url_delivery。",
            "content": {
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "仅当前有效平台负责人；普通管理员403 owner_required。授权读取先原子提交task.artifact.preview审计，再发送归档PNG；审计失败不返回字节，不改资金或请求供应商。本人和Key内容归属入口保持原样。 需要当前会话 platform_owner=true；管理员角色变更验证负责人当前密码、版本和幂等键；不能撤销平台负责人的管理员身份。admin=true 不自动拥有员工授权能力。"
      }
    },
    "/core/v1/keys/{id}/task-models": {
      "get": {
        "operationId": "get_core_v1_keys__id__task_models",
        "summary": "本人有效Key可用任务目录；按Key模型范围、账户组和渠道过滤",
        "tags": [
          "session"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "schema": {
              "enum": [
                "image",
                "video"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "本人有效Key可用任务目录；按Key模型范围、账户组和渠道过滤",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/TaskModel"
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/core/v1/keys/{id}/tasks": {
      "post": {
        "operationId": "post_core_v1_keys__id__tasks",
        "summary": "本人会话和有效Key ID提交图片/视频；原报价双预算与稳定意图",
        "tags": [
          "session"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "202": {
            "description": "本人会话和有效Key ID提交图片/视频；原报价双预算与稳定意图",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/TaskAccepted"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskInput"
              }
            }
          }
        }
      }
    },
    "/core/v1/keys/{id}/tasks/lookup": {
      "post": {
        "operationId": "post_core_v1_keys__id__tasks_lookup",
        "summary": "只读查询本人任务原意图；Key撤销后仍可查历史",
        "tags": [
          "session"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "只读查询本人任务原意图；Key撤销后仍可查历史",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "recorded": {
                          "type": "boolean"
                        },
                        "task": {
                          "anyOf": [
                            {
                              "$ref": "#/components/schemas/TaskAccepted"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "recorded",
                        "task"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskInput"
              }
            }
          }
        }
      }
    },
    "/core/v1/admin/task-insights": {
      "get": {
        "operationId": "get_core_v1_admin_task_insights",
        "summary": "持久化图片/视频采购成本与终态健康汇总、规格分组分页",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000000,
              "default": 1
            }
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "包含from，不包含to；UTC、最多微秒精度，默认最近30天、最长366天。"
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "包含from，不包含to；UTC、最多微秒精度，默认最近30天、最长366天。"
          },
          {
            "name": "user_id",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "key_id",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "provider_id",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "model",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "upstream_model",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "kind",
            "in": "query",
            "schema": {
              "enum": [
                "image",
                "video"
              ]
            }
          },
          {
            "name": "input_mode",
            "in": "query",
            "schema": {
              "enum": [
                "text_to_image",
                "text_to_video",
                "image_to_video"
              ]
            }
          },
          {
            "name": "state",
            "in": "query",
            "schema": {
              "enum": [
                "queued",
                "submitting",
                "submitted",
                "running",
                "success",
                "failed",
                "rejected",
                "unknown"
              ]
            }
          },
          {
            "name": "billing_state",
            "in": "query",
            "schema": {
              "enum": [
                "reserved",
                "settled",
                "released"
              ]
            }
          },
          {
            "name": "cost_status",
            "in": "query",
            "schema": {
              "enum": [
                "reported",
                "unreported",
                "invalid_evidence"
              ]
            }
          },
          {
            "name": "resolution",
            "in": "query",
            "schema": {
              "enum": [
                "480p",
                "720p",
                "1080p"
              ]
            }
          },
          {
            "name": "duration",
            "in": "query",
            "schema": {
              "enum": [
                5,
                10
              ]
            }
          },
          {
            "name": "issue",
            "in": "query",
            "schema": {
              "enum": [
                "unresolved",
                "cost_mismatch",
                "nonzero_failure",
                "invalid_evidence",
                "unreported_terminal"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "持久化图片/视频采购成本与终态健康汇总、规格分组分页",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/TaskInsights"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。 严格交集筛选，未知/重复/空/非法参数400；8秒查询期限。单语句快照；只读本地证据，无供应商调用。采购报价不是实际支出，报告费用覆盖见reported/unreported/invalid计数。分组按原渠道、模型、上游、kind、画质、时长、输入模式；groups分页不影响完整summary；不包含文本采购成本、余额或利润。"
      }
    },
    "/core/v1/admin/task-costs": {
      "get": {
        "operationId": "get_core_v1_admin_task_costs",
        "summary": "任务采购费用与核账异常明细；不返回提示词/产物URL/凭据",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000000,
              "default": 1
            }
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "包含from，不包含to；UTC、最多微秒精度，默认最近30天、最长366天。"
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "包含from，不包含to；UTC、最多微秒精度，默认最近30天、最长366天。"
          },
          {
            "name": "user_id",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "key_id",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "provider_id",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "model",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "upstream_model",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "kind",
            "in": "query",
            "schema": {
              "enum": [
                "image",
                "video"
              ]
            }
          },
          {
            "name": "input_mode",
            "in": "query",
            "schema": {
              "enum": [
                "text_to_image",
                "text_to_video",
                "image_to_video"
              ]
            }
          },
          {
            "name": "state",
            "in": "query",
            "schema": {
              "enum": [
                "queued",
                "submitting",
                "submitted",
                "running",
                "success",
                "failed",
                "rejected",
                "unknown"
              ]
            }
          },
          {
            "name": "billing_state",
            "in": "query",
            "schema": {
              "enum": [
                "reserved",
                "settled",
                "released"
              ]
            }
          },
          {
            "name": "cost_status",
            "in": "query",
            "schema": {
              "enum": [
                "reported",
                "unreported",
                "invalid_evidence"
              ]
            }
          },
          {
            "name": "resolution",
            "in": "query",
            "schema": {
              "enum": [
                "480p",
                "720p",
                "1080p"
              ]
            }
          },
          {
            "name": "duration",
            "in": "query",
            "schema": {
              "enum": [
                5,
                10
              ]
            }
          },
          {
            "name": "issue",
            "in": "query",
            "schema": {
              "enum": [
                "unresolved",
                "cost_mismatch",
                "nonzero_failure",
                "invalid_evidence",
                "unreported_terminal"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "任务采购费用与核账异常明细；不返回提示词/产物URL/凭据",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/TaskCosts"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。 严格交集筛选，未知/重复/空/非法参数400；8秒查询期限。单语句快照；只读本地证据，无供应商调用。采购报价不是实际支出，报告费用覆盖见reported/unreported/invalid计数。分组按原渠道、模型、上游、kind、画质、时长、输入模式；groups分页不影响完整summary；不包含文本采购成本、余额或利润。"
      }
    },
    "/core/v1/admin/users/{id}/group": {
      "post": {
        "operationId": "post_core_v1_admin_users__id__group",
        "summary": "调整账号路由分组；撤销会话，Key 下一请求使用新分组",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "调整账号路由分组；撤销会话，Key 下一请求使用新分组",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/RevisionResult"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "验证操作者当前密码；expected_version 使用目标用户 auth_version。幂等键在操作者范围唯一；重放不再次变更。启停、改密、分组修改和撤销会话均增加版本并删除会话。旧会话不会因重新启用恢复。管理员账号仅由平台负责人管理；本人和负责人不可停用。已 forwarding 的调用继续结算。 需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChangeGroup"
              }
            }
          }
        }
      }
    },
    "/core/v1/token-estimate": {
      "post": {
        "operationId": "post_core_v1_token_estimate",
        "summary": "模型输入预估与预留报价；无上游调用、无资金变动",
        "tags": [
          "session"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "模型输入预估与预留报价；无上游调用、无资金变动",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/TokenEstimate"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Chat"
              }
            }
          }
        }
      }
    },
    "/core/v1/admin/users": {
      "get": {
        "operationId": "get_core_v1_admin_users",
        "summary": "账号列表、版本、额度和用户名筛选",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000000,
              "default": 1
            }
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "账号列表、版本、额度和用户名筛选",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/UserSummary"
                          }
                        },
                        "total": {
                          "type": "string",
                          "pattern": "^[0-9]+$"
                        },
                        "page": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "size": {
                          "type": "integer",
                          "minimum": 0
                        }
                      },
                      "required": [
                        "items",
                        "total",
                        "page",
                        "size"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      },
      "post": {
        "operationId": "post_core_v1_admin_users",
        "summary": "邀请普通用户",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000000,
              "default": 1
            }
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          }
        ],
        "responses": {
          "201": {
            "description": "邀请普通用户",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^[0-9]+$"
                        }
                      },
                      "required": [
                        "id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InviteUser"
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      }
    },
    "/core/v1/admin/users/{id}": {
      "patch": {
        "operationId": "patch_core_v1_admin_users__id_",
        "summary": "账号启停；撤销全部会话，禁止停用本人和平台负责人",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "账号启停；撤销全部会话，禁止停用本人和平台负责人",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/RevisionResult"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "验证操作者当前密码；expected_version 使用目标用户 auth_version。幂等键在操作者范围唯一；重放不再次变更。启停、改密、分组修改和撤销会话均增加版本并删除会话。旧会话不会因重新启用恢复。管理员账号仅由平台负责人管理；本人和负责人不可停用。已 forwarding 的调用继续结算。 需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountState"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "get_core_v1_admin_users__id_",
        "summary": "平台所有者验证员工目标用户",
        "tags": [
          "owner"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "平台所有者验证员工目标用户",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^[0-9]+$"
                        },
                        "username": {
                          "type": "string"
                        },
                        "enabled": {
                          "type": "boolean"
                        },
                        "issuer": {
                          "type": "string",
                          "format": "uuid"
                        }
                      },
                      "required": [
                        "id",
                        "username",
                        "enabled",
                        "issuer"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "需要当前会话 platform_owner=true；管理员角色变更验证负责人当前密码、版本和幂等键；不能撤销平台负责人的管理员身份。admin=true 不自动拥有员工授权能力。"
      }
    },
    "/core/v1/admin/users/{id}/sessions/revoke": {
      "post": {
        "operationId": "post_core_v1_admin_users__id__sessions_revoke",
        "summary": "撤销全部会话；API Key 继续有效",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "撤销全部会话；API Key 继续有效",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/RevisionResult"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "验证操作者当前密码；expected_version 使用目标用户 auth_version。幂等键在操作者范围唯一；重放不再次变更。启停、改密、分组修改和撤销会话均增加版本并删除会话。旧会话不会因重新启用恢复。管理员账号仅由平台负责人管理；本人和负责人不可停用。已 forwarding 的调用继续结算。 需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RevokeSessions"
              }
            }
          }
        }
      }
    },
    "/core/v1/auth/password": {
      "post": {
        "operationId": "post_core_v1_auth_password",
        "summary": "验证旧密码后改密并撤销全部会话",
        "tags": [
          "session"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "验证旧密码后改密并撤销全部会话",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/RevisionResult"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "验证操作者当前密码；expected_version 使用目标用户 auth_version。幂等键在操作者范围唯一；重放不再次变更。启停、改密、分组修改和撤销会话均增加版本并删除会话。旧会话不会因重新启用恢复。管理员账号仅由平台负责人管理；本人和负责人不可停用。已 forwarding 的调用继续结算。",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChangePassword"
              }
            }
          }
        }
      }
    },
    "/core/v1/admin/channels/{id}/credentials": {
      "post": {
        "operationId": "post_core_v1_admin_channels__id__credentials",
        "summary": "轮换供应商凭据；CAS 与幂等",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "同一幂等操作的原结果；不重新激活旧配置",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/RevisionResult"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "201": {
            "description": "轮换供应商凭据；CAS 与幂等",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/RevisionResult"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "expected_version 必须是当前版本；Idempotency-Key 对象内唯一。相同操作重放不重复变更。冲突返回 409。已发出的请求保持其原配置快照。 需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RotateCredentials"
              }
            }
          }
        }
      }
    },
    "/core/v1/admin/channels/{id}/credentials/history": {
      "get": {
        "operationId": "get_core_v1_admin_channels__id__credentials_history",
        "summary": "凭据版本历史；不保存或返回旧秘密",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000000,
              "default": 1
            }
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "凭据版本历史；不保存或返回旧秘密",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/CredentialEvent"
                          }
                        },
                        "total": {
                          "type": "string",
                          "pattern": "^[0-9]+$"
                        },
                        "page": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "size": {
                          "type": "integer",
                          "minimum": 0
                        }
                      },
                      "required": [
                        "items",
                        "total",
                        "page",
                        "size"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      }
    },
    "/core/v1/admin/models": {
      "get": {
        "operationId": "get_core_v1_admin_models",
        "summary": "当前完整模型配置；分页与型号搜索",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000000,
              "default": 1
            }
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "当前完整模型配置；分页与型号搜索",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/ModelConfiguration"
                          }
                        },
                        "total": {
                          "type": "string",
                          "pattern": "^[0-9]+$"
                        },
                        "page": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "size": {
                          "type": "integer",
                          "minimum": 0
                        }
                      },
                      "required": [
                        "items",
                        "total",
                        "page",
                        "size"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      },
      "post": {
        "operationId": "post_core_v1_admin_models",
        "summary": "创建独立模型价格与计量配置",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000000,
              "default": 1
            }
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "201": {
            "description": "创建独立模型价格与计量配置",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^[0-9]+$"
                        }
                      },
                      "required": [
                        "id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateModel"
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      }
    },
    "/core/v1/admin/models/{id}/revisions": {
      "post": {
        "operationId": "post_core_v1_admin_models__id__revisions",
        "summary": "原子修订价格/映射/上限；回退也追加版本",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "同一幂等操作的原结果；不重新激活旧配置",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/RevisionResult"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "201": {
            "description": "原子修订价格/映射/上限；回退也追加版本",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/RevisionResult"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "expected_version 必须是当前版本；Idempotency-Key 对象内唯一。相同操作重放不重复变更。冲突返回 409。已发出的请求保持其原配置快照。 需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReviseModel"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "get_core_v1_admin_models__id__revisions",
        "summary": "不可变配置历史",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000000,
              "default": 1
            }
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "不可变配置历史",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/ModelRevision"
                          }
                        },
                        "total": {
                          "type": "string",
                          "pattern": "^[0-9]+$"
                        },
                        "page": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "size": {
                          "type": "integer",
                          "minimum": 0
                        }
                      },
                      "required": [
                        "items",
                        "total",
                        "page",
                        "size"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      }
    },
    "/core/v1/admin/requests/{id}": {
      "get": {
        "operationId": "get_core_v1_admin_requests__id_",
        "summary": "按请求快照查询渠道、凭据版本和原价格",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "按请求快照查询渠道、凭据版本和原价格",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/AdminRequest"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      }
    },
    "/core/health/live": {
      "get": {
        "operationId": "get_core_health_live",
        "summary": "进程存活",
        "tags": [
          "public"
        ],
        "security": [],
        "parameters": [],
        "responses": {
          "200": {
            "description": "进程存活",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {}
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/core/health/ready": {
      "get": {
        "operationId": "get_core_health_ready",
        "summary": "PG 与执行锁就绪",
        "tags": [
          "public"
        ],
        "security": [],
        "parameters": [],
        "responses": {
          "200": {
            "description": "PG 与执行锁就绪",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {}
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/core/v1/models/public": {
      "get": {
        "operationId": "get_core_v1_models_public",
        "summary": "公开启用模型及售价；不含供应商信息",
        "tags": [
          "public"
        ],
        "security": [],
        "parameters": [],
        "responses": {
          "200": {
            "description": "公开启用模型及售价；不含供应商信息",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Model"
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/core/v1/status": {
      "get": {
        "operationId": "get_core_v1_status",
        "summary": "原型能力与支付关闭状态",
        "tags": [
          "public"
        ],
        "security": [],
        "parameters": [],
        "responses": {
          "200": {
            "description": "原型能力与支付关闭状态",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {}
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/core/v1/auth/login": {
      "post": {
        "operationId": "post_core_v1_auth_login",
        "summary": "密码登录；会话一小时",
        "tags": [
          "public"
        ],
        "security": [],
        "parameters": [],
        "responses": {
          "200": {
            "description": "密码登录；会话一小时",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/LoginResult"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Login"
              }
            }
          }
        }
      }
    },
    "/core/v1/auth/logout": {
      "post": {
        "operationId": "post_core_v1_auth_logout",
        "summary": "撤销当前会话",
        "tags": [
          "session"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "撤销当前会话",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "null"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/core/v1/auth/email-verifications": {
      "post": {
        "operationId": "post_core_v1_auth_email_verifications",
        "summary": "发送注册邮箱证明；注册开关与邮件配置均须启用",
        "tags": [
          "public"
        ],
        "security": [],
        "parameters": [],
        "responses": {
          "202": {
            "description": "发送注册邮箱证明；注册开关与邮件配置均须启用",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/EmailAccepted"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmailRequest"
              }
            }
          }
        }
      }
    },
    "/core/v1/auth/register": {
      "post": {
        "operationId": "post_core_v1_auth_register",
        "summary": "按注册模式创建零余额普通账号；邮箱验证开启时要求一次性证明",
        "tags": [
          "public"
        ],
        "security": [],
        "parameters": [],
        "responses": {
          "201": {
            "description": "按注册模式创建零余额普通账号；邮箱验证开启时要求一次性证明",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^[0-9]+$"
                        }
                      },
                      "required": [
                        "id"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicRegistration"
              }
            }
          }
        }
      }
    },
    "/core/v1/auth/password-resets": {
      "post": {
        "operationId": "post_core_v1_auth_password_resets",
        "summary": "发送密码恢复邮件；未知与已禁用账号均返回同一受理结果",
        "tags": [
          "public"
        ],
        "security": [],
        "parameters": [],
        "responses": {
          "202": {
            "description": "发送密码恢复邮件；未知与已禁用账号均返回同一受理结果",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/EmailAccepted"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmailRequest"
              }
            }
          }
        }
      }
    },
    "/core/v1/auth/password-resets/confirm": {
      "post": {
        "operationId": "post_core_v1_auth_password_resets_confirm",
        "summary": "验证一次性恢复证明后更改密码并注销原会话",
        "tags": [
          "public"
        ],
        "security": [],
        "parameters": [],
        "responses": {
          "200": {
            "description": "验证一次性恢复证明后更改密码并注销原会话",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/EmailUpdated"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PasswordReset"
              }
            }
          }
        }
      }
    },
    "/core/v1/me/email-verifications": {
      "post": {
        "operationId": "post_core_v1_me_email_verifications",
        "summary": "当前密码再验证后发送本人邮箱绑定证明",
        "tags": [
          "session"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [],
        "responses": {
          "202": {
            "description": "当前密码再验证后发送本人邮箱绑定证明",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/EmailAccepted"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmailBindingRequest"
              }
            }
          }
        }
      }
    },
    "/core/v1/me/email": {
      "post": {
        "operationId": "post_core_v1_me_email",
        "summary": "验证本人及原认证版本的证明后绑定邮箱并注销原会话",
        "tags": [
          "session"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "验证本人及原认证版本的证明后绑定邮箱并注销原会话",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/EmailUpdated"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmailProof"
              }
            }
          }
        }
      }
    },
    "/core/v1/me": {
      "get": {
        "operationId": "get_core_v1_me",
        "summary": "本人账户与余额",
        "tags": [
          "session"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "本人账户与余额",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Me"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/core/v1/keys": {
      "post": {
        "operationId": "post_core_v1_keys",
        "summary": "创建 Key；完整秘密只返回一次",
        "tags": [
          "session"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [],
        "responses": {
          "201": {
            "description": "创建 Key；完整秘密只返回一次",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/KeyCreated"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateKey"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "get_core_v1_keys",
        "summary": "本人最近 100 把 Key",
        "tags": [
          "session"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "本人最近 100 把 Key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Key"
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/core/v1/admin/users/{id}/role": {
      "post": {
        "operationId": "post_core_v1_admin_users__id__role",
        "summary": "平台负责人授予或撤销管理员角色；撤销目标会话",
        "tags": [
          "owner"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "平台负责人授予或撤销管理员角色；撤销目标会话",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/RevisionResult"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "验证操作者当前密码；expected_version 使用目标用户 auth_version。幂等键在操作者范围唯一；重放不再次变更。启停、改密、分组修改和撤销会话均增加版本并删除会话。旧会话不会因重新启用恢复。管理员账号仅由平台负责人管理；本人和负责人不可停用。已 forwarding 的调用继续结算。 需要当前会话 platform_owner=true；管理员角色变更验证负责人当前密码、版本和幂等键；不能撤销平台负责人的管理员身份。admin=true 不自动拥有员工授权能力。",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChangeRole"
              }
            }
          }
        }
      }
    },
    "/core/v1/keys/search": {
      "get": {
        "operationId": "get_core_v1_keys_search",
        "summary": "本人 Key 完整分页与筛选",
        "tags": [
          "session"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000000,
              "default": 1
            }
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 80
            },
            "description": "名称字面子串或 Key 前缀；不支持秘密检索。"
          },
          {
            "name": "model",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "enum": [
                "active",
                "disabled",
                "expired",
                "revoked",
                "exhausted"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "本人 Key 完整分页与筛选",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/KeyMetadata"
                          }
                        },
                        "total": {
                          "type": "string",
                          "pattern": "^[0-9]+$"
                        },
                        "page": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "size": {
                          "type": "integer",
                          "minimum": 0
                        }
                      },
                      "required": [
                        "items",
                        "total",
                        "page",
                        "size"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/core/v1/keys/{id}": {
      "get": {
        "operationId": "get_core_v1_keys__id_",
        "summary": "本人 Key 配置；不返回秘密",
        "tags": [
          "session"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "本人 Key 配置；不返回秘密",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/KeyMetadata"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "patch_core_v1_keys__id_",
        "summary": "启用或停用本人未撤销的 Key",
        "tags": [
          "session"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "启用或停用本人未撤销的 Key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "null"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Enabled"
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "delete_core_v1_keys__id_",
        "summary": "撤销本人 Key；保留账务",
        "tags": [
          "session"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "撤销本人 Key；保留账务",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "null"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/core/v1/keys/{id}/revisions": {
      "post": {
        "operationId": "post_core_v1_keys__id__revisions",
        "summary": "修订本人 Key 的名称、预算、模型和到期",
        "tags": [
          "session"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "同一幂等操作的原结果；不重新激活旧配置",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/RevisionResult"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "201": {
            "description": "修订本人 Key 的名称、预算、模型和到期",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/RevisionResult"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "expected_version 必须是当前版本；Idempotency-Key 对象内唯一。相同操作重放不重复变更。冲突返回 409。已发出的请求保持其原配置快照。",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KeyRevisionInput"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "get_core_v1_keys__id__revisions",
        "summary": "本人 Key 不可变配置历史",
        "tags": [
          "session"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000000,
              "default": 1
            }
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "本人 Key 不可变配置历史",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/KeyRevision"
                          }
                        },
                        "total": {
                          "type": "string",
                          "pattern": "^[0-9]+$"
                        },
                        "page": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "size": {
                          "type": "integer",
                          "minimum": 0
                        }
                      },
                      "required": [
                        "items",
                        "total",
                        "page",
                        "size"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/core/v1/admin/keys": {
      "get": {
        "operationId": "get_core_v1_admin_keys",
        "summary": "管理员查询 Key 元数据",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000000,
              "default": 1
            }
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 80
            },
            "description": "名称字面子串或 Key 前缀；不支持秘密检索。"
          },
          {
            "name": "model",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "enum": [
                "active",
                "disabled",
                "expired",
                "revoked",
                "exhausted"
              ]
            }
          },
          {
            "name": "user_id",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "管理员查询 Key 元数据",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/KeyMetadata"
                          }
                        },
                        "total": {
                          "type": "string",
                          "pattern": "^[0-9]+$"
                        },
                        "page": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "size": {
                          "type": "integer",
                          "minimum": 0
                        }
                      },
                      "required": [
                        "items",
                        "total",
                        "page",
                        "size"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      }
    },
    "/core/v1/models": {
      "get": {
        "operationId": "get_core_v1_models",
        "summary": "启用模型与售价",
        "tags": [
          "session"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "启用模型与售价",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Model"
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/core/v1/requests": {
      "get": {
        "operationId": "get_core_v1_requests",
        "summary": "本人请求分页",
        "tags": [
          "session"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000000,
              "default": 1
            }
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "包含起点；RFC3339 UTC，最多微秒精度。"
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "不包含终点；RFC3339 UTC，最多微秒精度。"
          },
          {
            "name": "model",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "key_id",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "state",
            "in": "query",
            "schema": {
              "enum": [
                "reserved",
                "forwarding",
                "completed",
                "unknown",
                "rejected"
              ]
            }
          },
          {
            "name": "billing_state",
            "in": "query",
            "schema": {
              "enum": [
                "reserved",
                "settled",
                "released"
              ]
            }
          },
          {
            "name": "stream",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "本人请求分页",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Request"
                          }
                        },
                        "total": {
                          "type": "string",
                          "pattern": "^[0-9]+$"
                        },
                        "page": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "size": {
                          "type": "integer",
                          "minimum": 0
                        }
                      },
                      "required": [
                        "items",
                        "total",
                        "page",
                        "size"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/core/v1/usage": {
      "get": {
        "operationId": "get_core_v1_usage",
        "summary": "本人完整区间用量与 UTC 趋势",
        "tags": [
          "session"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "包含起点；RFC3339 UTC，最多微秒精度。"
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "不包含终点；RFC3339 UTC，最多微秒精度。"
          },
          {
            "name": "model",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "key_id",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "state",
            "in": "query",
            "schema": {
              "enum": [
                "reserved",
                "forwarding",
                "completed",
                "unknown",
                "rejected"
              ]
            }
          },
          {
            "name": "billing_state",
            "in": "query",
            "schema": {
              "enum": [
                "reserved",
                "settled",
                "released"
              ]
            }
          },
          {
            "name": "stream",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "interval",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "hour",
                "day"
              ],
              "default": "day"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "本人完整区间用量与 UTC 趋势",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/UsageReport"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "默认过去30天；最大366天，小时粒度最大31天。UTC、起点包含/终点排除、缺失桶补零。汇总与趋势使用同一数据库语句快照；金额和计数均为十进制字符串。缓存总量仅合计已报告分类，reported_count 表示覆盖请求数；零覆盖不代表所有请求都无缓存。"
      }
    },
    "/core/v1/admin/usage": {
      "get": {
        "operationId": "get_core_v1_admin_usage",
        "summary": "管理员完整区间用量与 UTC 趋势",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "包含起点；RFC3339 UTC，最多微秒精度。"
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "不包含终点；RFC3339 UTC，最多微秒精度。"
          },
          {
            "name": "model",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "key_id",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "state",
            "in": "query",
            "schema": {
              "enum": [
                "reserved",
                "forwarding",
                "completed",
                "unknown",
                "rejected"
              ]
            }
          },
          {
            "name": "billing_state",
            "in": "query",
            "schema": {
              "enum": [
                "reserved",
                "settled",
                "released"
              ]
            }
          },
          {
            "name": "stream",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "user_id",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "provider_id",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "interval",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "hour",
                "day"
              ],
              "default": "day"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "管理员完整区间用量与 UTC 趋势",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/UsageReport"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "默认过去30天；最大366天，小时粒度最大31天。UTC、起点包含/终点排除、缺失桶补零。汇总与趋势使用同一数据库语句快照；金额和计数均为十进制字符串。缓存总量仅合计已报告分类，reported_count 表示覆盖请求数；零覆盖不代表所有请求都无缓存。 需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      }
    },
    "/core/v1/requests/export": {
      "get": {
        "operationId": "get_core_v1_requests_export",
        "summary": "本人受限完整 CSV 导出",
        "tags": [
          "session"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "包含起点；RFC3339 UTC，最多微秒精度。"
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "不包含终点；RFC3339 UTC，最多微秒精度。"
          },
          {
            "name": "model",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "key_id",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "state",
            "in": "query",
            "schema": {
              "enum": [
                "reserved",
                "forwarding",
                "completed",
                "unknown",
                "rejected"
              ]
            }
          },
          {
            "name": "billing_state",
            "in": "query",
            "schema": {
              "enum": [
                "reserved",
                "settled",
                "released"
              ]
            }
          },
          {
            "name": "stream",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "完整 UTF-8 BOM CSV；金额列为整数账务单位。超过限制返回 JSON 错误，不返回部分 CSV。",
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "headers": {
              "X-OneAster-Export-Rows": {
                "schema": {
                  "type": "string"
                }
              },
              "X-OneAster-Export-From": {
                "schema": {
                  "type": "string"
                }
              },
              "X-OneAster-Export-To": {
                "schema": {
                  "type": "string"
                }
              },
              "X-OneAster-Micro-Per-Credit": {
                "schema": {
                  "type": "string"
                }
              },
              "Content-Disposition": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "413": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "最大31天、10000行、8MiB；每账户每分钟最多5次尝试，管理员和用户导出共享频率。按请求创建时间归属，预留不计消费。"
      }
    },
    "/core/v1/admin/requests/export": {
      "get": {
        "operationId": "get_core_v1_admin_requests_export",
        "summary": "管理员受限完整 CSV 导出",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "包含起点；RFC3339 UTC，最多微秒精度。"
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "不包含终点；RFC3339 UTC，最多微秒精度。"
          },
          {
            "name": "model",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "key_id",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "state",
            "in": "query",
            "schema": {
              "enum": [
                "reserved",
                "forwarding",
                "completed",
                "unknown",
                "rejected"
              ]
            }
          },
          {
            "name": "billing_state",
            "in": "query",
            "schema": {
              "enum": [
                "reserved",
                "settled",
                "released"
              ]
            }
          },
          {
            "name": "stream",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "user_id",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "provider_id",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "username",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            },
            "description": "当前用户名精确匹配，与其他条件取交集；不匹配返回仅表头CSV。"
          },
          {
            "name": "request_id",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "请求UUID精确匹配；与管理员列表相同语义。"
          }
        ],
        "responses": {
          "200": {
            "description": "完整 UTF-8 BOM CSV；金额列为整数账务单位。超过限制返回 JSON 错误，不返回部分 CSV。",
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "headers": {
              "X-OneAster-Export-Rows": {
                "schema": {
                  "type": "string"
                }
              },
              "X-OneAster-Export-From": {
                "schema": {
                  "type": "string"
                }
              },
              "X-OneAster-Export-To": {
                "schema": {
                  "type": "string"
                }
              },
              "X-OneAster-Micro-Per-Credit": {
                "schema": {
                  "type": "string"
                }
              },
              "Content-Disposition": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "413": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "最大31天、10000行、8MiB；每账户每分钟最多5次尝试，管理员和用户导出共享频率。按请求创建时间归属，预留不计消费。 需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      }
    },
    "/core/v1/requests/{id}": {
      "get": {
        "operationId": "get_core_v1_requests__id_",
        "summary": "本人请求摘要详情",
        "tags": [
          "session"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "本人请求摘要详情",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Request"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/core/v1/ledger": {
      "get": {
        "operationId": "get_core_v1_ledger",
        "summary": "本人资金与预留流水",
        "tags": [
          "session"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000000,
              "default": 1
            }
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "本人资金与预留流水",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Ledger"
                          }
                        },
                        "total": {
                          "type": "string",
                          "pattern": "^[0-9]+$"
                        },
                        "page": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "size": {
                          "type": "integer",
                          "minimum": 0
                        }
                      },
                      "required": [
                        "items",
                        "total",
                        "page",
                        "size"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/core/v1/admin/credits": {
      "post": {
        "operationId": "post_core_v1_admin_credits",
        "summary": "管理员发放邀请额度；不是支付",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "相同幂等请求已入账",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "reused": {
                          "const": true
                        }
                      },
                      "required": [
                        "reused"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "201": {
            "description": "管理员发放邀请额度；不是支付",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "reused": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "reused"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Credit"
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      }
    },
    "/core/v1/admin/channels/catalog": {
      "get": {
        "operationId": "get_core_v1_admin_channels_catalog",
        "summary": "内置渠道类型与实际支持状态",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "内置渠道类型与实际支持状态",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ChannelType"
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      }
    },
    "/core/v1/admin/channels": {
      "post": {
        "operationId": "post_core_v1_admin_channels",
        "summary": "创建加密渠道；多凭据、幂等",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000000,
              "default": 1
            }
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "返回原幂等操作结果",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/ChannelCreateResult"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "201": {
            "description": "创建加密渠道；多凭据、幂等",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/ChannelCreateResult"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChannelCreate"
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      },
      "get": {
        "operationId": "get_core_v1_admin_channels",
        "summary": "渠道分页与当前文字/图片/视频型号组合筛选",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000000,
              "default": 1
            }
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "model",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "精确匹配当前文字映射或图片/视频任务配置的公开及有效上游型号；包含停用型号，不匹配历史改绑。与其他条件取交集，同一渠道只计一次。"
          },
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "group",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tag",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "direction",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "渠道分页与当前文字/图片/视频型号组合筛选",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Channel"
                          }
                        },
                        "total": {
                          "type": "string",
                          "pattern": "^[0-9]+$"
                        },
                        "page": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "size": {
                          "type": "integer",
                          "minimum": 0
                        }
                      },
                      "required": [
                        "items",
                        "total",
                        "page",
                        "size"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      }
    },
    "/core/v1/admin/channels/batch": {
      "post": {
        "operationId": "post_core_v1_admin_channels_batch",
        "summary": "CAS 原子批量启停、归档、优先级、权重、标签",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "返回原幂等操作结果",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/ChannelBatchResult"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "201": {
            "description": "CAS 原子批量启停、归档、优先级、权重、标签",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/ChannelBatchResult"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChannelBatch"
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      }
    },
    "/core/v1/admin/channels/{id}/revisions": {
      "post": {
        "operationId": "post_core_v1_admin_channels__id__revisions",
        "summary": "修订独立渠道配置、模型映射和路由",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "同一幂等操作的原结果；不重新激活旧配置",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/ChannelRevisionResult"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "201": {
            "description": "修订独立渠道配置、模型映射和路由",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/ChannelRevisionResult"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "expected_version 必须是当前版本；Idempotency-Key 对象内唯一。相同操作重放不重复变更。冲突返回 409。已发出的请求保持其原配置快照。 需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChannelRevision"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "get_core_v1_admin_channels__id__revisions",
        "summary": "不可改写渠道配置历史",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000000,
              "default": 1
            }
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "不可改写渠道配置历史",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/ChannelHistory"
                          }
                        },
                        "total": {
                          "type": "string",
                          "pattern": "^[0-9]+$"
                        },
                        "page": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "size": {
                          "type": "integer",
                          "minimum": 0
                        }
                      },
                      "required": [
                        "items",
                        "total",
                        "page",
                        "size"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      }
    },
    "/core/v1/admin/channels/{id}/discover": {
      "post": {
        "operationId": "post_core_v1_admin_channels__id__discover",
        "summary": "只请求模型元数据；不执行收费生成",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "只请求模型元数据；不执行收费生成",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/ChannelDiscoveryResult"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChannelDiscovery"
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      }
    },
    "/core/v1/admin/models/{id}": {
      "patch": {
        "operationId": "patch_core_v1_admin_models__id_",
        "summary": "启用或停用模型",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "启用或停用模型",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "null"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Enabled"
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      }
    },
    "/core/v1/admin/metrics": {
      "get": {
        "operationId": "get_core_v1_admin_metrics",
        "summary": "累计请求、待核账占款与年龄、时延 p95 与准入容量",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "累计请求、待核账占款与年龄、时延 p95 与准入容量",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/CoreMetrics"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      }
    },
    "/core/v1/admin/requests": {
      "get": {
        "operationId": "get_core_v1_admin_requests",
        "summary": "管理员使用日志；用户、Key、渠道、模型、状态与 UTC 时间筛选",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000000,
              "default": 1
            }
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "purpose",
            "in": "query",
            "schema": {
              "enum": [
                "generation",
                "channel_test"
              ]
            }
          },
          {
            "name": "state",
            "in": "query",
            "schema": {
              "enum": [
                "reserved",
                "forwarding",
                "completed",
                "unknown",
                "rejected"
              ]
            }
          },
          {
            "name": "billing_state",
            "in": "query",
            "schema": {
              "enum": [
                "reserved",
                "settled",
                "released"
              ]
            }
          },
          {
            "name": "user_id",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "username",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            },
            "description": "用户名精确匹配，区分大小写。"
          },
          {
            "name": "key_id",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "provider_id",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "model",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            },
            "description": "公开模型 ID 精确匹配，区分大小写。"
          },
          {
            "name": "request_id",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "stream",
            "in": "query",
            "schema": {
              "type": "boolean"
            },
            "description": "只接受 true/false。"
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "created_at >= from；RFC3339 UTC，最多微秒精度。"
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "created_at < to；RFC3339 UTC，最多微秒精度。from 必须早于 to。"
          }
        ],
        "responses": {
          "200": {
            "description": "管理员使用日志；用户、Key、渠道、模型、状态与 UTC 时间筛选",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/AdminRequest"
                          }
                        },
                        "total": {
                          "type": "string",
                          "pattern": "^[0-9]+$"
                        },
                        "page": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "size": {
                          "type": "integer",
                          "minimum": 0
                        }
                      },
                      "required": [
                        "items",
                        "total",
                        "page",
                        "size"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。 筛选均为精确匹配并取交集；未知、重复、空值、无效编码和非 UTC 时间返回 400。省略未选筛选项。created_at DESC，ID DESC；total 与分页同一语句快照。日志不含密码、完整 Key、凭据、提示词和响应正文。"
      }
    },
    "/core/v1/admin/audit": {
      "get": {
        "operationId": "get_core_v1_admin_audit",
        "summary": "管理员操作日志；只读的已提交操作与安全上下文",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000000,
              "default": 1
            }
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "actor_id",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "actor_username",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "action",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 80
            }
          },
          {
            "name": "object_id",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "object_type",
            "in": "query",
            "schema": {
              "enum": [
                "user",
                "key",
                "channel",
                "model",
                "request",
                "task",
                "system"
              ]
            }
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "created_at >= from；RFC3339 UTC，最多微秒精度。"
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "created_at < to；RFC3339 UTC，最多微秒精度。from 必须早于 to。"
          }
        ],
        "responses": {
          "200": {
            "description": "管理员操作日志；只读的已提交操作与安全上下文",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/AuditLog"
                          }
                        },
                        "total": {
                          "type": "string",
                          "pattern": "^[0-9]+$"
                        },
                        "page": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "size": {
                          "type": "integer",
                          "minimum": 0
                        }
                      },
                      "required": [
                        "items",
                        "total",
                        "page",
                        "size"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。 筛选均为精确匹配并取交集；未知、重复、空值、无效编码和非 UTC 时间返回 400。省略未选筛选项。created_at DESC，ID DESC；total 与分页同一语句快照。日志不含密码、完整 Key、凭据、提示词和响应正文。"
      }
    },
    "/core/v1/admin/audit/{id}": {
      "get": {
        "operationId": "get_core_v1_admin_audit__id_",
        "summary": "不可变操作日志详情",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "不可变操作日志详情",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/AuditLog"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      }
    },
    "/core/v1/admin/requests/{id}/reconcile": {
      "post": {
        "operationId": "post_core_v1_admin_requests__id__reconcile",
        "summary": "依据证据幂等释放或结算；执行状态保持 unknown",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "依据证据幂等释放或结算；执行状态保持 unknown",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {}
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Reconcile"
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      }
    },
    "/v1/models": {
      "get": {
        "operationId": "get_v1_models",
        "summary": "Key 允许的启用模型",
        "tags": [
          "key"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Key 允许的启用模型",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Model"
                      }
                    }
                  },
                  "required": [
                    "object",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/chat/completions": {
      "post": {
        "operationId": "post_v1_chat_completions",
        "summary": "OpenAI 兼容文本 Chat，JSON 与 SSE",
        "tags": [
          "key"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OpenAI 兼容文本 Chat，JSON 与 SSE",
            "content": {
              "application/json": {
                "schema": {}
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "data JSON 与 keepalive 注释，等待上游响应头期间也发送心跳。心跳提交 HTTP 200 后失败仍返回 SSE data error；开始流之前的错误返回 JSON。最终累计 usage 必须完整，部分最终帧不结算。PG 结算成功后发 [DONE]；异常不发成功终止标记。缓存分类缺失为未知，不改变输入/输出售价。"
                }
              }
            }
          },
          "429": {
            "description": "账户滚动 60 秒 300 RPM 限制；本次未新增预留或上游发送。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "准入限制时返回建议等待秒数，重发保留原意图。",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "description": "容量或后端不可用。若含 request ID 仍须查状态。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "准入限制时返回建议等待秒数，重发保留原意图。",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Chat"
              }
            }
          }
        }
      }
    },
    "/v1/tasks": {
      "post": {
        "operationId": "post_v1_tasks",
        "summary": "幂等创建单张图片或单个视频任务与报价预留",
        "tags": [
          "key"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "202": {
            "description": "幂等创建单张图片或单个视频任务与报价预留",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/TaskAccepted"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskInput"
              }
            }
          }
        }
      }
    },
    "/v1/tasks/{id}": {
      "get": {
        "operationId": "get_v1_tasks__id_",
        "summary": "当前 Key 的图片/视频任务状态",
        "tags": [
          "key"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "当前 Key 的图片/视频任务状态",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Task"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/tasks/{id}/content": {
      "get": {
        "operationId": "get_v1_tasks__id__content",
        "summary": "当前 Key 的已结算 PNG 产物",
        "tags": [
          "key"
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "已结算图片返回私有 PNG，no-store、nosniff，跨用户/Key 404。视频返回 409 provider_url_delivery，请从任务 artifact.url 读取 KIE 链接，不提供 Core 视频代理/归档/Range。",
            "content": {
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/core/v1/tasks": {
      "get": {
        "operationId": "get_core_v1_tasks",
        "summary": "个人图片/视频任务完整分页",
        "tags": [
          "session"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000000,
              "default": 1
            }
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "state",
            "in": "query",
            "schema": {
              "enum": [
                "queued",
                "submitting",
                "submitted",
                "running",
                "success",
                "failed",
                "rejected",
                "unknown"
              ]
            }
          },
          {
            "name": "billing_state",
            "in": "query",
            "schema": {
              "enum": [
                "reserved",
                "settled",
                "released"
              ]
            }
          },
          {
            "name": "model",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "schema": {
              "enum": [
                "image",
                "video"
              ]
            }
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "个人图片/视频任务完整分页",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Task"
                          }
                        },
                        "total": {
                          "type": "string",
                          "pattern": "^[0-9]+$"
                        },
                        "page": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "size": {
                          "type": "integer",
                          "minimum": 0
                        }
                      },
                      "required": [
                        "items",
                        "total",
                        "page",
                        "size"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/core/v1/tasks/{id}": {
      "get": {
        "operationId": "get_core_v1_tasks__id_",
        "summary": "个人图片/视频任务详情",
        "tags": [
          "session"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "个人图片/视频任务详情",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Task"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/core/v1/tasks/{id}/content": {
      "get": {
        "operationId": "get_core_v1_tasks__id__content",
        "summary": "个人已结算 PNG 产物",
        "tags": [
          "session"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "已结算图片返回私有 PNG，no-store、nosniff，跨用户/Key 404。视频返回 409 provider_url_delivery，请从任务 artifact.url 读取 KIE 链接，不提供 Core 视频代理/归档/Range。",
            "content": {
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/core/v1/admin/tasks": {
      "get": {
        "operationId": "get_core_v1_admin_tasks",
        "summary": "管理员任务与账务筛选",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000000,
              "default": 1
            }
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "state",
            "in": "query",
            "schema": {
              "enum": [
                "queued",
                "submitting",
                "submitted",
                "running",
                "success",
                "failed",
                "rejected",
                "unknown"
              ]
            }
          },
          {
            "name": "billing_state",
            "in": "query",
            "schema": {
              "enum": [
                "reserved",
                "settled",
                "released"
              ]
            }
          },
          {
            "name": "model",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "schema": {
              "enum": [
                "image",
                "video"
              ]
            }
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "user_id",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "provider_id",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "管理员任务与账务筛选",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Task"
                          }
                        },
                        "total": {
                          "type": "string",
                          "pattern": "^[0-9]+$"
                        },
                        "page": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "size": {
                          "type": "integer",
                          "minimum": 0
                        }
                      },
                      "required": [
                        "items",
                        "total",
                        "page",
                        "size"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      }
    },
    "/core/v1/admin/tasks/{id}": {
      "get": {
        "operationId": "get_core_v1_admin_tasks__id_",
        "summary": "管理员任务详情与产物证据",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "管理员任务详情与产物证据",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Task"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      }
    },
    "/core/v1/admin/tasks/{id}/reconcile": {
      "post": {
        "operationId": "post_core_v1_admin_tasks__id__reconcile",
        "summary": "未知图片/视频任务按原报价核账",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "未知图片/视频任务按原报价核账",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "reused": {
                          "type": "boolean"
                        },
                        "billing_state": {
                          "enum": [
                            "settled",
                            "released"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "reused",
                        "billing_state"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskReconcile"
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      }
    },
    "/core/v1/task-models/public": {
      "get": {
        "operationId": "get_core_v1_task_models_public",
        "summary": "公开默认分组图片模型和每张售价",
        "tags": [
          "public"
        ],
        "security": [],
        "parameters": [
          {
            "name": "kind",
            "in": "query",
            "schema": {
              "enum": [
                "image",
                "video"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "公开默认分组图片模型和每张售价",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/TaskModel"
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/core/v1/admin/task-models": {
      "get": {
        "operationId": "get_core_v1_admin_task_models",
        "summary": "管理员图片模型目录",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "kind",
            "in": "query",
            "schema": {
              "enum": [
                "image",
                "video"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "管理员图片模型目录",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/TaskModel"
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      },
      "post": {
        "operationId": "post_core_v1_admin_task_models",
        "summary": "幂等创建任务型号与明确的图片单价或视频规格每秒售价",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "返回原幂等操作结果",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/TaskModelResult"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "201": {
            "description": "幂等创建任务型号与明确的图片单价或视频规格每秒售价",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/TaskModelResult"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskModelCreate"
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      }
    },
    "/core/v1/admin/task-models/{id}/revisions": {
      "post": {
        "operationId": "post_core_v1_admin_task_models__id__revisions",
        "summary": "CAS 修订任务售价与渠道，保留原任务快照",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "同一幂等操作的原结果；不重新激活旧配置",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/TaskModelResult"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "201": {
            "description": "CAS 修订任务售价与渠道，保留原任务快照",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/TaskModelResult"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "expected_version 必须是当前版本；Idempotency-Key 对象内唯一。相同操作重放不重复变更。冲突返回 409。已发出的请求保持其原配置快照。 需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskModelRevision"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "get_core_v1_admin_task_models__id__revisions",
        "summary": "不可变任务型号价格历史与操作者",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000000,
              "default": 1
            }
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "不可变任务型号价格历史与操作者",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/TaskModelHistory"
                          }
                        },
                        "total": {
                          "type": "string",
                          "pattern": "^[0-9]+$"
                        },
                        "page": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "size": {
                          "type": "integer",
                          "minimum": 0
                        }
                      },
                      "required": [
                        "items",
                        "total",
                        "page",
                        "size"
                      ]
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      }
    },
    "/core/v1/admin/task-models/{id}": {
      "get": {
        "operationId": "get_core_v1_admin_task_models__id_",
        "summary": "完整任务型号配置与广场能力",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "完整任务型号配置与广场能力",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/TaskModel"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      }
    },
    "/core/v1/admin/tasks/{id}/resume-queries": {
      "post": {
        "operationId": "post_core_v1_admin_tasks__id__resume_queries",
        "summary": "仅恢复已知供应商任务的有界查询，不生成、不新增预留",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "返回原恢复窗口，不重新排队或延长期限",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/TaskQueryRecoveryResult"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "201": {
            "description": "仅恢复已知供应商任务的有界查询，不生成、不新增预留",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/TaskQueryRecoveryResult"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "仅管理员；任务必须暂停、unknown、仍预留且已有确认供应商 ID。只恢复查询或可信成功证据的产物处理；无 ID、不可信终态费用、已结算/释放拒绝。操作、恢复窗口与审计同事务。视频窗口60分钟，图片15分钟；原输入、报价、凭据和初始期限不改。 需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskQueryRecovery"
              }
            }
          }
        }
      }
    },
    "/core/v1/billing/nowpayments": {
      "get": {
        "operationId": "get_core_v1_billing_nowpayments",
        "summary": "NOWPayments 充值能力、USD 报价范围与精度",
        "tags": [
          "session"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "NOWPayments 充值能力、USD 报价范围与精度",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/NowPaymentsCapabilities"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/core/v1/billing/nowpayments/orders": {
      "post": {
        "operationId": "post_core_v1_billing_nowpayments_orders",
        "summary": "创建一次托管充值订单；同意图不重复创建 invoice",
        "tags": [
          "session"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "创建一次托管充值订单；同意图不重复创建 invoice",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/NowPaymentsOrderResult"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "201": {
            "description": "创建一次托管充值订单；同意图不重复创建 invoice",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/NowPaymentsOrderResult"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NowPaymentsOrderInput"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "get_core_v1_billing_nowpayments_orders",
        "summary": "本人充值订单；只读查询不调用供应商",
        "tags": [
          "session"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000000,
              "default": 1
            }
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "state",
            "in": "query",
            "schema": {
              "enum": [
                "creating",
                "unknown",
                "open",
                "paid",
                "expired",
                "failed"
              ]
            }
          },
          {
            "name": "archived",
            "in": "query",
            "schema": {
              "enum": [
                "false",
                "true",
                "all"
              ],
              "default": "false"
            },
            "description": "默认仅未归档，true 仅归档，all 包括两者；本人查询仍只读本人订单。"
          }
        ],
        "responses": {
          "200": {
            "description": "本人充值订单；只读查询不调用供应商",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/NowPaymentsOrderPage"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/core/v1/billing/nowpayments/orders/{id}": {
      "get": {
        "operationId": "get_core_v1_billing_nowpayments_orders__id_",
        "summary": "本人充值订单详情",
        "tags": [
          "session"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "本人充值订单详情",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/NowPaymentsOrder"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/core/v1/admin/billing/nowpayments/summary": {
      "get": {
        "operationId": "get_core_v1_admin_billing_nowpayments_summary",
        "summary": "管理员 NOWPayments 订单报价只读概览；不接受查询参数",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "管理员 NOWPayments 订单报价只读概览；不接受查询参数",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/NowPaymentsSummary"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      }
    },
    "/core/v1/admin/billing/nowpayments/orders": {
      "get": {
        "operationId": "get_core_v1_admin_billing_nowpayments_orders",
        "summary": "管理员充值订单列表",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000000,
              "default": 1
            }
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "state",
            "in": "query",
            "schema": {
              "enum": [
                "creating",
                "unknown",
                "open",
                "paid",
                "expired",
                "failed"
              ]
            }
          },
          {
            "name": "user_id",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]*$"
            }
          },
          {
            "name": "archived",
            "in": "query",
            "schema": {
              "enum": [
                "false",
                "true",
                "all"
              ],
              "default": "false"
            },
            "description": "默认仅未归档，true 仅归档，all 包括两者；本人查询仍只读本人订单。"
          },
          {
            "name": "order_id",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
            },
            "description": "OneAster 订单 UUID，遵循现有 UUID 校验规则并精确匹配。"
          },
          {
            "name": "invoice_id",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,127}$"
            },
            "description": "NOWPayments invoice ID，规范正整数字符串，精确匹配。"
          }
        ],
        "responses": {
          "200": {
            "description": "管理员充值订单列表",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/NowPaymentsOrderPage"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      }
    },
    "/core/v1/admin/billing/nowpayments/orders/{id}/payments": {
      "get": {
        "operationId": "get_core_v1_admin_billing_nowpayments_orders__id__payments",
        "summary": "管理员只读本地支付证据；不查询供应商或自动核账",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000000,
              "default": 1
            },
            "description": "规范正整数，不能带前导零。"
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "description": "规范正整数，不能带前导零。"
          }
        ],
        "responses": {
          "200": {
            "description": "管理员只读本地支付证据；不查询供应商或自动核账",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/NowPaymentsPaymentEvidencePage"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      }
    },
    "/core/v1/admin/billing/nowpayments/orders/{id}": {
      "get": {
        "operationId": "get_core_v1_admin_billing_nowpayments_orders__id_",
        "summary": "管理员充值订单详情；隐藏付款链接",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "管理员充值订单详情；隐藏付款链接",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/NowPaymentsOrder"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      }
    },
    "/core/v1/admin/billing/nowpayments/orders/{id}/archive": {
      "post": {
        "operationId": "post_core_v1_admin_billing_nowpayments_orders__id__archive",
        "summary": "归档订单，保留原报价、支付证据与幂等意图；默认列表和待付款名额排除归档订单",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "重复归档返回原标记，不重复审计。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/NowPaymentsArchiveResult"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "201": {
            "description": "归档订单，保留原报价、支付证据与幂等意图；默认列表和待付款名额排除归档订单",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/NowPaymentsArchiveResult"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NowPaymentsArchiveInput"
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      }
    },
    "/core/v1/admin/billing/nowpayments/orders/{id}/reconcile": {
      "post": {
        "operationId": "post_core_v1_admin_billing_nowpayments_orders__id__reconcile",
        "summary": "根据原 payment ID 查询原支付证据并安全恢复入账",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "根据原 payment ID 查询原支付证据并安全恢复入账",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/NowPaymentsOrderResult"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NowPaymentsReconcile"
              }
            }
          }
        },
        "description": "需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      }
    },
    "/core/v1/billing/nowpayments/ipn": {
      "post": {
        "operationId": "post_core_v1_billing_nowpayments_ipn",
        "summary": "NOWPayments IPN 验签、查询核实与原子唯一入账",
        "tags": [
          "public"
        ],
        "security": [],
        "parameters": [
          {
            "name": "x-nowpayments-sig",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-fA-F0-9]{128}$"
            },
            "description": "NOWPayments 官方 HMAC SHA512 签名。"
          }
        ],
        "responses": {
          "200": {
            "description": "NOWPayments IPN 验签、查询核实与原子唯一入账",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/NowPaymentsIPNResult"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NowPaymentsIPN"
              }
            }
          }
        }
      }
    },
    "/core/v1/admin/channels/{id}/test": {
      "post": {
        "operationId": "post_core_v1_admin_channels__id__test",
        "summary": "确认预算后，使用本人Key对指定启用渠道执行一次收费文本测试",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "确认预算后，使用本人Key对指定启用渠道执行一次收费文本测试",
            "content": {
              "application/json": {
                "schema": {}
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "data JSON 与 keepalive 注释，等待上游响应头期间也发送心跳。心跳提交 HTTP 200 后失败仍返回 SSE data error；开始流之前的错误返回 JSON。最终累计 usage 必须完整，部分最终帧不结算。PG 结算成功后发 [DONE]；异常不发成功终止标记。缓存分类缺失为未知，不改变输入/输出售价。"
                }
              }
            },
            "headers": {
              "X-OneAster-Request-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "X-OneAster-Reused": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "账户滚动 60 秒 300 RPM 限制；本次未新增预留或上游发送。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "准入限制时返回建议等待秒数，重发保留原意图。",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "description": "容量或后端不可用。若含 request ID 仍须查状态。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "准入限制时返回建议等待秒数，重发保留原意图。",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "必须确认三个当前版本、预算和参考说明；只接受本人有效Key与启用映射文本渠道，重用钱包/Key双预留、限流、JSON/SSE及原意图。预算最大100积分且覆盖预留和实际扣费；max_tokens1–256，16消息及4096内容字节。版本或授权改变发送前拒绝。JSON成功可重放；SSE/unknown只查原请求，409含原Request-ID，不补发。成功直接返回OpenAI格式，无success/data封装。供应商错误维持unknown预留，诊断查管理员原请求明细。 需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChannelTest"
              }
            }
          }
        }
      }
    },
    "/core/v1/admin/channel-health": {
      "get": {
        "operationId": "get_core_v1_admin_channel_health",
        "summary": "当前渠道及凭据版本的文本发送健康统计；只读且不影响路由",
        "tags": [
          "admin"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000000,
              "default": 1
            }
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "channel_id",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]*$"
            }
          },
          {
            "name": "model",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "window_minutes",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1440,
              "default": 60
            }
          }
        ],
        "responses": {
          "200": {
            "description": "当前渠道及凭据版本的文本发送健康统计；只读且不影响路由",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/ChannelHealthPage"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "错误代码见 core-api.md；供应商/数据库错误已隐藏。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "管理员只读；当前未归档渠道映射的文本模型，以当前配置/凭据版本和真实forwarded_at在统一窗口内的尝试统计。completed/settled为成功，unknown为失败（手动核账不改变该事实），forwarding为在途；旧无发送时间只计legacy，不编造成功率。零终态样本比例与时延为null。cooldown仅Retry-After提示，不参与路由；10秒单SQL快照，严格拒绝未知/重复/空/非规范参数，不产生供应商调用或数据库写入。 需要当前会话用户 admin=true。业务变更与审计在同一事务提交；读取不新增操作日志。"
      }
    }
  },
  "components": {
    "schemas": {
      "StripeTestCapabilities": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "mode": {
            "const": "test"
          },
          "currency": {
            "const": "usd"
          },
          "micro_per_usd_cent": {
            "const": "10000"
          },
          "min_amount_usd_cents": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[1-9][0-9]*$",
                "maxLength": 6,
                "description": "USD整数美分；不是积分。1美分=10000 OneAster整数账务单位。"
              },
              {
                "type": "null"
              }
            ]
          },
          "max_amount_usd_cents": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[1-9][0-9]*$",
                "maxLength": 6,
                "description": "USD整数美分；不是积分。1美分=10000 OneAster整数账务单位。"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "enabled",
          "mode",
          "currency",
          "micro_per_usd_cent",
          "min_amount_usd_cents",
          "max_amount_usd_cents"
        ]
      },
      "Error": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "success": {
            "const": false
          },
          "error": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "type": {
                "const": "oneaster_error"
              }
            },
            "required": [
              "code",
              "message",
              "type"
            ]
          },
          "data": {
            "type": "null"
          }
        },
        "required": [
          "success",
          "error",
          "data"
        ]
      },
      "TopupOrderResult": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "order": {
            "$ref": "#/components/schemas/TopupOrder"
          },
          "reused": {
            "type": "boolean"
          }
        },
        "required": [
          "order",
          "reused"
        ]
      },
      "TopupOrder": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "user_id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "mode": {
            "const": "test"
          },
          "currency": {
            "const": "usd"
          },
          "amount_usd_cents": {
            "type": "string",
            "pattern": "^[1-9][0-9]*$",
            "maxLength": 6,
            "description": "USD整数美分；不是积分。1美分=10000 OneAster整数账务单位。"
          },
          "credit_micro": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "state": {
            "enum": [
              "creating",
              "unknown",
              "open",
              "paid",
              "expired",
              "failed"
            ]
          },
          "stripe_session_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "checkout_url": {
            "anyOf": [
              {
                "type": "string",
                "format": "uri",
                "description": "仅本人未支付open订单返回；仅checkout.stripe.com可信URL。"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "paid_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "user_id",
          "mode",
          "currency",
          "amount_usd_cents",
          "credit_micro",
          "state",
          "stripe_session_id",
          "checkout_url",
          "created_at",
          "updated_at",
          "paid_at"
        ]
      },
      "TopupOrderInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "amount_usd_cents": {
            "type": "string",
            "pattern": "^[1-9][0-9]*$",
            "maxLength": 6,
            "description": "USD整数美分；不是积分。1美分=10000 OneAster整数账务单位。"
          }
        },
        "required": [
          "amount_usd_cents"
        ]
      },
      "TopupOrderPage": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "page": {
            "type": "integer",
            "minimum": 0
          },
          "size": {
            "type": "integer",
            "minimum": 0
          },
          "total": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TopupOrder"
            }
          }
        },
        "required": [
          "page",
          "size",
          "total",
          "items"
        ]
      },
      "StripeWebhookResult": {
        "oneOf": [
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "reused": {
                "type": "boolean"
              }
            },
            "required": [
              "reused"
            ]
          },
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "ignored": {
                "const": true
              }
            },
            "required": [
              "ignored"
            ]
          }
        ]
      },
      "StripeWebhook": {
        "type": "object",
        "description": "原始Stripe事件JSON；必须保留原始字节并使用Stripe-Signature验签。不是浏览器提交的付款证明。"
      },
      "TaskModel": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/ImageTaskModel"
          },
          {
            "$ref": "#/components/schemas/VideoTaskModel"
          }
        ]
      },
      "ImageTaskModel": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "model": {
            "type": "string"
          },
          "kind": {
            "const": "image"
          },
          "unit": {
            "const": "image"
          },
          "unit_price_micro": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "version": {
            "type": "integer",
            "minimum": 0
          },
          "enabled": {
            "type": "boolean"
          },
          "upstream_model": {
            "enum": [
              "z-image",
              "image-01"
            ]
          },
          "quantity": {
            "const": 1
          },
          "aspect_ratios": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "provider_id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "prompt_max_length": {
            "const": 1000
          },
          "media_type": {
            "const": "image/png"
          },
          "max_artifact_bytes": {
            "const": 20971520
          }
        },
        "required": [
          "id",
          "model",
          "kind",
          "unit",
          "unit_price_micro",
          "version",
          "enabled",
          "upstream_model",
          "quantity",
          "aspect_ratios"
        ]
      },
      "VideoTaskModel": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "model": {
            "type": "string"
          },
          "kind": {
            "const": "video"
          },
          "unit": {
            "const": "second"
          },
          "video_prices": {
            "$ref": "#/components/schemas/VideoPrices"
          },
          "version": {
            "type": "integer",
            "minimum": 0
          },
          "enabled": {
            "type": "boolean"
          },
          "upstream_model": {
            "enum": [
              "bytedance/v1-lite-text-to-video",
              "runway",
              "bytedance/seedance-2-5"
            ]
          },
          "quantity": {
            "const": 1
          },
          "aspect_ratios": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "resolutions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "durations": {
            "type": "array",
            "items": {
              "enum": [
                5,
                10
              ]
            }
          },
          "input_modes": {
            "type": "array",
            "items": {
              "enum": [
                "text_to_video",
                "image_to_video"
              ]
            }
          },
          "reference_image": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "source": {
                "const": "settled_core_image_task"
              },
              "sources": {
                "type": "array",
                "items": {
                  "enum": [
                    "settled_core_image_task",
                    "node_media"
                  ]
                }
              },
              "node_media_requires_bridge": {
                "const": true
              },
              "same_key": {
                "const": true
              },
              "media_types": {
                "type": "array",
                "items": {
                  "const": "image/png"
                }
              },
              "max_bytes": {
                "const": 10485760
              },
              "aspect_ratio_from_image": {
                "const": true
              }
            },
            "required": [
              "source",
              "sources",
              "node_media_requires_bridge",
              "same_key",
              "media_types",
              "max_bytes",
              "aspect_ratio_from_image"
            ]
          },
          "specifications": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "resolution": {
                  "enum": [
                    "480p",
                    "720p",
                    "1080p"
                  ]
                },
                "durations": {
                  "type": "array",
                  "items": {
                    "enum": [
                      5,
                      10
                    ]
                  }
                }
              },
              "required": [
                "resolution",
                "durations"
              ]
            }
          },
          "prompt_max_length": {
            "enum": [
              1800,
              10000,
              20480
            ]
          },
          "preview_supported": {
            "const": true
          },
          "output_delivery": {
            "const": "provider_url"
          },
          "provider_retention_days": {
            "const": 14
          },
          "media_type": {
            "const": "video/mp4"
          },
          "archived": {
            "const": false
          },
          "camera_fixed": {
            "type": "boolean"
          },
          "safety_checker": {
            "type": "boolean",
            "description": "Whether Core sends an explicit safety-checker input. Runway does not expose this input; false does not describe provider moderation."
          },
          "provider_id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        },
        "required": [
          "id",
          "model",
          "kind",
          "unit",
          "video_prices",
          "version",
          "enabled",
          "upstream_model",
          "quantity",
          "aspect_ratios",
          "resolutions",
          "durations",
          "input_modes",
          "specifications",
          "prompt_max_length",
          "preview_supported",
          "output_delivery",
          "provider_retention_days",
          "media_type",
          "archived",
          "camera_fixed",
          "safety_checker"
        ]
      },
      "VideoPrices": {
        "type": "object",
        "minProperties": 1,
        "maxProperties": 3,
        "additionalProperties": false,
        "properties": {
          "480p": {
            "type": "string",
            "pattern": "^[1-9][0-9]{0,14}$",
            "description": "Explicit gateway integer units per second, at most 100000000000000; unconfigured resolutions cannot be submitted."
          },
          "720p": {
            "type": "string",
            "pattern": "^[1-9][0-9]{0,14}$",
            "description": "Explicit gateway integer units per second, at most 100000000000000; unconfigured resolutions cannot be submitted."
          },
          "1080p": {
            "type": "string",
            "pattern": "^[1-9][0-9]{0,14}$",
            "description": "Explicit gateway integer units per second, at most 100000000000000; unconfigured resolutions cannot be submitted."
          }
        }
      },
      "TaskAccepted": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "reused": {
            "type": "boolean"
          },
          "status_url": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "reused",
          "status_url"
        ]
      },
      "TaskInput": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/ImageTaskInput"
          },
          {
            "$ref": "#/components/schemas/VideoTaskInput"
          },
          {
            "$ref": "#/components/schemas/ReferenceVideoTaskInput"
          }
        ]
      },
      "ImageTaskInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "kind": {
            "const": "image"
          },
          "model": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "input": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "prompt": {
                "type": "string",
                "minLength": 1,
                "maxLength": 1000
              },
              "aspect_ratio": {
                "enum": [
                  "1:1",
                  "4:3",
                  "3:4",
                  "16:9",
                  "9:16"
                ]
              }
            },
            "required": [
              "prompt",
              "aspect_ratio"
            ]
          }
        },
        "required": [
          "kind",
          "model",
          "input"
        ]
      },
      "VideoTaskInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "kind": {
            "const": "video"
          },
          "model": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "input": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "prompt": {
                "type": "string",
                "minLength": 1,
                "maxLength": 20480
              },
              "aspect_ratio": {
                "enum": [
                  "16:9",
                  "4:3",
                  "1:1",
                  "3:4",
                  "9:16",
                  "9:21",
                  "21:9"
                ]
              },
              "resolution": {
                "enum": [
                  "480p",
                  "720p",
                  "1080p"
                ]
              },
              "duration": {
                "type": "integer",
                "enum": [
                  5,
                  10
                ]
              },
              "camera_fixed": {
                "type": "boolean"
              }
            },
            "required": [
              "prompt",
              "aspect_ratio",
              "resolution",
              "duration"
            ]
          }
        },
        "required": [
          "kind",
          "model",
          "input"
        ],
        "description": "Input is validated against the selected public model upstream. Seedance Lite: prompt<=10000, all listed resolutions at 5/10s, 9:21 supported, camera_fixed supported. Seedance 2.5: prompt<=20480, all listed resolutions at 5/10s, 21:9 supported instead of 9:21; camera_fixed must be omitted, audio/draft/search/last-frame disabled, MP4 output and safety checker enabled. Runway: prompt<=1800, 720p at 5/10s or 1080p at 5s, camera_fixed must be omitted. Read task-model capabilities for valid combinations; no arbitrary passthrough or reference inputs for Seedance 2.5."
      },
      "ReferenceVideoTaskInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "kind": {
            "const": "video"
          },
          "model": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "input": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "prompt": {
                "type": "string",
                "minLength": 1,
                "maxLength": 1800
              },
              "image_task_id": {
                "type": "string",
                "format": "uuid"
              },
              "resolution": {
                "enum": [
                  "720p",
                  "1080p"
                ]
              },
              "duration": {
                "type": "integer",
                "enum": [
                  5,
                  10
                ]
              }
            },
            "required": [
              "prompt",
              "image_task_id",
              "resolution",
              "duration"
            ]
          }
        },
        "required": [
          "kind",
          "model",
          "input"
        ],
        "description": "Runway only: same-user, same-Key settled Core PNG, <=10 MiB. Omit aspect_ratio and camera_fixed; ratio follows source image. 1080p only supports 5 seconds. No arbitrary image_url or Node asset paths."
      },
      "TaskInsights": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "from": {
            "type": "string",
            "format": "date-time"
          },
          "to": {
            "type": "string",
            "format": "date-time"
          },
          "sampled_at": {
            "type": "string",
            "format": "date-time"
          },
          "timezone": {
            "const": "UTC"
          },
          "attribution": {
            "const": "request_created_at"
          },
          "scope": {
            "const": "persisted_core_image_video_tasks"
          },
          "health_basis": {
            "const": "validated_terminal_task_evidence"
          },
          "paid_probes": {
            "const": false
          },
          "supplier_cost_unit": {
            "const": "kie_credit"
          },
          "supplier_cost_scope": {
            "const": "kie_tasks_only"
          },
          "currency": {
            "const": "CREDITS"
          },
          "micro_per_credit": {
            "const": 10000
          },
          "summary": {
            "$ref": "#/components/schemas/TaskInsightTotals"
          },
          "groups": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TaskInsightGroup"
                }
              },
              "total": {
                "type": "string",
                "pattern": "^[0-9]+$"
              },
              "page": {
                "type": "integer",
                "minimum": 0
              },
              "size": {
                "type": "integer",
                "minimum": 0
              }
            },
            "required": [
              "items",
              "total",
              "page",
              "size"
            ]
          }
        },
        "required": [
          "from",
          "to",
          "sampled_at",
          "timezone",
          "attribution",
          "scope",
          "health_basis",
          "paid_probes",
          "supplier_cost_unit",
          "supplier_cost_scope",
          "currency",
          "micro_per_credit",
          "summary",
          "groups"
        ]
      },
      "TaskInsightTotals": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "task_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "estimated_cost_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "unestimated_cost_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "reported_cost_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "unreported_cost_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "invalid_evidence_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "zero_cost_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "cost_mismatch_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "nonzero_failure_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "supplier_success_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "supplier_failure_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "terminal_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "nonterminal_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "queued_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "unknown_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "unresolved_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "rejected_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "pending_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "settled_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "released_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "expected_supplier_credits": {
            "type": "string",
            "pattern": "^[0-9]+([.][0-9]+)?$",
            "description": "筛选任务中已知的KIE原采购报价合计，含未发送任务；不是实际支出，MiniMax不计入。结合estimated_cost_count/unestimated_cost_count解读。"
          },
          "reported_supplier_credits": {
            "type": "string",
            "pattern": "^[0-9]+([.][0-9]+)?$",
            "description": "仅有效身份/终态/费用证据的已报告合计，含已核账失败；缺失不视为零。"
          },
          "charge_micro": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "held_micro": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "terminal_success_rate_bps": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 10000,
                "description": "有效终态成功数/有效终态数，四舍五入至基点；无终态为null，不代表实时渠道健康。"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "task_count",
          "estimated_cost_count",
          "unestimated_cost_count",
          "reported_cost_count",
          "unreported_cost_count",
          "invalid_evidence_count",
          "zero_cost_count",
          "cost_mismatch_count",
          "nonzero_failure_count",
          "supplier_success_count",
          "supplier_failure_count",
          "terminal_count",
          "nonterminal_count",
          "queued_count",
          "unknown_count",
          "unresolved_count",
          "rejected_count",
          "pending_count",
          "settled_count",
          "released_count",
          "expected_supplier_credits",
          "reported_supplier_credits",
          "charge_micro",
          "held_micro",
          "terminal_success_rate_bps"
        ]
      },
      "TaskInsightGroup": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "provider_id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "model": {
            "type": "string"
          },
          "upstream_model": {
            "type": "string"
          },
          "kind": {
            "enum": [
              "image",
              "video"
            ]
          },
          "resolution": {
            "anyOf": [
              {
                "enum": [
                  "480p",
                  "720p",
                  "1080p"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "duration": {
            "anyOf": [
              {
                "enum": [
                  5,
                  10
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "input_mode": {
            "enum": [
              "text_to_image",
              "text_to_video",
              "image_to_video"
            ]
          },
          "task_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "estimated_cost_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "unestimated_cost_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "reported_cost_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "unreported_cost_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "invalid_evidence_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "zero_cost_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "cost_mismatch_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "nonzero_failure_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "supplier_success_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "supplier_failure_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "terminal_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "nonterminal_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "queued_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "unknown_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "unresolved_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "rejected_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "pending_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "settled_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "released_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "expected_supplier_credits": {
            "type": "string",
            "pattern": "^[0-9]+([.][0-9]+)?$",
            "description": "筛选任务中已知的KIE原采购报价合计，含未发送任务；不是实际支出，MiniMax不计入。结合estimated_cost_count/unestimated_cost_count解读。"
          },
          "reported_supplier_credits": {
            "type": "string",
            "pattern": "^[0-9]+([.][0-9]+)?$",
            "description": "仅有效身份/终态/费用证据的已报告合计，含已核账失败；缺失不视为零。"
          },
          "charge_micro": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "held_micro": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "terminal_success_rate_bps": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 10000,
                "description": "有效终态成功数/有效终态数，四舍五入至基点；无终态为null，不代表实时渠道健康。"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "provider_id",
          "model",
          "upstream_model",
          "kind",
          "resolution",
          "duration",
          "input_mode",
          "task_count",
          "estimated_cost_count",
          "unestimated_cost_count",
          "reported_cost_count",
          "unreported_cost_count",
          "invalid_evidence_count",
          "zero_cost_count",
          "cost_mismatch_count",
          "nonzero_failure_count",
          "supplier_success_count",
          "supplier_failure_count",
          "terminal_count",
          "nonterminal_count",
          "queued_count",
          "unknown_count",
          "unresolved_count",
          "rejected_count",
          "pending_count",
          "settled_count",
          "released_count",
          "expected_supplier_credits",
          "reported_supplier_credits",
          "charge_micro",
          "held_micro",
          "terminal_success_rate_bps"
        ]
      },
      "TaskCosts": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "from": {
            "type": "string",
            "format": "date-time"
          },
          "to": {
            "type": "string",
            "format": "date-time"
          },
          "sampled_at": {
            "type": "string",
            "format": "date-time"
          },
          "timezone": {
            "const": "UTC"
          },
          "attribution": {
            "const": "request_created_at"
          },
          "scope": {
            "const": "persisted_core_image_video_tasks"
          },
          "health_basis": {
            "const": "validated_terminal_task_evidence"
          },
          "paid_probes": {
            "const": false
          },
          "supplier_cost_unit": {
            "const": "kie_credit"
          },
          "supplier_cost_scope": {
            "const": "kie_tasks_only"
          },
          "currency": {
            "const": "CREDITS"
          },
          "micro_per_credit": {
            "const": 10000
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TaskCost"
            }
          },
          "total": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "page": {
            "type": "integer",
            "minimum": 0
          },
          "size": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "from",
          "to",
          "sampled_at",
          "timezone",
          "attribution",
          "scope",
          "health_basis",
          "paid_probes",
          "supplier_cost_unit",
          "supplier_cost_scope",
          "currency",
          "micro_per_credit",
          "items",
          "total",
          "page",
          "size"
        ]
      },
      "TaskCost": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "provider_id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "model": {
            "type": "string"
          },
          "upstream_model": {
            "type": "string"
          },
          "kind": {
            "enum": [
              "image",
              "video"
            ]
          },
          "resolution": {
            "anyOf": [
              {
                "enum": [
                  "480p",
                  "720p",
                  "1080p"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "duration": {
            "anyOf": [
              {
                "enum": [
                  5,
                  10
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "input_mode": {
            "enum": [
              "text_to_image",
              "text_to_video",
              "image_to_video"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "user_id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "key_id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "state": {
            "enum": [
              "queued",
              "submitting",
              "submitted",
              "running",
              "success",
              "failed",
              "rejected",
              "unknown"
            ]
          },
          "billing_state": {
            "enum": [
              "reserved",
              "settled",
              "released"
            ]
          },
          "price_version": {
            "type": "integer",
            "minimum": 0
          },
          "unit_price_micro": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "quantity": {
            "enum": [
              1,
              5,
              10
            ]
          },
          "reservation_micro": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "charge_micro": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]+$",
                "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
              },
              {
                "type": "null"
              }
            ]
          },
          "supplier_cost_unit": {
            "anyOf": [
              {
                "const": "kie_credit"
              },
              {
                "type": "null"
              }
            ]
          },
          "expected_supplier_credits": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]+([.][0-9]+)?$",
                "description": "KIE积分十进制字符串；不是美元或网关积分。使用十进制定点库，不用Number。"
              },
              {
                "type": "null"
              }
            ]
          },
          "actual_supplier_credits": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]+([.][0-9]+)?$",
                "description": "KIE积分十进制字符串；不是美元或网关积分。使用十进制定点库，不用Number。"
              },
              {
                "type": "null"
              }
            ]
          },
          "has_supplier_task_id": {
            "type": "boolean"
          },
          "terminal_state": {
            "anyOf": [
              {
                "enum": [
                  "success",
                  "fail"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "cost_status": {
            "enum": [
              "reported",
              "unreported",
              "invalid_evidence"
            ]
          },
          "cost_mismatch": {
            "type": "boolean"
          },
          "nonzero_failure": {
            "type": "boolean"
          },
          "unresolved": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "provider_id",
          "model",
          "upstream_model",
          "kind",
          "resolution",
          "duration",
          "input_mode",
          "id",
          "user_id",
          "key_id",
          "state",
          "billing_state",
          "price_version",
          "unit_price_micro",
          "quantity",
          "reservation_micro",
          "charge_micro",
          "supplier_cost_unit",
          "expected_supplier_credits",
          "actual_supplier_credits",
          "has_supplier_task_id",
          "terminal_state",
          "cost_status",
          "cost_mismatch",
          "nonzero_failure",
          "unresolved",
          "created_at"
        ]
      },
      "RevisionResult": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "version": {
            "type": "integer",
            "minimum": 1
          },
          "reused": {
            "type": "boolean"
          }
        },
        "required": [
          "version",
          "reused"
        ]
      },
      "ChangeGroup": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "expected_version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483646
          },
          "current_password": {
            "type": "string",
            "maxLength": 128,
            "writeOnly": true
          },
          "reference": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "routing_group": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9_-]{1,60}$"
          }
        },
        "required": [
          "expected_version",
          "current_password",
          "reference",
          "routing_group"
        ]
      },
      "TokenEstimate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "model": {
            "type": "string"
          },
          "price_version": {
            "type": "integer",
            "minimum": 0
          },
          "metering": {
            "$ref": "#/components/schemas/MeteringPolicy"
          },
          "estimated_input_tokens": {
            "type": "integer",
            "minimum": 0
          },
          "reserved_input_tokens": {
            "type": "integer",
            "minimum": 0
          },
          "byte_fallback": {
            "type": "boolean"
          },
          "output_limit": {
            "type": "integer",
            "minimum": 0
          },
          "reservation_micro": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "currency": {
            "const": "CREDITS"
          },
          "micro_per_credit": {
            "const": 10000
          },
          "provisional": {
            "const": true
          }
        },
        "required": [
          "model",
          "price_version",
          "metering",
          "estimated_input_tokens",
          "reserved_input_tokens",
          "byte_fallback",
          "output_limit",
          "reservation_micro",
          "currency",
          "micro_per_credit",
          "provisional"
        ]
      },
      "MeteringPolicy": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "mode": {
            "enum": [
              "model_limit",
              "utf8_bytes",
              "cl100k_base",
              "o200k_base"
            ]
          },
          "margin_bps": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000
          },
          "extra_tokens": {
            "type": "integer",
            "minimum": 0,
            "maximum": 65536
          }
        },
        "required": [
          "mode",
          "margin_bps",
          "extra_tokens"
        ]
      },
      "Chat": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "model": {
            "type": "string"
          },
          "messages": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "role": {
                  "enum": [
                    "system",
                    "user",
                    "assistant"
                  ]
                },
                "content": {
                  "type": "string"
                }
              },
              "required": [
                "role",
                "content"
              ]
            },
            "minItems": 1,
            "maxItems": 128
          },
          "max_tokens": {
            "type": "integer",
            "minimum": 1,
            "maximum": 65536
          },
          "stream": {
            "type": "boolean"
          },
          "temperature": {
            "type": "number",
            "minimum": 0,
            "maximum": 2
          }
        },
        "required": [
          "model",
          "messages",
          "max_tokens"
        ]
      },
      "UserSummary": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "username": {
            "type": "string"
          },
          "admin": {
            "type": "boolean"
          },
          "enabled": {
            "type": "boolean"
          },
          "auth_version": {
            "type": "integer",
            "minimum": 0
          },
          "routing_group": {
            "type": "string"
          },
          "balance_micro": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "reserved_micro": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "username",
          "admin",
          "enabled",
          "auth_version",
          "routing_group",
          "balance_micro",
          "reserved_micro",
          "created_at"
        ]
      },
      "InviteUser": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "username": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9_.-]{2,63}$"
          },
          "password": {
            "type": "string",
            "minLength": 15,
            "maxLength": 128,
            "description": "服务端实际校验 UTF-8 字节长度。"
          }
        },
        "required": [
          "username",
          "password"
        ]
      },
      "AccountState": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "expected_version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483646
          },
          "current_password": {
            "type": "string",
            "maxLength": 128,
            "writeOnly": true
          },
          "reference": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "enabled": {
            "type": "boolean"
          }
        },
        "required": [
          "expected_version",
          "current_password",
          "reference",
          "enabled"
        ]
      },
      "RevokeSessions": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "expected_version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483646
          },
          "current_password": {
            "type": "string",
            "maxLength": 128,
            "writeOnly": true
          },
          "reference": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          }
        },
        "required": [
          "expected_version",
          "current_password",
          "reference"
        ]
      },
      "ChangePassword": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "expected_version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483646
          },
          "current_password": {
            "type": "string",
            "maxLength": 128,
            "writeOnly": true
          },
          "reference": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "new_password": {
            "type": "string",
            "minLength": 15,
            "maxLength": 128,
            "writeOnly": true
          }
        },
        "required": [
          "expected_version",
          "current_password",
          "reference",
          "new_password"
        ]
      },
      "RotateCredentials": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "expected_version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483646
          },
          "api_key": {
            "type": "string",
            "minLength": 8,
            "maxLength": 8192,
            "writeOnly": true
          },
          "reference": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          }
        },
        "required": [
          "expected_version",
          "api_key",
          "reference"
        ]
      },
      "CredentialEvent": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "provider_id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "version": {
            "type": "integer",
            "minimum": 0
          },
          "actor_id": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "reference": {
            "type": "string"
          },
          "operation_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "provider_id",
          "version",
          "actor_id",
          "reference",
          "operation_key",
          "created_at"
        ]
      },
      "ModelConfiguration": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "model": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "minimum": 0
          },
          "input_price_per_million": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "output_price_per_million": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "input_limit": {
            "type": "integer",
            "minimum": 0
          },
          "output_limit": {
            "type": "integer",
            "minimum": 0
          },
          "metering": {
            "$ref": "#/components/schemas/MeteringPolicy"
          },
          "enabled": {
            "type": "boolean"
          },
          "channel_count": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "id",
          "model",
          "version",
          "input_price_per_million",
          "output_price_per_million",
          "input_limit",
          "output_limit",
          "metering",
          "enabled",
          "channel_count"
        ]
      },
      "CreateModel": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "metering": {
            "$ref": "#/components/schemas/MeteringPolicy"
          },
          "model": {
            "type": "string"
          },
          "input_price_per_million": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "output_price_per_million": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "input_limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000
          },
          "output_limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 65536
          }
        },
        "required": [
          "model",
          "input_price_per_million",
          "output_price_per_million",
          "input_limit",
          "output_limit"
        ]
      },
      "ReviseModel": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "metering": {
            "$ref": "#/components/schemas/MeteringPolicy"
          },
          "expected_version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483646
          },
          "input_price_per_million": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "output_price_per_million": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "input_limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000
          },
          "output_limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 65536
          },
          "reference": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          }
        },
        "required": [
          "expected_version",
          "input_price_per_million",
          "output_price_per_million",
          "input_limit",
          "output_limit",
          "reference"
        ]
      },
      "ModelRevision": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "model_id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "version": {
            "type": "integer",
            "minimum": 0
          },
          "provider_id": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "upstream_model": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "input_price_per_million": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "output_price_per_million": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "input_limit": {
            "type": "integer",
            "minimum": 0
          },
          "output_limit": {
            "type": "integer",
            "minimum": 0
          },
          "metering": {
            "$ref": "#/components/schemas/MeteringPolicy"
          },
          "actor_id": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "reference": {
            "type": "string"
          },
          "operation_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "model_id",
          "version",
          "provider_id",
          "upstream_model",
          "input_price_per_million",
          "output_price_per_million",
          "input_limit",
          "output_limit",
          "metering",
          "actor_id",
          "reference",
          "operation_key",
          "created_at"
        ]
      },
      "AdminRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "model": {
            "type": "string"
          },
          "state": {
            "enum": [
              "reserved",
              "forwarding",
              "completed",
              "unknown",
              "rejected"
            ]
          },
          "billing_state": {
            "enum": [
              "reserved",
              "settled",
              "released"
            ]
          },
          "reservation_micro": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "charge_micro": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]+$",
                "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
              },
              {
                "type": "null"
              }
            ]
          },
          "prompt_tokens": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "completion_tokens": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "cache_read_tokens": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "cache_creation_tokens": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "price_version": {
            "type": "integer",
            "minimum": 0
          },
          "metering": {
            "$ref": "#/components/schemas/MeteringPolicy"
          },
          "estimated_input_tokens": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ]
          },
          "reserved_input_tokens": {
            "type": "integer",
            "minimum": 0
          },
          "byte_fallback": {
            "type": "boolean"
          },
          "input_price_per_million": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "output_price_per_million": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "first_token_ms": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ]
          },
          "duration_ms": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ]
          },
          "error_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "stream": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "user_id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "username": {
            "type": "string"
          },
          "key_id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "key_name": {
            "type": "string"
          },
          "key_prefix": {
            "type": "string"
          },
          "model_id": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "provider_id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "provider_name": {
            "type": "string"
          },
          "upstream_model": {
            "type": "string"
          },
          "provider_base_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "provider_credential_version": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ]
          },
          "channel_version": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ]
          },
          "channel_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "channel_config": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ChannelConfig"
              },
              {
                "type": "null"
              }
            ]
          },
          "configuration_snapshot_complete": {
            "type": "boolean"
          },
          "input_limit": {
            "type": "integer",
            "minimum": 0
          },
          "output_limit": {
            "type": "integer",
            "minimum": 0
          },
          "reconciliation_ref": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "observed_usage": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Usage"
              },
              {
                "type": "null"
              }
            ]
          },
          "upstream_http_status": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 100,
                "maximum": 599
              },
              {
                "type": "null"
              }
            ]
          },
          "upstream_request_id": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "purpose": {
            "enum": [
              "generation",
              "channel_test"
            ]
          },
          "test_actor_id": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "test_auth_version": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ]
          },
          "test_maximum_charge_micro": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]+$",
                "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
              },
              {
                "type": "null"
              }
            ]
          },
          "test_reference": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "forwarded_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "upstream_headers_ms": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ]
          },
          "diagnostic": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ProviderDiagnostic"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "model",
          "state",
          "billing_state",
          "reservation_micro",
          "charge_micro",
          "prompt_tokens",
          "completion_tokens",
          "cache_read_tokens",
          "cache_creation_tokens",
          "price_version",
          "metering",
          "estimated_input_tokens",
          "reserved_input_tokens",
          "byte_fallback",
          "input_price_per_million",
          "output_price_per_million",
          "first_token_ms",
          "duration_ms",
          "error_code",
          "stream",
          "created_at",
          "updated_at",
          "user_id",
          "username",
          "key_id",
          "key_name",
          "key_prefix",
          "model_id",
          "provider_id",
          "provider_name",
          "upstream_model",
          "provider_base_url",
          "provider_credential_version",
          "channel_version",
          "channel_type",
          "channel_config",
          "configuration_snapshot_complete",
          "input_limit",
          "output_limit",
          "reconciliation_ref",
          "observed_usage",
          "upstream_http_status",
          "upstream_request_id",
          "purpose",
          "test_actor_id",
          "test_auth_version",
          "test_maximum_charge_micro",
          "test_reference",
          "forwarded_at",
          "upstream_headers_ms",
          "diagnostic"
        ]
      },
      "ChannelConfig": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "base_url": {
            "type": "string"
          },
          "models": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "model": {
                  "type": "string"
                },
                "upstream_model": {
                  "type": "string"
                }
              },
              "required": [
                "model",
                "upstream_model"
              ]
            }
          },
          "groups": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "priority": {
            "type": "integer",
            "minimum": 0
          },
          "weight": {
            "type": "integer",
            "minimum": 0
          },
          "tag": {
            "type": "string"
          },
          "notes": {
            "type": "string"
          },
          "auto_disable": {
            "type": "boolean"
          },
          "options": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "parameters": {
            "type": "object",
            "additionalProperties": {
              "type": "number"
            }
          }
        },
        "required": [
          "name",
          "type",
          "base_url",
          "models",
          "groups",
          "priority",
          "weight",
          "tag",
          "notes",
          "auto_disable",
          "options",
          "headers",
          "parameters"
        ]
      },
      "Usage": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "prompt_tokens": {
            "type": "integer",
            "minimum": 0
          },
          "completion_tokens": {
            "type": "integer",
            "minimum": 0
          },
          "total_tokens": {
            "type": "integer",
            "minimum": 0
          },
          "cache_read_tokens": {
            "type": "integer",
            "minimum": 0
          },
          "cache_creation_tokens": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "prompt_tokens",
          "completion_tokens",
          "total_tokens"
        ]
      },
      "ProviderDiagnostic": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "phase": {
            "enum": [
              "connecting",
              "waiting_headers",
              "upstream_response",
              "reading_response",
              "streaming",
              "settlement"
            ]
          },
          "category": {
            "enum": [
              "authentication",
              "rate_limit",
              "provider_internal",
              "model_unavailable",
              "invalid_request",
              "provider_unavailable",
              "http_error",
              "timeout",
              "transport_error",
              "client_cancelled",
              "invalid_response",
              "invalid_usage",
              "stream_interrupted",
              "settlement_failed",
              "process_interrupted"
            ]
          },
          "message": {
            "type": "string",
            "maxLength": 200
          },
          "provider_error_type": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 64
              },
              {
                "type": "null"
              }
            ]
          },
          "retry_after_seconds": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 86400
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "phase",
          "category",
          "message",
          "provider_error_type",
          "retry_after_seconds"
        ]
      },
      "Model": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "available": {
            "type": "boolean"
          },
          "id": {
            "type": "string"
          },
          "object": {
            "const": "model"
          },
          "owned_by": {
            "const": "oneaster"
          },
          "input_price_per_million": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "output_price_per_million": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "input_limit": {
            "type": "integer",
            "minimum": 0
          },
          "output_limit": {
            "type": "integer",
            "minimum": 0
          },
          "price_version": {
            "type": "integer",
            "minimum": 0
          },
          "metering": {
            "$ref": "#/components/schemas/MeteringPolicy"
          },
          "currency": {
            "const": "CREDITS"
          },
          "micro_per_credit": {
            "const": 10000
          },
          "price_unit": {
            "const": "units_per_million_tokens"
          }
        },
        "required": [
          "available",
          "id",
          "object",
          "owned_by",
          "input_price_per_million",
          "output_price_per_million",
          "input_limit",
          "output_limit",
          "price_version",
          "metering",
          "currency",
          "micro_per_credit",
          "price_unit"
        ]
      },
      "LoginResult": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "access_token": {
            "type": "string"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "user": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[0-9]+$"
              },
              "username": {
                "type": "string"
              },
              "admin": {
                "type": "boolean"
              }
            },
            "required": [
              "id",
              "username",
              "admin"
            ]
          }
        },
        "required": [
          "access_token",
          "expires_at",
          "user"
        ]
      },
      "Login": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "username": {
            "type": "string",
            "minLength": 3,
            "maxLength": 64
          },
          "password": {
            "type": "string",
            "maxLength": 128
          }
        },
        "required": [
          "username",
          "password"
        ]
      },
      "EmailAccepted": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "accepted": {
            "const": true
          }
        },
        "required": [
          "accepted"
        ]
      },
      "EmailRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "maxLength": 254
          }
        },
        "required": [
          "email"
        ]
      },
      "PublicRegistration": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "token": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{43}$",
            "writeOnly": true,
            "description": "注册邮箱验证开启时必填；密码注册模式必须省略。"
          },
          "username": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9_.-]{2,63}$"
          },
          "password": {
            "type": "string",
            "minLength": 15,
            "maxLength": 128,
            "writeOnly": true,
            "description": "服务端校验 UTF-8 字节长度。"
          }
        },
        "required": [
          "username",
          "password"
        ]
      },
      "EmailUpdated": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "updated": {
            "const": true
          }
        },
        "required": [
          "updated"
        ]
      },
      "PasswordReset": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "token": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{43}$",
            "writeOnly": true
          },
          "password": {
            "type": "string",
            "minLength": 15,
            "maxLength": 128,
            "writeOnly": true,
            "description": "服务端校验 UTF-8 字节长度。"
          }
        },
        "required": [
          "token",
          "password"
        ]
      },
      "EmailBindingRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "maxLength": 254
          },
          "current_password": {
            "type": "string",
            "maxLength": 128,
            "writeOnly": true
          }
        },
        "required": [
          "email",
          "current_password"
        ]
      },
      "EmailProof": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "token": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{43}$",
            "writeOnly": true
          }
        },
        "required": [
          "token"
        ]
      },
      "Me": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "email": {
            "anyOf": [
              {
                "type": "string",
                "format": "email"
              },
              {
                "type": "null"
              }
            ]
          },
          "email_verified_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "username": {
            "type": "string"
          },
          "admin": {
            "type": "boolean"
          },
          "platform_owner": {
            "type": "boolean"
          },
          "auth_version": {
            "type": "integer",
            "minimum": 0
          },
          "issuer": {
            "type": "string",
            "format": "uuid"
          },
          "currency": {
            "const": "CREDITS"
          },
          "micro_per_credit": {
            "const": 10000
          },
          "balance_micro": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "reserved_micro": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          }
        },
        "required": [
          "email",
          "email_verified_at",
          "id",
          "username",
          "admin",
          "platform_owner",
          "auth_version",
          "issuer",
          "currency",
          "micro_per_credit",
          "balance_micro",
          "reserved_micro"
        ]
      },
      "KeyCreated": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "key": {
            "type": "string"
          },
          "prefix": {
            "type": "string"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "show_once": {
            "const": true
          },
          "budget_micro": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]+$",
                "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
              },
              {
                "type": "null"
              }
            ],
            "description": "无限额时为 null；有限额时为累计总额度。unlimited_budget 明确表示模式，钱包限制始终适用。"
          },
          "unlimited_budget": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "key",
          "prefix",
          "expires_at",
          "show_once",
          "budget_micro",
          "unlimited_budget"
        ]
      },
      "CreateKey": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "budget_micro": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?:[0-9]+|\\s*)$",
                "description": "选填；省略、null 或空白不设置 Key 独立额度。填写正整数时不得超过钱包当前 balance_micro；额度单位为整数 micro。"
              },
              {
                "type": "null"
              }
            ]
          },
          "models": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "maxItems": 50,
                "description": "选填；省略、null 或 [] 表示允许所有当前及未来模型，仍受账号分组、启用状态和预算限制。"
              },
              {
                "type": "null"
              }
            ]
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "name"
        ]
      },
      "Key": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "name": {
            "type": "string"
          },
          "prefix": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "budget_micro": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]+$",
                "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
              },
              {
                "type": "null"
              }
            ],
            "description": "无限额时为 null；有限额时为累计总额度。unlimited_budget 明确表示模式，钱包限制始终适用。"
          },
          "unlimited_budget": {
            "type": "boolean"
          },
          "spent_micro": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "reserved_micro": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "models": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "空数组表示所有当前及未来模型；非空数组表示精确允许列表。"
          },
          "revoked_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "name",
          "prefix",
          "enabled",
          "expires_at",
          "budget_micro",
          "unlimited_budget",
          "spent_micro",
          "reserved_micro",
          "models",
          "revoked_at"
        ]
      },
      "ChangeRole": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "expected_version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483646
          },
          "current_password": {
            "type": "string",
            "maxLength": 128,
            "writeOnly": true
          },
          "reference": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "admin": {
            "type": "boolean"
          }
        },
        "required": [
          "expected_version",
          "current_password",
          "reference",
          "admin"
        ]
      },
      "KeyMetadata": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "user_id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "name": {
            "type": "string"
          },
          "prefix": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "budget_micro": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]+$",
                "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
              },
              {
                "type": "null"
              }
            ],
            "description": "无限额时为 null；有限额时为累计总额度。unlimited_budget 明确表示模式，钱包限制始终适用。"
          },
          "unlimited_budget": {
            "type": "boolean"
          },
          "spent_micro": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "reserved_micro": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "models": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "空数组表示所有当前及未来模型；非空数组表示精确允许列表。"
          },
          "revoked_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "config_version": {
            "type": "integer",
            "minimum": 1
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "enum": [
              "active",
              "disabled",
              "expired",
              "revoked",
              "exhausted"
            ]
          }
        },
        "required": [
          "id",
          "user_id",
          "name",
          "prefix",
          "enabled",
          "expires_at",
          "budget_micro",
          "unlimited_budget",
          "spent_micro",
          "reserved_micro",
          "models",
          "revoked_at",
          "config_version",
          "created_at",
          "status"
        ]
      },
      "Enabled": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "enabled": {
            "type": "boolean"
          }
        },
        "required": [
          "enabled"
        ]
      },
      "KeyRevisionInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "expected_version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483646
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "budget_micro": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?:[0-9]+|\\s*)$",
                "description": "选填；省略、null 或空白不设置 Key 独立额度。填写正整数时不得超过钱包当前 balance_micro；额度单位为整数 micro。"
              },
              {
                "type": "null"
              }
            ]
          },
          "models": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            },
            "maxItems": 50,
            "uniqueItems": true,
            "description": "修订必须显式传数组；[] 表示所有当前及未来模型，省略或 null 无效。"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "reference": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          }
        },
        "required": [
          "expected_version",
          "name",
          "models",
          "expires_at",
          "reference"
        ]
      },
      "KeyRevision": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "key_id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "version": {
            "type": "integer",
            "minimum": 0
          },
          "name": {
            "type": "string"
          },
          "budget_micro": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]+$",
                "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
              },
              {
                "type": "null"
              }
            ],
            "description": "无限额时为 null；有限额时为累计总额度。unlimited_budget 明确表示模式，钱包限制始终适用。"
          },
          "unlimited_budget": {
            "type": "boolean"
          },
          "models": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "空数组表示所有当前及未来模型；非空数组表示精确允许列表。"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "actor_id": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "reference": {
            "type": "string"
          },
          "operation_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "key_id",
          "version",
          "name",
          "budget_micro",
          "unlimited_budget",
          "models",
          "expires_at",
          "actor_id",
          "reference",
          "operation_key",
          "created_at"
        ]
      },
      "Request": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "model": {
            "type": "string"
          },
          "state": {
            "enum": [
              "reserved",
              "forwarding",
              "completed",
              "unknown",
              "rejected"
            ]
          },
          "billing_state": {
            "enum": [
              "reserved",
              "settled",
              "released"
            ]
          },
          "reservation_micro": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "charge_micro": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]+$",
                "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
              },
              {
                "type": "null"
              }
            ]
          },
          "prompt_tokens": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "completion_tokens": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "cache_read_tokens": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "cache_creation_tokens": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "price_version": {
            "type": "integer",
            "minimum": 0
          },
          "metering": {
            "$ref": "#/components/schemas/MeteringPolicy"
          },
          "estimated_input_tokens": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ]
          },
          "reserved_input_tokens": {
            "type": "integer",
            "minimum": 0
          },
          "byte_fallback": {
            "type": "boolean"
          },
          "input_price_per_million": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "output_price_per_million": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "first_token_ms": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ]
          },
          "duration_ms": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ]
          },
          "error_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "stream": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "model",
          "state",
          "billing_state",
          "reservation_micro",
          "charge_micro",
          "prompt_tokens",
          "completion_tokens",
          "cache_read_tokens",
          "cache_creation_tokens",
          "price_version",
          "metering",
          "estimated_input_tokens",
          "reserved_input_tokens",
          "byte_fallback",
          "input_price_per_million",
          "output_price_per_million",
          "first_token_ms",
          "duration_ms",
          "error_code",
          "stream",
          "created_at",
          "updated_at"
        ]
      },
      "UsageReport": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "from": {
            "type": "string",
            "format": "date-time"
          },
          "to": {
            "type": "string",
            "format": "date-time"
          },
          "interval": {
            "enum": [
              "hour",
              "day"
            ]
          },
          "timezone": {
            "const": "UTC"
          },
          "attribution": {
            "const": "request_created_at"
          },
          "currency": {
            "const": "CREDITS"
          },
          "micro_per_credit": {
            "const": 10000
          },
          "summary": {
            "$ref": "#/components/schemas/UsageTotals"
          },
          "series": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UsagePoint"
            }
          }
        },
        "required": [
          "from",
          "to",
          "interval",
          "timezone",
          "attribution",
          "currency",
          "micro_per_credit",
          "summary",
          "series"
        ]
      },
      "UsageTotals": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "request_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "completed_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "unknown_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "unresolved_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "rejected_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "settled_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "released_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "pending_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "charge_micro": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "held_micro": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "prompt_tokens": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "completion_tokens": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "cache_read_tokens": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "cache_creation_tokens": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "cache_read_reported_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "cache_creation_reported_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        },
        "required": [
          "request_count",
          "completed_count",
          "unknown_count",
          "unresolved_count",
          "rejected_count",
          "settled_count",
          "released_count",
          "pending_count",
          "charge_micro",
          "held_micro",
          "prompt_tokens",
          "completion_tokens",
          "cache_read_tokens",
          "cache_creation_tokens",
          "cache_read_reported_count",
          "cache_creation_reported_count"
        ]
      },
      "UsagePoint": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "bucket_start": {
            "type": "string",
            "format": "date-time"
          },
          "request_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "completed_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "unknown_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "unresolved_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "rejected_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "settled_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "released_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "pending_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "charge_micro": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "held_micro": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "prompt_tokens": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "completion_tokens": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "cache_read_tokens": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "cache_creation_tokens": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "cache_read_reported_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "cache_creation_reported_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          }
        },
        "required": [
          "bucket_start",
          "request_count",
          "completed_count",
          "unknown_count",
          "unresolved_count",
          "rejected_count",
          "settled_count",
          "released_count",
          "pending_count",
          "charge_micro",
          "held_micro",
          "prompt_tokens",
          "completion_tokens",
          "cache_read_tokens",
          "cache_creation_tokens",
          "cache_read_reported_count",
          "cache_creation_reported_count"
        ]
      },
      "Ledger": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "request_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ]
          },
          "event": {
            "enum": [
              "credit",
              "reserve",
              "settle",
              "release"
            ]
          },
          "balance_delta_micro": {
            "type": "string",
            "pattern": "^-?[0-9]+$"
          },
          "reserved_delta_micro": {
            "type": "string",
            "pattern": "^-?[0-9]+$"
          },
          "reference": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "request_id",
          "event",
          "balance_delta_micro",
          "reserved_delta_micro",
          "reference",
          "created_at"
        ]
      },
      "Credit": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "user_id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "amount_micro": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "reference": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          }
        },
        "required": [
          "user_id",
          "amount_micro",
          "reference"
        ]
      },
      "ChannelType": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "number": {
            "type": "integer",
            "minimum": 0
          },
          "protocol": {
            "type": "string"
          },
          "base_url": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "stream": {
            "type": "boolean"
          },
          "options": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "supported": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "name",
          "number",
          "protocol",
          "base_url",
          "category",
          "stream",
          "options",
          "supported"
        ]
      },
      "ChannelCreateResult": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "ids": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          "version": {
            "type": "integer",
            "minimum": 0
          },
          "reused": {
            "type": "boolean"
          }
        },
        "required": [
          "ids",
          "version",
          "reused"
        ]
      },
      "ChannelCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "config": {
            "$ref": "#/components/schemas/ChannelConfig"
          },
          "enabled": {
            "type": "boolean"
          },
          "api_keys": {
            "type": "array",
            "minItems": 1,
            "maxItems": 50,
            "items": {
              "type": "string",
              "minLength": 8,
              "maxLength": 8192,
              "writeOnly": true
            }
          },
          "reference": {
            "type": "string"
          }
        },
        "required": [
          "config",
          "enabled",
          "api_keys",
          "reference"
        ]
      },
      "Channel": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "config": {
            "$ref": "#/components/schemas/ChannelConfig"
          },
          "enabled": {
            "type": "boolean"
          },
          "version": {
            "type": "integer",
            "minimum": 0
          },
          "credential_version": {
            "type": "integer",
            "minimum": 0
          },
          "archived_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "used_micro": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "last_check": {
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "config",
          "enabled",
          "version",
          "credential_version",
          "archived_at",
          "created_at",
          "used_micro",
          "last_check"
        ]
      },
      "ChannelBatchResult": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "count": {
            "type": "integer",
            "minimum": 0
          },
          "reused": {
            "type": "boolean"
          }
        },
        "required": [
          "count",
          "reused"
        ]
      },
      "ChannelBatch": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "action": {
            "enum": [
              "enable",
              "disable",
              "archive",
              "priority",
              "weight",
              "tag"
            ]
          },
          "items": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^(?:[1-9][0-9]{0,14}|1000000000000000)$",
                  "description": "规范正十进制渠道 ID，无前导零；范围 1–1000000000000000，批内不得重复。"
                },
                "expected_version": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 2147483646
                }
              },
              "required": [
                "id",
                "expected_version"
              ]
            }
          },
          "value": {
            "type": "integer",
            "minimum": 0
          },
          "tag": {
            "type": "string"
          },
          "reference": {
            "type": "string"
          }
        },
        "required": [
          "action",
          "items",
          "reference"
        ]
      },
      "ChannelRevisionResult": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "version": {
            "type": "integer",
            "minimum": 0
          },
          "reused": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "version",
          "reused"
        ]
      },
      "ChannelRevision": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "config": {
            "$ref": "#/components/schemas/ChannelConfig"
          },
          "enabled": {
            "type": "boolean"
          },
          "expected_version": {
            "type": "integer",
            "minimum": 0
          },
          "reference": {
            "type": "string"
          }
        },
        "required": [
          "config",
          "enabled",
          "expected_version",
          "reference"
        ]
      },
      "ChannelHistory": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "version": {
            "type": "integer",
            "minimum": 0
          },
          "config": {
            "$ref": "#/components/schemas/ChannelConfig"
          },
          "actor_id": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "reference": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "version",
          "config",
          "actor_id",
          "reference",
          "created_at"
        ]
      },
      "ChannelDiscoveryResult": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "model_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "http_status": {
            "type": "integer",
            "minimum": 0
          },
          "duration_ms": {
            "type": "integer",
            "minimum": 0
          },
          "error_code": {
            "type": "string"
          },
          "disabled": {
            "type": "boolean"
          }
        },
        "required": [
          "ok",
          "model_ids",
          "http_status",
          "duration_ms",
          "error_code",
          "disabled"
        ]
      },
      "ChannelDiscovery": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "expected_version": {
            "type": "integer",
            "minimum": 0
          },
          "credential_version": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "expected_version",
          "credential_version"
        ]
      },
      "CoreMetrics": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "sampled_at": {
            "type": "string",
            "format": "date-time"
          },
          "requests": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "unknown": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "pending_billing": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "completed": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "held_micro": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "unknown_pending": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "unknown_held_micro": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "oldest_pending_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "oldest_pending_age_seconds": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ]
          },
          "oldest_unknown_pending_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "oldest_unknown_pending_age_seconds": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ]
          },
          "first_token_p95_ms": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "duration_p95_ms": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "version": {
            "type": "string"
          },
          "scope": {
            "const": "core_request_records"
          },
          "paid_probes": {
            "const": false
          },
          "admission": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "scope": {
                "const": "single_execution_instance"
              },
              "active": {
                "type": "integer",
                "minimum": 0
              },
              "global_limit": {
                "type": "integer",
                "minimum": 0
              },
              "capacity_rejected": {
                "type": "string",
                "pattern": "^[0-9]+$"
              }
            },
            "required": [
              "scope",
              "active",
              "global_limit",
              "capacity_rejected"
            ]
          },
          "requests_per_minute": {
            "type": "integer",
            "minimum": 0
          },
          "request_window_seconds": {
            "const": 60
          },
          "stream_idle_timeout_seconds": {
            "type": "number"
          },
          "stream_heartbeat_seconds": {
            "type": "number"
          },
          "upstream_timeout_seconds": {
            "type": "number"
          }
        },
        "required": [
          "sampled_at",
          "requests",
          "unknown",
          "pending_billing",
          "completed",
          "held_micro",
          "unknown_pending",
          "unknown_held_micro",
          "oldest_pending_at",
          "oldest_pending_age_seconds",
          "oldest_unknown_pending_at",
          "oldest_unknown_pending_age_seconds",
          "first_token_p95_ms",
          "duration_p95_ms",
          "version",
          "scope",
          "paid_probes",
          "admission",
          "requests_per_minute",
          "request_window_seconds",
          "stream_idle_timeout_seconds",
          "stream_heartbeat_seconds",
          "upstream_timeout_seconds"
        ]
      },
      "AuditLog": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "actor_id": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "actor_username": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "action": {
            "type": "string"
          },
          "object_type": {
            "enum": [
              "user",
              "key",
              "channel",
              "model",
              "request",
              "task",
              "system"
            ]
          },
          "object_id": {
            "type": "string"
          },
          "details": {
            "$ref": "#/components/schemas/AuditDetails"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "actor_id",
          "actor_username",
          "action",
          "object_type",
          "object_id",
          "details",
          "created_at"
        ]
      },
      "AuditDetails": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "user_id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "key_id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "provider_id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "model_id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "version": {
            "type": "integer",
            "minimum": 1
          },
          "enabled": {
            "type": "boolean"
          },
          "amount_micro": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "budget_micro": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "reference": {
            "type": "string",
            "maxLength": 300
          },
          "routing_group": {
            "type": "string"
          },
          "admin": {
            "type": "boolean"
          }
        },
        "required": []
      },
      "Reconcile": {
        "oneOf": [
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "action": {
                "const": "release"
              },
              "reference": {
                "type": "string"
              }
            },
            "required": [
              "action",
              "reference"
            ]
          },
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "action": {
                "const": "settle"
              },
              "reference": {
                "type": "string"
              },
              "usage": {
                "$ref": "#/components/schemas/Usage"
              }
            },
            "required": [
              "action",
              "reference",
              "usage"
            ]
          }
        ]
      },
      "Task": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "user_id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "key_id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "model": {
            "type": "string"
          },
          "kind": {
            "enum": [
              "image",
              "video"
            ]
          },
          "state": {
            "enum": [
              "queued",
              "submitting",
              "submitted",
              "running",
              "success",
              "failed",
              "rejected",
              "unknown"
            ]
          },
          "billing_state": {
            "enum": [
              "reserved",
              "settled",
              "released"
            ]
          },
          "price_version": {
            "type": "integer",
            "minimum": 0
          },
          "unit_price_micro": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "reservation_micro": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "charge_micro": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]+$",
                "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
              },
              {
                "type": "null"
              }
            ]
          },
          "error_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "input": {
            "$ref": "#/components/schemas/TaskSnapshotInput"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "artifact_available": {
            "type": "boolean"
          },
          "artifact": {
            "anyOf": [
              {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/TaskArtifact"
                  },
                  {
                    "$ref": "#/components/schemas/VideoResult"
                  }
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "upstream_model": {
            "enum": [
              "z-image",
              "image-01",
              "bytedance/v1-lite-text-to-video",
              "runway",
              "bytedance/seedance-2-5"
            ]
          },
          "quantity": {
            "type": "integer",
            "enum": [
              1,
              5,
              10
            ],
            "description": "Image count or video seconds, depending on unit."
          },
          "unit": {
            "enum": [
              "image",
              "second"
            ]
          },
          "estimated_supplier_credits": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Immutable expected KIE credits, or null for MiniMax with unreported supplier cost. Never gateway credits, CNY or USD."
          },
          "actual_supplier_credits": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "supplier_cost_unit": {
            "anyOf": [
              {
                "const": "kie_credit"
              },
              {
                "type": "null"
              }
            ]
          },
          "reference_image": {
            "anyOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "source_task_id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "source_asset_id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "source_kind": {
                    "enum": [
                      "core_task",
                      "node_media"
                    ]
                  },
                  "sha256": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "size_bytes": {
                    "type": "string",
                    "pattern": "^[0-9]+$"
                  },
                  "uploaded": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "source_task_id",
                  "source_asset_id",
                  "source_kind",
                  "sha256",
                  "size_bytes",
                  "uploaded"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "polling": {
            "$ref": "#/components/schemas/TaskPolling"
          },
          "failure": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TaskFailure"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "user_id",
          "key_id",
          "model",
          "kind",
          "state",
          "billing_state",
          "price_version",
          "unit_price_micro",
          "reservation_micro",
          "charge_micro",
          "error_code",
          "input",
          "created_at",
          "updated_at",
          "artifact_available",
          "artifact",
          "upstream_model",
          "quantity",
          "unit",
          "estimated_supplier_credits",
          "actual_supplier_credits",
          "supplier_cost_unit",
          "reference_image",
          "polling",
          "failure"
        ]
      },
      "TaskSnapshotInput": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/ImageTaskInput"
          },
          {
            "$ref": "#/components/schemas/VideoTaskInput"
          },
          {
            "$ref": "#/components/schemas/ReferenceVideoTaskInput"
          },
          {
            "$ref": "#/components/schemas/MediaVideoTaskInput"
          }
        ]
      },
      "MediaVideoTaskInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "kind": {
            "const": "video"
          },
          "model": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "input": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "prompt": {
                "type": "string",
                "minLength": 1,
                "maxLength": 1800
              },
              "resolution": {
                "enum": [
                  "720p",
                  "1080p"
                ]
              },
              "duration": {
                "type": "integer",
                "enum": [
                  5,
                  10
                ]
              },
              "image_asset_id": {
                "type": "string",
                "format": "uuid"
              }
            },
            "required": [
              "prompt",
              "image_asset_id",
              "resolution",
              "duration"
            ]
          }
        },
        "required": [
          "kind",
          "model",
          "input"
        ],
        "description": "Trusted Node media bridge only: PNG bytes must accompany the asset UUID in multipart. Not accepted on public JSON task submission."
      },
      "TaskArtifact": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "media_type": {
            "const": "image/png"
          },
          "sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "size_bytes": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "width": {
            "type": "integer",
            "minimum": 0
          },
          "height": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "media_type",
          "sha256",
          "size_bytes",
          "width",
          "height"
        ]
      },
      "VideoResult": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "media_type": {
            "const": "video/mp4"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "KIE temporary HTTPS CDN URL; direct browser video preview. Anyone holding this URL can access the provider CDN."
          },
          "temporary": {
            "const": true
          },
          "archived": {
            "const": false
          },
          "preview_supported": {
            "const": true
          },
          "delivery": {
            "const": "provider_url"
          }
        },
        "required": [
          "media_type",
          "url",
          "temporary",
          "archived",
          "preview_supported",
          "delivery"
        ]
      },
      "TaskPolling": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "status": {
            "enum": [
              "active",
              "paused",
              "finished"
            ]
          },
          "next_poll_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "initial_deadline_at": {
            "type": "string",
            "format": "date-time"
          },
          "deadline_at": {
            "type": "string",
            "format": "date-time"
          },
          "attempts": {
            "type": "integer",
            "minimum": 0
          },
          "recovery_count": {
            "type": "integer",
            "minimum": 0
          },
          "admin_resume_available": {
            "type": "boolean"
          }
        },
        "required": [
          "status",
          "next_poll_at",
          "initial_deadline_at",
          "deadline_at",
          "attempts",
          "recovery_count",
          "admin_resume_available"
        ]
      },
      "TaskFailure": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "provider_code": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]{1,6}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "category": {
            "enum": [
              "provider_error",
              "provider_rate_limited",
              "provider_failure"
            ]
          }
        },
        "required": [
          "provider_code",
          "category"
        ]
      },
      "TaskReconcile": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "action": {
            "enum": [
              "release",
              "settle"
            ]
          },
          "reference": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          }
        },
        "required": [
          "action",
          "reference"
        ]
      },
      "TaskModelResult": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "version": {
            "type": "integer",
            "minimum": 0
          },
          "reused": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "version",
          "reused"
        ]
      },
      "TaskModelCreate": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/ImageTaskModelCreate"
          },
          {
            "$ref": "#/components/schemas/VideoTaskModelCreate"
          }
        ]
      },
      "ImageTaskModelCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "model": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "provider_id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "unit_price_micro": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "enabled": {
            "type": "boolean"
          },
          "reference": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "kind": {
            "const": "image",
            "default": "image"
          },
          "upstream_model": {
            "enum": [
              "z-image",
              "image-01"
            ],
            "description": "Immutable upstream. image-01 requires a minimax-image channel. Omission keeps legacy z-image on create or preserves the upstream on revision."
          }
        },
        "required": [
          "model",
          "provider_id",
          "unit_price_micro",
          "enabled",
          "reference"
        ]
      },
      "VideoTaskModelCreate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "kind": {
            "const": "video"
          },
          "upstream_model": {
            "enum": [
              "bytedance/v1-lite-text-to-video",
              "runway",
              "bytedance/seedance-2-5"
            ],
            "description": "Immutable upstream identity. Create omission keeps legacy Seedance; revision omission preserves the existing upstream."
          },
          "provider_id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "video_prices": {
            "$ref": "#/components/schemas/VideoPrices"
          },
          "enabled": {
            "type": "boolean"
          },
          "reference": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "model": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        },
        "required": [
          "kind",
          "provider_id",
          "video_prices",
          "enabled",
          "reference",
          "model"
        ]
      },
      "TaskModelRevision": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/ImageTaskModelRevision"
          },
          {
            "$ref": "#/components/schemas/VideoTaskModelRevision"
          }
        ]
      },
      "ImageTaskModelRevision": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "expected_version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483646
          },
          "provider_id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "unit_price_micro": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "enabled": {
            "type": "boolean"
          },
          "reference": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "kind": {
            "const": "image",
            "default": "image"
          },
          "upstream_model": {
            "enum": [
              "z-image",
              "image-01"
            ],
            "description": "Immutable upstream. image-01 requires a minimax-image channel. Omission keeps legacy z-image on create or preserves the upstream on revision."
          }
        },
        "required": [
          "expected_version",
          "provider_id",
          "unit_price_micro",
          "enabled",
          "reference"
        ]
      },
      "VideoTaskModelRevision": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "kind": {
            "const": "video"
          },
          "upstream_model": {
            "enum": [
              "bytedance/v1-lite-text-to-video",
              "runway",
              "bytedance/seedance-2-5"
            ],
            "description": "Immutable upstream identity. Create omission keeps legacy Seedance; revision omission preserves the existing upstream."
          },
          "provider_id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "video_prices": {
            "$ref": "#/components/schemas/VideoPrices"
          },
          "enabled": {
            "type": "boolean"
          },
          "reference": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "expected_version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483646
          }
        },
        "required": [
          "kind",
          "provider_id",
          "video_prices",
          "enabled",
          "reference",
          "expected_version"
        ]
      },
      "TaskModelHistory": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "model_id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "model": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "minimum": 0
          },
          "kind": {
            "enum": [
              "image",
              "video"
            ]
          },
          "upstream_model": {
            "enum": [
              "z-image",
              "image-01",
              "bytedance/v1-lite-text-to-video",
              "runway",
              "bytedance/seedance-2-5"
            ]
          },
          "provider_id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "unit": {
            "enum": [
              "image",
              "second"
            ]
          },
          "unit_price_micro": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]+$",
                "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
              },
              {
                "type": "null"
              }
            ]
          },
          "video_prices": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "pattern": "^[0-9]+$",
              "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
            }
          },
          "enabled": {
            "type": "boolean"
          },
          "actor_id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "actor_username": {
            "type": "string"
          },
          "reference": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "model_id",
          "model",
          "version",
          "kind",
          "upstream_model",
          "provider_id",
          "unit",
          "unit_price_micro",
          "video_prices",
          "enabled",
          "actor_id",
          "actor_username",
          "reference",
          "created_at"
        ]
      },
      "TaskQueryRecoveryResult": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "recovery_id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "poll_until": {
            "type": "string",
            "format": "date-time"
          },
          "reused": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "recovery_id",
          "poll_until",
          "reused"
        ]
      },
      "TaskQueryRecovery": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "reference": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          }
        },
        "required": [
          "reference"
        ]
      },
      "NowPaymentsCapabilities": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "currency": {
            "const": "usd"
          },
          "micro_per_usd_cent": {
            "const": "10000"
          },
          "min_amount_usd_cents": {
            "type": "string",
            "pattern": "^(?:[1-9][0-9]{2,5}|1000000)$",
            "maxLength": 7,
            "description": "NOWPayments USD整数美分，100–1000000（$1–$10000）；1美分=10000 OneAster整数账务单位。"
          },
          "max_amount_usd_cents": {
            "type": "string",
            "pattern": "^(?:[1-9][0-9]{2,5}|1000000)$",
            "maxLength": 7,
            "description": "NOWPayments USD整数美分，100–1000000（$1–$10000）；1美分=10000 OneAster整数账务单位。"
          },
          "max_pending_orders": {
            "const": 50
          },
          "payment_options": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NowPaymentsPaymentOption"
            }
          },
          "default_pay_currency": {
            "const": "usdttrc20"
          },
          "payment_window_seconds": {
            "const": 900
          },
          "archive_enabled": {
            "type": "boolean",
            "description": "管理员归档开关，默认关闭。"
          },
          "cancellation_enabled": {
            "const": false
          },
          "pending_order_count": {
            "type": "string",
            "pattern": "^(0|[1-9][0-9]*)$",
            "description": "Current Session account snapshot of unarchived creating/unknown/open orders with an unexpired checkout window, plus legacy orders without a deadline; available even when new orders are disabled. Not an admission guarantee."
          },
          "pending_order_states": {
            "type": "array",
            "prefixItems": [
              {
                "const": "creating"
              },
              {
                "const": "unknown"
              },
              {
                "const": "open"
              }
            ],
            "minItems": 3,
            "maxItems": 3
          }
        },
        "required": [
          "enabled",
          "currency",
          "micro_per_usd_cent",
          "min_amount_usd_cents",
          "max_amount_usd_cents",
          "max_pending_orders",
          "payment_options",
          "default_pay_currency",
          "payment_window_seconds",
          "archive_enabled",
          "cancellation_enabled",
          "pending_order_count",
          "pending_order_states"
        ]
      },
      "NowPaymentsPaymentOption": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "pay_currency": {
            "enum": [
              "usdttrc20",
              "usdtbsc",
              "usdterc20",
              "usdtmatic",
              "usdcsol",
              "usdcbsc",
              "usdc",
              "usdcmatic"
            ]
          },
          "asset": {
            "enum": [
              "USDT",
              "USDC"
            ]
          },
          "network": {
            "enum": [
              "tron",
              "bsc",
              "ethereum",
              "polygon",
              "solana"
            ]
          },
          "label": {
            "type": "string"
          }
        },
        "required": [
          "pay_currency",
          "asset",
          "network",
          "label"
        ]
      },
      "NowPaymentsOrderResult": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "order": {
            "$ref": "#/components/schemas/NowPaymentsOrder"
          },
          "reused": {
            "type": "boolean"
          }
        },
        "required": [
          "order",
          "reused"
        ]
      },
      "NowPaymentsOrder": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "user_id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "currency": {
            "const": "usd"
          },
          "amount_usd_cents": {
            "type": "string",
            "pattern": "^(?:[1-9][0-9]{2,5}|1000000)$",
            "maxLength": 7,
            "description": "NOWPayments USD整数美分，100–1000000（$1–$10000）；1美分=10000 OneAster整数账务单位。"
          },
          "credit_micro": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "整数账务单位；1 积分 = 10000 单位，1 USD = 100 积分。前端用 BigInt。"
          },
          "state": {
            "enum": [
              "creating",
              "unknown",
              "open",
              "paid",
              "expired",
              "failed"
            ]
          },
          "invoice_id": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "checkout_url": {
            "anyOf": [
              {
                "type": "string",
                "format": "uri",
                "description": "仅本人未归档且付款窗口未超时的 open 订单返回托管付款链接；旧订单没有本地截止时间。"
              },
              {
                "type": "null"
              }
            ]
          },
          "latest_payment_status": {
            "anyOf": [
              {
                "enum": [
                  "waiting",
                  "confirming",
                  "confirmed",
                  "sending",
                  "partially_paid",
                  "finished",
                  "failed",
                  "refunded",
                  "expired"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "paid_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "archived": {
            "type": "boolean"
          },
          "archived_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "pay_currency": {
            "anyOf": [
              {
                "enum": [
                  "usdttrc20",
                  "usdtbsc",
                  "usdterc20",
                  "usdtmatic",
                  "usdcsol",
                  "usdcbsc",
                  "usdc",
                  "usdcmatic"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "expires_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "payment_window_expired": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "user_id",
          "currency",
          "amount_usd_cents",
          "credit_micro",
          "state",
          "invoice_id",
          "checkout_url",
          "latest_payment_status",
          "created_at",
          "updated_at",
          "paid_at",
          "archived",
          "archived_at",
          "pay_currency",
          "expires_at",
          "payment_window_expired"
        ]
      },
      "NowPaymentsOrderInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "amount_usd_cents": {
            "type": "string",
            "pattern": "^(?:[1-9][0-9]{2,5}|1000000)$",
            "maxLength": 7,
            "description": "新订单1500–1000000美元美分；旧订单以原金额和原意图重放保持报价。"
          },
          "pay_currency": {
            "anyOf": [
              {
                "enum": [
                  "usdttrc20",
                  "usdtbsc",
                  "usdterc20",
                  "usdtmatic",
                  "usdcsol",
                  "usdcbsc",
                  "usdc",
                  "usdcmatic"
                ],
                "description": "币种/网络代码；省略默认USDT TRON；不能为空或使用其他链，提交后不能改变。"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "amount_usd_cents"
        ]
      },
      "NowPaymentsOrderPage": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "page": {
            "type": "integer",
            "minimum": 0
          },
          "size": {
            "type": "integer",
            "minimum": 0
          },
          "total": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NowPaymentsOrder"
            }
          }
        },
        "required": [
          "page",
          "size",
          "total",
          "items"
        ]
      },
      "NowPaymentsSummary": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "sampled_at": {
            "type": "string",
            "format": "date-time"
          },
          "total_orders": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "orders_by_state": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "creating": {
                "type": "string",
                "pattern": "^[0-9]+$"
              },
              "unknown": {
                "type": "string",
                "pattern": "^[0-9]+$"
              },
              "open": {
                "type": "string",
                "pattern": "^[0-9]+$"
              },
              "paid": {
                "type": "string",
                "pattern": "^[0-9]+$"
              },
              "expired": {
                "type": "string",
                "pattern": "^[0-9]+$"
              },
              "failed": {
                "type": "string",
                "pattern": "^[0-9]+$"
              }
            },
            "required": [
              "creating",
              "unknown",
              "open",
              "paid",
              "expired",
              "failed"
            ]
          },
          "pending_orders": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "pending_amount_usd_cents": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "未归档、付款窗口有效的待付款订单原始美元美分报价合计，不是钱包冻结额。"
          },
          "pending_credit_micro": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "未归档、付款窗口有效的待付款订单原始积分报价合计，非钱包冻结额。"
          },
          "paid_amount_usd_cents": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "已付款订单原始美元美分报价合计，不是链上净收款。"
          },
          "paid_credit_micro": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "已付款订单原始积分报价合计，不是当前余额。"
          },
          "oldest_pending_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "oldest_pending_age_seconds": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "sampled_at",
          "total_orders",
          "orders_by_state",
          "pending_orders",
          "pending_amount_usd_cents",
          "pending_credit_micro",
          "paid_amount_usd_cents",
          "paid_credit_micro",
          "oldest_pending_at",
          "oldest_pending_age_seconds"
        ]
      },
      "NowPaymentsPaymentEvidencePage": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "order_id": {
            "type": "string",
            "format": "uuid"
          },
          "page": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000
          },
          "size": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "total": {
            "type": "string",
            "pattern": "^(0|[1-9][0-9]*)$"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NowPaymentsPaymentEvidence"
            }
          }
        },
        "required": [
          "order_id",
          "page",
          "size",
          "total",
          "items"
        ]
      },
      "NowPaymentsPaymentEvidence": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "payment_id": {
            "type": "string",
            "pattern": "^[1-9][0-9]{0,127}$"
          },
          "invoice_id": {
            "type": "string",
            "pattern": "^[1-9][0-9]{0,127}$"
          },
          "payment_status": {
            "type": "string",
            "description": "本地保存的状态，非供应商实时状态。"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "payment_id",
          "invoice_id",
          "payment_status",
          "created_at",
          "updated_at"
        ]
      },
      "NowPaymentsArchiveResult": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "archived": {
            "const": true
          },
          "archived_at": {
            "type": "string",
            "format": "date-time"
          },
          "reused": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "archived",
          "archived_at",
          "reused"
        ]
      },
      "NowPaymentsArchiveInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "reference": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          }
        },
        "required": [
          "reference"
        ]
      },
      "NowPaymentsReconcile": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "payment_id": {
            "type": "string",
            "pattern": "^[1-9][0-9]*$",
            "maxLength": 128
          }
        },
        "required": [
          "payment_id"
        ]
      },
      "NowPaymentsIPNResult": {
        "oneOf": [
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "reused": {
                "type": "boolean"
              }
            },
            "required": [
              "reused"
            ]
          },
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "ignored": {
                "const": true
              }
            },
            "required": [
              "ignored"
            ]
          }
        ]
      },
      "NowPaymentsIPN": {
        "type": "object",
        "description": "NOWPayments 原始 IPN JSON；保留 body 和 x-nowpayments-sig，递归排序/HMAC SHA512 验签后查询支付证据。不得通过浏览器伪造付款结果。"
      },
      "ChannelTest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "key_id": {
            "type": "string",
            "pattern": "^[1-9][0-9]*$"
          },
          "expected_version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483646
          },
          "credential_version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483646
          },
          "price_version": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483646
          },
          "maximum_charge_micro": {
            "type": "string",
            "pattern": "^(0|[1-9][0-9]*)$",
            "description": "确认金额0–1000000（最多100积分），约束整笔预留及实际扣费；不得缩小原计量策略。",
            "maxLength": 7
          },
          "confirmed": {
            "const": true
          },
          "reference": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "chat": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "model": {
                "type": "string"
              },
              "messages": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "role": {
                      "enum": [
                        "system",
                        "user",
                        "assistant"
                      ]
                    },
                    "content": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "role",
                    "content"
                  ]
                },
                "minItems": 1,
                "maxItems": 16,
                "description": "所有content合计最多4096字节。"
              },
              "max_tokens": {
                "type": "integer",
                "minimum": 1,
                "maximum": 256
              },
              "stream": {
                "type": "boolean"
              },
              "temperature": {
                "type": "number",
                "minimum": 0,
                "maximum": 2
              }
            },
            "required": [
              "model",
              "messages",
              "max_tokens"
            ]
          }
        },
        "required": [
          "key_id",
          "expected_version",
          "credential_version",
          "price_version",
          "maximum_charge_micro",
          "confirmed",
          "reference",
          "chat"
        ]
      },
      "ChannelHealthPage": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ChannelHealth"
            }
          },
          "total": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "page": {
            "type": "integer",
            "minimum": 0
          },
          "size": {
            "type": "integer",
            "minimum": 0
          },
          "window_minutes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1440
          },
          "sample_time": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "items",
          "total",
          "page",
          "size",
          "window_minutes",
          "sample_time"
        ]
      },
      "ChannelHealth": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "channel_id": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "channel_name": {
            "type": "string"
          },
          "channel_type": {
            "type": "string"
          },
          "channel_version": {
            "type": "integer",
            "minimum": 0
          },
          "credential_version": {
            "type": "integer",
            "minimum": 0
          },
          "model": {
            "type": "string"
          },
          "channel_enabled": {
            "type": "boolean"
          },
          "model_enabled": {
            "type": "boolean"
          },
          "sample_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "success_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "failure_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "in_flight_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "test_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "generation_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "legacy_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "first_token_sample_count": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "consecutive_failures": {
            "type": "string",
            "pattern": "^[0-9]+$"
          },
          "success_rate": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "avg_duration_ms": {
            "anyOf": [
              {
                "type": "number",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ]
          },
          "p95_duration_ms": {
            "anyOf": [
              {
                "type": "number",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ]
          },
          "avg_first_token_ms": {
            "anyOf": [
              {
                "type": "number",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ]
          },
          "avg_headers_ms": {
            "anyOf": [
              {
                "type": "number",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ]
          },
          "latest_attempt_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "latest_success_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "latest_failure_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "latest_diagnostic": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ProviderDiagnostic"
              },
              {
                "type": "null"
              }
            ]
          },
          "cooldown_until": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "enum": [
              "disabled",
              "no_data",
              "healthy",
              "degraded",
              "failing"
            ]
          }
        },
        "required": [
          "channel_id",
          "channel_name",
          "channel_type",
          "channel_version",
          "credential_version",
          "model",
          "channel_enabled",
          "model_enabled",
          "sample_count",
          "success_count",
          "failure_count",
          "in_flight_count",
          "test_count",
          "generation_count",
          "legacy_count",
          "first_token_sample_count",
          "consecutive_failures",
          "success_rate",
          "avg_duration_ms",
          "p95_duration_ms",
          "avg_first_token_ms",
          "avg_headers_ms",
          "latest_attempt_at",
          "latest_success_at",
          "latest_failure_at",
          "latest_diagnostic",
          "cooldown_until",
          "status"
        ]
      }
    },
    "securitySchemes": {
      "session": {
        "type": "http",
        "scheme": "bearer",
        "description": "登录得到 oas_ 会话；不是 API Key。"
      },
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "创建时返回一次的 oak_ Key。"
      }
    }
  }
}
