{
  "openapi": "3.1.0",
  "info": {
    "title": "lastAI Cloud API",
    "version": "2026-11-29",
    "description": "Public developer APIs for models, media, search, receipts, and plugin publishing."
  },
  "servers": [
    {
      "url": "https://cloud.lastai.tianyunai.com"
    }
  ],
  "tags": [
    {
      "name": "catalog",
      "description": "模型发现"
    },
    {
      "name": "language",
      "description": "对话、视觉与向量"
    },
    {
      "name": "media",
      "description": "图片与音视频"
    },
    {
      "name": "search",
      "description": "网页搜索"
    },
    {
      "name": "billing",
      "description": "请求回执"
    },
    {
      "name": "plugins",
      "description": "发布插件"
    }
  ],
  "paths": {
    "/v1/model-access/catalog": {
      "get": {
        "operationId": "catalog",
        "tags": [
          "catalog"
        ],
        "summary": "读取能力与参考价格",
        "description": "匿名获取公开参考目录，带 Key 获取当前账号和 Key 可用的能力。",
        "security": [
          {},
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "description": "HTTP trace ID",
                "schema": {
                  "type": "string"
                }
              },
              "X-LastAI-Usage-Id": {
                "description": "Present on requests that have a model reservation or media receipt",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "version": {
                      "type": "string"
                    },
                    "price_scope": {
                      "type": "string"
                    },
                    "models": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "provider": {
                            "type": "string"
                          },
                          "region": {
                            "type": "string"
                          },
                          "operations": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "capabilities": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "pricing": {
                            "type": "object",
                            "properties": {
                              "currency": {
                                "type": "string"
                              },
                              "list_price_currency": {
                                "type": "string"
                              },
                              "multiplier": {
                                "type": "integer"
                              }
                            },
                            "additionalProperties": true
                          },
                          "parameters": {
                            "type": "object",
                            "properties": {
                              "context_tokens": {
                                "type": "integer"
                              },
                              "display_name": {
                                "type": "string"
                              }
                            },
                            "additionalProperties": true
                          },
                          "verification": {
                            "type": "object",
                            "properties": {
                              "state": {
                                "type": "string"
                              },
                              "operations": {
                                "type": "object",
                                "properties": {},
                                "additionalProperties": true
                              }
                            },
                            "additionalProperties": true
                          }
                        },
                        "additionalProperties": true
                      }
                    }
                  },
                  "additionalProperties": true
                },
                "example": {
                  "version": "lastai.model-capabilities.v1",
                  "price_scope": "account",
                  "models": [
                    {
                      "id": "deepseek/deepseek-v4-flash",
                      "provider": "deepseek",
                      "region": "cn",
                      "operations": [
                        "chat",
                        "responses"
                      ],
                      "capabilities": [
                        "input:text",
                        "output:text"
                      ],
                      "pricing": {
                        "currency": "CNY",
                        "list_price_currency": "USD",
                        "multiplier": 1
                      },
                      "parameters": {
                        "context_tokens": 1048576,
                        "display_name": "DeepSeek V4 Flash"
                      },
                      "verification": {
                        "state": "available",
                        "operations": {}
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "检查 Bearer Key、有效期和是否撤销。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "检查速率、并发和 UTC 日预算，再按退避策略重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务暂不可用或原请求待确认。保留原幂等键。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/proxy/v1/models": {
      "get": {
        "operationId": "openai-models",
        "tags": [
          "catalog"
        ],
        "summary": "列出 OpenAI 兼容模型",
        "description": "供 SDK 或应用选择模型。以 data[].id 和 chat_runtime_supported 判断是否可以用于对话。",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "description": "HTTP trace ID",
                "schema": {
                  "type": "string"
                }
              },
              "X-LastAI-Usage-Id": {
                "description": "Present on requests that have a model reservation or media receipt",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string"
                    },
                    "configured_providers": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "provider_labels": {
                      "type": "object",
                      "properties": {
                        "deepseek": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "object": {
                            "type": "string"
                          },
                          "owned_by": {
                            "type": "string"
                          },
                          "provider": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "display_name": {
                            "type": "string"
                          },
                          "region": {
                            "type": "string"
                          },
                          "category": {
                            "type": "string"
                          },
                          "capabilities": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "chat_runtime_supported": {
                            "type": "boolean"
                          },
                          "context": {
                            "type": "integer"
                          },
                          "enabled": {
                            "type": "boolean"
                          }
                        },
                        "additionalProperties": true
                      }
                    }
                  },
                  "additionalProperties": true
                },
                "example": {
                  "object": "list",
                  "configured_providers": [
                    "deepseek"
                  ],
                  "provider_labels": {
                    "deepseek": "DeepSeek"
                  },
                  "data": [
                    {
                      "id": "deepseek/deepseek-v4-flash",
                      "object": "model",
                      "owned_by": "deepseek",
                      "provider": "deepseek",
                      "name": "deepseek-v4-flash",
                      "display_name": "DeepSeek-V4.1-Flash",
                      "region": "cn",
                      "category": "chat",
                      "capabilities": [
                        "input:text",
                        "output:text",
                        "stream"
                      ],
                      "chat_runtime_supported": true,
                      "context": 1048576,
                      "enabled": true
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "检查 Bearer Key、有效期和是否撤销。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "检查速率、并发和 UTC 日预算，再按退避策略重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务暂不可用或原请求待确认。保留原幂等键。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/proxy/harness/v1/models": {
      "get": {
        "operationId": "harness-models",
        "tags": [
          "catalog"
        ],
        "summary": "列出桌面 Key 兼容模型",
        "description": "返回桌面 Key 接入路径所使用的可用模型。",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "description": "HTTP trace ID",
                "schema": {
                  "type": "string"
                }
              },
              "X-LastAI-Usage-Id": {
                "description": "Present on requests that have a model reservation or media receipt",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string"
                    },
                    "configured_providers": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "provider_labels": {
                      "type": "object",
                      "properties": {
                        "deepseek": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "object": {
                            "type": "string"
                          },
                          "owned_by": {
                            "type": "string"
                          },
                          "provider": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "display_name": {
                            "type": "string"
                          },
                          "region": {
                            "type": "string"
                          },
                          "category": {
                            "type": "string"
                          },
                          "capabilities": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "chat_runtime_supported": {
                            "type": "boolean"
                          },
                          "context": {
                            "type": "integer"
                          },
                          "enabled": {
                            "type": "boolean"
                          }
                        },
                        "additionalProperties": true
                      }
                    }
                  },
                  "additionalProperties": true
                },
                "example": {
                  "object": "list",
                  "configured_providers": [
                    "deepseek"
                  ],
                  "provider_labels": {
                    "deepseek": "DeepSeek"
                  },
                  "data": [
                    {
                      "id": "deepseek/deepseek-v4-flash",
                      "object": "model",
                      "owned_by": "deepseek",
                      "provider": "deepseek",
                      "name": "deepseek-v4-flash",
                      "display_name": "DeepSeek-V4.1-Flash",
                      "region": "cn",
                      "category": "chat",
                      "capabilities": [
                        "input:text",
                        "output:text",
                        "stream"
                      ],
                      "chat_runtime_supported": true,
                      "context": 1048576,
                      "enabled": true
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "检查 Bearer Key、有效期和是否撤销。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "检查速率、并发和 UTC 日预算，再按退避策略重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务暂不可用或原请求待确认。保留原幂等键。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/proxy/v1/chat/completions": {
      "post": {
        "operationId": "chat-completions",
        "tags": [
          "language"
        ],
        "summary": "创建对话回复",
        "description": "支持同步、SSE、图片理解和函数调用，所需权限由内容和模型决定。",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "每个新请求使用不同值，最长 128 个 ASCII 字符。",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "目录返回的完整模型 ID，须授权 chat。"
                  },
                  "messages": {
                    "type": "array",
                    "items": {},
                    "description": "消息列表。每项包含 role 和 content。"
                  },
                  "max_tokens": {
                    "type": "integer",
                    "description": "请求输出上限。可用范围见目录。"
                  },
                  "stream": {
                    "type": "boolean",
                    "description": "默认 false。true 返回 SSE。"
                  },
                  "stream_options": {
                    "type": "object",
                    "properties": {
                      "include_usage": {
                        "type": "boolean",
                        "description": "请求在流中返回 Token 用量。"
                      }
                    }
                  },
                  "tools": {
                    "anyOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      },
                      {
                        "type": "object",
                        "additionalProperties": true
                      }
                    ],
                    "description": "声明函数及选择方式。回传工具结果用 tool_call_id。"
                  },
                  "tool_choice": {
                    "anyOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      },
                      {
                        "type": "object",
                        "additionalProperties": true
                      }
                    ],
                    "description": "声明函数及选择方式。回传工具结果用 tool_call_id。"
                  },
                  "temperature": {
                    "type": "number",
                    "description": "采样设置。实际支持取决于模型。"
                  },
                  "top_p": {
                    "type": "number",
                    "description": "采样设置。实际支持取决于模型。"
                  },
                  "reasoning_effort": {
                    "type": "string",
                    "description": "支持推理档位的模型可按目录的 effort 参数设置。"
                  },
                  "reasoning": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "支持推理档位的模型可按目录的 effort 参数设置。"
                  }
                },
                "additionalProperties": true,
                "required": [
                  "model",
                  "messages"
                ]
              },
              "examples": {
                "default": {
                  "value": {
                    "model": "deepseek/deepseek-v4-flash",
                    "messages": [
                      {
                        "role": "user",
                        "content": "Reply with one word: ready."
                      }
                    ],
                    "max_tokens": 128
                  }
                },
                "stream": {
                  "value": {
                    "model": "deepseek/deepseek-v4-flash",
                    "messages": [
                      {
                        "role": "user",
                        "content": "Reply with one word: ready."
                      }
                    ],
                    "max_tokens": 128,
                    "stream": true,
                    "stream_options": {
                      "include_usage": true
                    }
                  }
                },
                "tools": {
                  "value": {
                    "model": "deepseek/deepseek-v4-flash",
                    "messages": [
                      {
                        "role": "user",
                        "content": "Look up the status of order demo-100."
                      }
                    ],
                    "max_tokens": 128,
                    "tools": [
                      {
                        "type": "function",
                        "function": {
                          "name": "get_order_status",
                          "description": "Read the status for an order number.",
                          "parameters": {
                            "type": "object",
                            "properties": {
                              "order_id": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "order_id"
                            ]
                          }
                        }
                      }
                    ],
                    "tool_choice": {
                      "type": "function",
                      "function": {
                        "name": "get_order_status"
                      }
                    }
                  }
                },
                "vision": {
                  "value": {
                    "model": "deepseek/deepseek-v4-flash",
                    "messages": [
                      {
                        "role": "user",
                        "content": [
                          {
                            "type": "text",
                            "text": "What is shown in this image?"
                          },
                          {
                            "type": "image_url",
                            "image_url": {
                              "url": "data:image/png;base64,$LASTAI_IMAGE_BASE64"
                            }
                          }
                        ]
                      }
                    ],
                    "max_tokens": 128
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "description": "HTTP trace ID",
                "schema": {
                  "type": "string"
                }
              },
              "X-LastAI-Usage-Id": {
                "description": "Present on requests that have a model reservation or media receipt",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "object": {
                      "type": "string"
                    },
                    "created": {
                      "type": "integer"
                    },
                    "model": {
                      "type": "string"
                    },
                    "choices": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer"
                          },
                          "message": {
                            "type": "object",
                            "properties": {
                              "role": {
                                "type": "string"
                              },
                              "content": {
                                "type": "string"
                              }
                            },
                            "additionalProperties": true
                          },
                          "finish_reason": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": true
                      }
                    },
                    "usage": {
                      "type": "object",
                      "properties": {
                        "prompt_tokens": {
                          "type": "integer"
                        },
                        "completion_tokens": {
                          "type": "integer"
                        },
                        "total_tokens": {
                          "type": "integer"
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "additionalProperties": true
                },
                "example": {
                  "id": "chatcmpl_demo",
                  "object": "chat.completion",
                  "created": 1795910400,
                  "model": "deepseek-v4-flash",
                  "choices": [
                    {
                      "index": 0,
                      "message": {
                        "role": "assistant",
                        "content": "ready"
                      },
                      "finish_reason": "stop"
                    }
                  ],
                  "usage": {
                    "prompt_tokens": 13,
                    "completion_tokens": 1,
                    "total_tokens": 14
                  }
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                },
                "example": "data: {\"object\":\"chat.completion.chunk\",\"choices\":[{\"index\":0,\"delta\":{\"content\":\"ready\"},\"finish_reason\":null}]}\n\ndata: {\"choices\":[],\"usage\":{\"prompt_tokens\":13,\"completion_tokens\":1,\"total_tokens\":14}}\n\ndata: [DONE]\n"
              }
            }
          },
          "400": {
            "description": "检查字段、模型合同、媒体格式或钱包余额。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "检查 Bearer Key、有效期和是否撤销。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "核对套餐、Key 的模型及操作范围，或命名空间归属。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "先查原单。相同插件版本的内容有变时提高版本号。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "检查速率、并发和 UTC 日预算，再按退避策略重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "上游未能完成请求。重试前确认原请求和扣费。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务暂不可用或原请求待确认。保留原幂等键。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/proxy/harness/v1/chat/completions": {
      "post": {
        "operationId": "harness-chat",
        "tags": [
          "language"
        ],
        "summary": "桌面 Key 兼容对话",
        "description": "面向 8.x 桌面 API Key 模式。请求与响应采用同一对话格式。",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "每个新请求使用不同值，最长 128 个 ASCII 字符。",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "目录返回的完整模型 ID，须授权 chat。"
                  },
                  "messages": {
                    "type": "array",
                    "items": {},
                    "description": "消息列表。每项包含 role 和 content。"
                  },
                  "max_tokens": {
                    "type": "integer",
                    "description": "请求输出上限。可用范围见目录。"
                  },
                  "stream": {
                    "type": "boolean",
                    "description": "默认 false。true 返回 SSE。"
                  },
                  "stream_options": {
                    "type": "object",
                    "properties": {
                      "include_usage": {
                        "type": "boolean",
                        "description": "请求在流中返回 Token 用量。"
                      }
                    }
                  },
                  "tools": {
                    "anyOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      },
                      {
                        "type": "object",
                        "additionalProperties": true
                      }
                    ],
                    "description": "声明函数及选择方式。回传工具结果用 tool_call_id。"
                  },
                  "tool_choice": {
                    "anyOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      },
                      {
                        "type": "object",
                        "additionalProperties": true
                      }
                    ],
                    "description": "声明函数及选择方式。回传工具结果用 tool_call_id。"
                  },
                  "temperature": {
                    "type": "number",
                    "description": "采样设置。实际支持取决于模型。"
                  },
                  "top_p": {
                    "type": "number",
                    "description": "采样设置。实际支持取决于模型。"
                  },
                  "reasoning_effort": {
                    "type": "string",
                    "description": "支持推理档位的模型可按目录的 effort 参数设置。"
                  },
                  "reasoning": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "支持推理档位的模型可按目录的 effort 参数设置。"
                  }
                },
                "additionalProperties": true,
                "required": [
                  "model",
                  "messages"
                ]
              },
              "examples": {
                "default": {
                  "value": {
                    "model": "deepseek/deepseek-v4-flash",
                    "messages": [
                      {
                        "role": "user",
                        "content": "Reply with one word: ready."
                      }
                    ],
                    "max_tokens": 128
                  }
                },
                "stream": {
                  "value": {
                    "model": "deepseek/deepseek-v4-flash",
                    "messages": [
                      {
                        "role": "user",
                        "content": "Reply with one word: ready."
                      }
                    ],
                    "max_tokens": 128,
                    "stream": true,
                    "stream_options": {
                      "include_usage": true
                    }
                  }
                },
                "tools": {
                  "value": {
                    "model": "deepseek/deepseek-v4-flash",
                    "messages": [
                      {
                        "role": "user",
                        "content": "Look up the status of order demo-100."
                      }
                    ],
                    "max_tokens": 128,
                    "tools": [
                      {
                        "type": "function",
                        "function": {
                          "name": "get_order_status",
                          "description": "Read the status for an order number.",
                          "parameters": {
                            "type": "object",
                            "properties": {
                              "order_id": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "order_id"
                            ]
                          }
                        }
                      }
                    ],
                    "tool_choice": {
                      "type": "function",
                      "function": {
                        "name": "get_order_status"
                      }
                    }
                  }
                },
                "vision": {
                  "value": {
                    "model": "deepseek/deepseek-v4-flash",
                    "messages": [
                      {
                        "role": "user",
                        "content": [
                          {
                            "type": "text",
                            "text": "What is shown in this image?"
                          },
                          {
                            "type": "image_url",
                            "image_url": {
                              "url": "data:image/png;base64,$LASTAI_IMAGE_BASE64"
                            }
                          }
                        ]
                      }
                    ],
                    "max_tokens": 128
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "description": "HTTP trace ID",
                "schema": {
                  "type": "string"
                }
              },
              "X-LastAI-Usage-Id": {
                "description": "Present on requests that have a model reservation or media receipt",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "object": {
                      "type": "string"
                    },
                    "created": {
                      "type": "integer"
                    },
                    "model": {
                      "type": "string"
                    },
                    "choices": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer"
                          },
                          "message": {
                            "type": "object",
                            "properties": {
                              "role": {
                                "type": "string"
                              },
                              "content": {
                                "type": "string"
                              }
                            },
                            "additionalProperties": true
                          },
                          "finish_reason": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": true
                      }
                    },
                    "usage": {
                      "type": "object",
                      "properties": {
                        "prompt_tokens": {
                          "type": "integer"
                        },
                        "completion_tokens": {
                          "type": "integer"
                        },
                        "total_tokens": {
                          "type": "integer"
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "additionalProperties": true
                },
                "example": {
                  "id": "chatcmpl_demo",
                  "object": "chat.completion",
                  "created": 1795910400,
                  "model": "deepseek-v4-flash",
                  "choices": [
                    {
                      "index": 0,
                      "message": {
                        "role": "assistant",
                        "content": "ready"
                      },
                      "finish_reason": "stop"
                    }
                  ],
                  "usage": {
                    "prompt_tokens": 13,
                    "completion_tokens": 1,
                    "total_tokens": 14
                  }
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                },
                "example": "data: {\"object\":\"chat.completion.chunk\",\"choices\":[{\"index\":0,\"delta\":{\"content\":\"ready\"},\"finish_reason\":null}]}\n\ndata: {\"choices\":[],\"usage\":{\"prompt_tokens\":13,\"completion_tokens\":1,\"total_tokens\":14}}\n\ndata: [DONE]\n"
              }
            }
          },
          "400": {
            "description": "检查字段、模型合同、媒体格式或钱包余额。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "检查 Bearer Key、有效期和是否撤销。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "核对套餐、Key 的模型及操作范围，或命名空间归属。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "先查原单。相同插件版本的内容有变时提高版本号。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "检查速率、并发和 UTC 日预算，再按退避策略重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "上游未能完成请求。重试前确认原请求和扣费。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务暂不可用或原请求待确认。保留原幂等键。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/proxy/v1/responses": {
      "post": {
        "operationId": "responses",
        "tags": [
          "language"
        ],
        "summary": "创建 Responses 回复",
        "description": "使用兼容的 Responses 协议。后续请求发送上下文和工具结果。网页搜索另走搜索接口。",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "每个新请求使用不同值，最长 128 个 ASCII 字符。",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "目录返回的完整模型 ID，须授权 responses。"
                  },
                  "input": {
                    "type": "string",
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "items": {}
                      }
                    ],
                    "description": "文本，或消息、函数调用与函数结果组成的序列。"
                  },
                  "max_output_tokens": {
                    "type": "integer",
                    "description": "生成上限。"
                  },
                  "instructions": {
                    "type": "string",
                    "description": "此请求的补充指令。"
                  },
                  "stream": {
                    "type": "boolean",
                    "description": "true 返回 SSE。"
                  },
                  "tools": {
                    "anyOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      },
                      {
                        "type": "object",
                        "additionalProperties": true
                      }
                    ],
                    "description": "客户应用执行的工具及选择方式。"
                  },
                  "tool_choice": {
                    "anyOf": [
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "string"
                      },
                      {
                        "type": "object",
                        "additionalProperties": true
                      }
                    ],
                    "description": "客户应用执行的工具及选择方式。"
                  },
                  "temperature": {
                    "type": "number",
                    "description": "模型支持时可设置采样。"
                  },
                  "top_p": {
                    "type": "number",
                    "description": "模型支持时可设置采样。"
                  }
                },
                "additionalProperties": true,
                "required": [
                  "model",
                  "input"
                ]
              },
              "examples": {
                "default": {
                  "value": {
                    "model": "deepseek/deepseek-v4-flash",
                    "input": "Reply with one word: ready.",
                    "max_output_tokens": 128
                  }
                },
                "stream": {
                  "value": {
                    "model": "deepseek/deepseek-v4-flash",
                    "input": "Reply with one word: ready.",
                    "max_output_tokens": 128,
                    "stream": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "description": "HTTP trace ID",
                "schema": {
                  "type": "string"
                }
              },
              "X-LastAI-Usage-Id": {
                "description": "Present on requests that have a model reservation or media receipt",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "object": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "model": {
                      "type": "string"
                    },
                    "output": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string"
                          },
                          "role": {
                            "type": "string"
                          },
                          "content": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string"
                                },
                                "text": {
                                  "type": "string"
                                },
                                "annotations": {
                                  "type": "array",
                                  "items": {}
                                }
                              },
                              "additionalProperties": true
                            }
                          }
                        },
                        "additionalProperties": true
                      }
                    },
                    "usage": {
                      "type": "object",
                      "properties": {
                        "input_tokens": {
                          "type": "integer"
                        },
                        "output_tokens": {
                          "type": "integer"
                        },
                        "total_tokens": {
                          "type": "integer"
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "additionalProperties": true
                },
                "example": {
                  "id": "resp_demo",
                  "object": "response",
                  "status": "completed",
                  "model": "deepseek/deepseek-v4-flash",
                  "output": [
                    {
                      "type": "message",
                      "role": "assistant",
                      "content": [
                        {
                          "type": "output_text",
                          "text": "ready",
                          "annotations": []
                        }
                      ]
                    }
                  ],
                  "usage": {
                    "input_tokens": 13,
                    "output_tokens": 1,
                    "total_tokens": 14
                  }
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                },
                "example": "event: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"delta\":\"ready\",\"output_index\":0,\"content_index\":0}\n\nevent: response.completed\ndata: {\"type\":\"response.completed\",\"response\":{\"id\":\"resp_demo\",\"status\":\"completed\"}}\n"
              }
            }
          },
          "400": {
            "description": "检查字段、模型合同、媒体格式或钱包余额。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "检查 Bearer Key、有效期和是否撤销。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "核对套餐、Key 的模型及操作范围，或命名空间归属。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "先查原单。相同插件版本的内容有变时提高版本号。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "检查速率、并发和 UTC 日预算，再按退避策略重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "上游未能完成请求。重试前确认原请求和扣费。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务暂不可用或原请求待确认。保留原幂等键。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/proxy/v1/embeddings": {
      "post": {
        "operationId": "embeddings",
        "tags": [
          "language"
        ],
        "summary": "生成文本向量",
        "description": "向量按 index 对应输入。响应示例中的向量保留前三维便于阅读。",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "每个新请求使用不同值，最长 128 个 ASCII 字符。",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "目录返回的完整模型 ID，须授权 embedding。"
                  },
                  "input": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "items": {}
                      }
                    ],
                    "description": "单段文本、文本数组或模型支持的 Token 数组。"
                  },
                  "dimensions": {
                    "type": "integer",
                    "description": "按模型支持情况设置向量维数。"
                  },
                  "encoding_format": {
                    "type": "string",
                    "description": "按模型支持情况设置输出编码。"
                  }
                },
                "additionalProperties": true,
                "required": [
                  "model",
                  "input"
                ]
              },
              "examples": {
                "default": {
                  "value": {
                    "model": "openrouter/baai/bge-base-en-v1.5",
                    "input": [
                      "Meeting notes"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "description": "HTTP trace ID",
                "schema": {
                  "type": "string"
                }
              },
              "X-LastAI-Usage-Id": {
                "description": "Present on requests that have a model reservation or media receipt",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string"
                    },
                    "model": {
                      "type": "string"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "object": {
                            "type": "string"
                          },
                          "index": {
                            "type": "integer"
                          },
                          "embedding": {
                            "type": "array",
                            "items": {
                              "type": "number"
                            }
                          }
                        },
                        "additionalProperties": true
                      }
                    },
                    "usage": {
                      "type": "object",
                      "properties": {
                        "prompt_tokens": {
                          "type": "integer"
                        },
                        "total_tokens": {
                          "type": "integer"
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "additionalProperties": true
                },
                "example": {
                  "object": "list",
                  "model": "baai/bge-base-en-v1.5",
                  "data": [
                    {
                      "object": "embedding",
                      "index": 0,
                      "embedding": [
                        0.03,
                        -0.08,
                        0.14
                      ]
                    }
                  ],
                  "usage": {
                    "prompt_tokens": 3,
                    "total_tokens": 3
                  }
                }
              }
            }
          },
          "400": {
            "description": "检查字段、模型合同、媒体格式或钱包余额。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "检查 Bearer Key、有效期和是否撤销。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "核对套餐、Key 的模型及操作范围，或命名空间归属。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "先查原单。相同插件版本的内容有变时提高版本号。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "检查速率、并发和 UTC 日预算，再按退避策略重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "上游未能完成请求。重试前确认原请求和扣费。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务暂不可用或原请求待确认。保留原幂等键。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/proxy/harness/v1/embeddings": {
      "post": {
        "operationId": "harness-embeddings",
        "tags": [
          "language"
        ],
        "summary": "桌面 Key 兼容向量",
        "description": "面向桌面 API Key 模式的向量接口。",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "每个新请求使用不同值，最长 128 个 ASCII 字符。",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "目录返回的完整模型 ID，须授权 embedding。"
                  },
                  "input": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "items": {}
                      }
                    ],
                    "description": "单段文本、文本数组或模型支持的 Token 数组。"
                  },
                  "dimensions": {
                    "type": "integer",
                    "description": "按模型支持情况设置向量维数。"
                  },
                  "encoding_format": {
                    "type": "string",
                    "description": "按模型支持情况设置输出编码。"
                  }
                },
                "additionalProperties": true,
                "required": [
                  "model",
                  "input"
                ]
              },
              "examples": {
                "default": {
                  "value": {
                    "model": "openrouter/baai/bge-base-en-v1.5",
                    "input": [
                      "Meeting notes"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "description": "HTTP trace ID",
                "schema": {
                  "type": "string"
                }
              },
              "X-LastAI-Usage-Id": {
                "description": "Present on requests that have a model reservation or media receipt",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string"
                    },
                    "model": {
                      "type": "string"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "object": {
                            "type": "string"
                          },
                          "index": {
                            "type": "integer"
                          },
                          "embedding": {
                            "type": "array",
                            "items": {
                              "type": "number"
                            }
                          }
                        },
                        "additionalProperties": true
                      }
                    },
                    "usage": {
                      "type": "object",
                      "properties": {
                        "prompt_tokens": {
                          "type": "integer"
                        },
                        "total_tokens": {
                          "type": "integer"
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "additionalProperties": true
                },
                "example": {
                  "object": "list",
                  "model": "baai/bge-base-en-v1.5",
                  "data": [
                    {
                      "object": "embedding",
                      "index": 0,
                      "embedding": [
                        0.03,
                        -0.08,
                        0.14
                      ]
                    }
                  ],
                  "usage": {
                    "prompt_tokens": 3,
                    "total_tokens": 3
                  }
                }
              }
            }
          },
          "400": {
            "description": "检查字段、模型合同、媒体格式或钱包余额。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "检查 Bearer Key、有效期和是否撤销。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "核对套餐、Key 的模型及操作范围，或命名空间归属。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "先查原单。相同插件版本的内容有变时提高版本号。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "检查速率、并发和 UTC 日预算，再按退避策略重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "上游未能完成请求。重试前确认原请求和扣费。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务暂不可用或原请求待确认。保留原幂等键。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/media/models": {
      "get": {
        "operationId": "media-models",
        "tags": [
          "media"
        ],
        "summary": "读取媒体模型合同",
        "description": "从这里确认具体模型接受的字段、枚举、参考图数量与估计费用。使用 Key 可查看它获准调用的模型。",
        "security": [
          {},
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "description": "HTTP trace ID",
                "schema": {
                  "type": "string"
                }
              },
              "X-LastAI-Usage-Id": {
                "description": "Present on requests that have a model reservation or media receipt",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "kind": {
                        "type": "string"
                      },
                      "operation": {
                        "type": "string"
                      },
                      "provider_id": {
                        "type": "string"
                      },
                      "billed_credits": {
                        "type": "integer"
                      },
                      "contract": {
                        "type": "object",
                        "properties": {
                          "media_kind": {
                            "type": "string"
                          },
                          "required_inputs": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "optional_inputs": {
                            "type": "array",
                            "items": {}
                          },
                          "parameters": {
                            "type": "array",
                            "items": {}
                          }
                        },
                        "additionalProperties": true
                      }
                    },
                    "additionalProperties": true
                  }
                },
                "example": [
                  {
                    "id": "kie/z-image",
                    "kind": "image",
                    "operation": "z-image",
                    "provider_id": "kie",
                    "billed_credits": 3,
                    "contract": {
                      "media_kind": "image",
                      "required_inputs": [
                        "prompt"
                      ],
                      "optional_inputs": [],
                      "parameters": []
                    }
                  }
                ]
              }
            }
          },
          "401": {
            "description": "检查 Bearer Key、有效期和是否撤销。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "核对套餐、Key 的模型及操作范围，或命名空间归属。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "检查速率、并发和 UTC 日预算，再按退避策略重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务暂不可用或原请求待确认。保留原幂等键。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/media/tasks": {
      "post": {
        "operationId": "create-media-task",
        "tags": [
          "media"
        ],
        "summary": "创建媒体作业",
        "description": "生成图片、视频、语音或音乐。先提交，之后根据任务 ID 查询终态。",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "每个新请求使用不同值，最长 128 个 ASCII 字符。",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "task_type": {
                    "type": "string",
                    "description": "IMAGE、VIDEO、AUDIO_SPEECH 或 MUSIC。语音转写使用专门接口。"
                  },
                  "model": {
                    "type": "string",
                    "description": "目录返回的完整模型 ID，须授权 image / video / speech / music。"
                  },
                  "input": {
                    "type": "object",
                    "properties": {
                      "prompt": {
                        "type": "string"
                      },
                      "reference_image_id": {
                        "type": "string",
                        "description": "支持参考图的模型可使用预上传得到的 ID。"
                      }
                    },
                    "additionalProperties": true,
                    "description": "按媒体目录的 contract 组装。常用字段包含 prompt、duration、resolution。"
                  },
                  "reference_image_ids": {
                    "type": "array",
                    "items": {},
                    "description": "支持参考图的模型可使用预上传得到的 ID。"
                  }
                },
                "additionalProperties": true,
                "required": [
                  "task_type",
                  "model",
                  "input"
                ]
              },
              "examples": {
                "default": {
                  "value": {
                    "task_type": "IMAGE",
                    "model": "kie/z-image",
                    "input": {
                      "prompt": "A single red square on a blue background, no text."
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "description": "HTTP trace ID",
                "schema": {
                  "type": "string"
                }
              },
              "X-LastAI-Usage-Id": {
                "description": "Present on requests that have a model reservation or media receipt",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "user_id": {
                      "type": "string"
                    },
                    "task_type": {
                      "type": "string"
                    },
                    "provider": {
                      "type": "string"
                    },
                    "model": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "input": {
                      "type": "object",
                      "properties": {
                        "prompt": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    },
                    "output": {
                      "type": "object",
                      "properties": {},
                      "additionalProperties": true
                    },
                    "cost_cents": {
                      "type": "integer"
                    },
                    "external_id": {
                      "type": "string"
                    },
                    "error": {},
                    "created_at": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                },
                "example": {
                  "id": "mt_0360d983f3ef4d249e3229f16026c237c2dd61aa",
                  "user_id": "usr_demo",
                  "task_type": "IMAGE",
                  "provider": "kie",
                  "model": "kie/z-image",
                  "status": "PROCESSING",
                  "input": {
                    "prompt": "A single red square on a blue background, no text."
                  },
                  "output": {},
                  "cost_cents": 3,
                  "external_id": "vendor_task_demo",
                  "error": null,
                  "created_at": "2026-11-29T00:00:00Z",
                  "updated_at": "2026-11-29T00:00:00Z"
                }
              }
            }
          },
          "400": {
            "description": "检查字段、模型合同、媒体格式或钱包余额。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "检查 Bearer Key、有效期和是否撤销。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "核对套餐、Key 的模型及操作范围，或命名空间归属。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "先查原单。相同插件版本的内容有变时提高版本号。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "检查速率、并发和 UTC 日预算，再按退避策略重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "上游未能完成请求。重试前确认原请求和扣费。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务暂不可用或原请求待确认。保留原幂等键。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "list-media-tasks",
        "tags": [
          "media"
        ],
        "summary": "列出媒体作业",
        "description": "返回当前 Key 创建的作业，最新在前。",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "description": "HTTP trace ID",
                "schema": {
                  "type": "string"
                }
              },
              "X-LastAI-Usage-Id": {
                "description": "Present on requests that have a model reservation or media receipt",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "user_id": {
                        "type": "string"
                      },
                      "task_type": {
                        "type": "string"
                      },
                      "provider": {
                        "type": "string"
                      },
                      "model": {
                        "type": "string"
                      },
                      "status": {
                        "type": "string"
                      },
                      "input": {
                        "type": "object",
                        "properties": {
                          "prompt": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": true
                      },
                      "output": {
                        "type": "object",
                        "properties": {
                          "urls": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "additionalProperties": true
                      },
                      "cost_cents": {
                        "type": "integer"
                      },
                      "external_id": {
                        "type": "string"
                      },
                      "error": {},
                      "created_at": {
                        "type": "string"
                      },
                      "updated_at": {
                        "type": "string"
                      }
                    },
                    "additionalProperties": true
                  }
                },
                "example": [
                  {
                    "id": "mt_0360d983f3ef4d249e3229f16026c237c2dd61aa",
                    "user_id": "usr_demo",
                    "task_type": "IMAGE",
                    "provider": "kie",
                    "model": "kie/z-image",
                    "status": "COMPLETED",
                    "input": {
                      "prompt": "A single red square on a blue background, no text."
                    },
                    "output": {
                      "urls": [
                        "https://example.com/media/result.png"
                      ]
                    },
                    "cost_cents": 3,
                    "external_id": "vendor_task_demo",
                    "error": null,
                    "created_at": "2026-11-29T00:00:00Z",
                    "updated_at": "2026-11-29T00:00:00Z"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "检查 Bearer Key、有效期和是否撤销。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "核对套餐、Key 的模型及操作范围，或命名空间归属。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "检查速率、并发和 UTC 日预算，再按退避策略重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务暂不可用或原请求待确认。保留原幂等键。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/media/tasks/{id}": {
      "get": {
        "operationId": "get-media-task",
        "tags": [
          "media"
        ],
        "summary": "查询媒体作业",
        "description": "用创建时的 Key 和作业 ID 查询。完成后读取 output，失败时查看 error 和退款记录。",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "提交接口返回的作业 ID。",
            "schema": {
              "type": "string"
            },
            "example": "mt_0360d983f3ef4d249e3229f16026c237c2dd61aa"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "description": "HTTP trace ID",
                "schema": {
                  "type": "string"
                }
              },
              "X-LastAI-Usage-Id": {
                "description": "Present on requests that have a model reservation or media receipt",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "user_id": {
                      "type": "string"
                    },
                    "task_type": {
                      "type": "string"
                    },
                    "provider": {
                      "type": "string"
                    },
                    "model": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "input": {
                      "type": "object",
                      "properties": {
                        "prompt": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    },
                    "output": {
                      "type": "object",
                      "properties": {
                        "urls": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "additionalProperties": true
                    },
                    "cost_cents": {
                      "type": "integer"
                    },
                    "external_id": {
                      "type": "string"
                    },
                    "error": {},
                    "created_at": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                },
                "example": {
                  "id": "mt_0360d983f3ef4d249e3229f16026c237c2dd61aa",
                  "user_id": "usr_demo",
                  "task_type": "IMAGE",
                  "provider": "kie",
                  "model": "kie/z-image",
                  "status": "COMPLETED",
                  "input": {
                    "prompt": "A single red square on a blue background, no text."
                  },
                  "output": {
                    "urls": [
                      "https://example.com/media/result.png"
                    ]
                  },
                  "cost_cents": 3,
                  "external_id": "vendor_task_demo",
                  "error": null,
                  "created_at": "2026-11-29T00:00:00Z",
                  "updated_at": "2026-11-29T00:00:00Z"
                }
              }
            }
          },
          "401": {
            "description": "检查 Bearer Key、有效期和是否撤销。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "核对套餐、Key 的模型及操作范围，或命名空间归属。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "核对 ID 与签发该请求的 Key，确认记录是否已生成。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "检查速率、并发和 UTC 日预算，再按退避策略重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务暂不可用或原请求待确认。保留原幂等键。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/media/reference-images": {
      "post": {
        "operationId": "upload-reference",
        "tags": [
          "media"
        ],
        "summary": "上传参考图片",
        "description": "发送 PNG、JPEG 或 WebP 的原始文件字节。用返回的 reference_id 提交支持图片引用的模型作业。",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "image/png": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "image/jpeg": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "image/webp": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "description": "HTTP trace ID",
                "schema": {
                  "type": "string"
                }
              },
              "X-LastAI-Usage-Id": {
                "description": "Present on requests that have a model reservation or media receipt",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "reference_id": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    },
                    "size": {
                      "type": "integer"
                    }
                  },
                  "additionalProperties": true
                },
                "example": {
                  "reference_id": "media-inputs/usr_demo/reference.png",
                  "url": "https://example.com/media/reference.png",
                  "size": 4096
                }
              }
            }
          },
          "400": {
            "description": "检查字段、模型合同、媒体格式或钱包余额。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "检查 Bearer Key、有效期和是否撤销。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "核对套餐、Key 的模型及操作范围，或命名空间归属。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "按该接口的大小上限重新打包。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "检查速率、并发和 UTC 日预算，再按退避策略重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务暂不可用或原请求待确认。保留原幂等键。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/proxy/v1/images/generations": {
      "post": {
        "operationId": "create-image",
        "tags": [
          "media"
        ],
        "summary": "同步生成图片",
        "description": "兼容图片生成接口，等待相同媒体管线的结果。需要显式的完整模型 ID。长任务优先使用作业接口。",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "每个新请求使用不同值，最长 128 个 ASCII 字符。",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "目录返回的完整模型 ID，须授权 image。"
                  },
                  "prompt": {
                    "type": "string",
                    "description": "图片的自然语言描述。"
                  }
                },
                "additionalProperties": true,
                "required": [
                  "model",
                  "prompt"
                ]
              },
              "examples": {
                "default": {
                  "value": {
                    "model": "kie/z-image",
                    "prompt": "A single red square on a blue background, no text."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "description": "HTTP trace ID",
                "schema": {
                  "type": "string"
                }
              },
              "X-LastAI-Usage-Id": {
                "description": "Present on requests that have a model reservation or media receipt",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "created": {
                      "type": "integer"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": true
                      }
                    }
                  },
                  "additionalProperties": true
                },
                "example": {
                  "created": 1795910400,
                  "data": [
                    {
                      "url": "https://example.com/media/result.png"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "检查字段、模型合同、媒体格式或钱包余额。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "检查 Bearer Key、有效期和是否撤销。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "核对套餐、Key 的模型及操作范围，或命名空间归属。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "先查原单。相同插件版本的内容有变时提高版本号。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "检查速率、并发和 UTC 日预算，再按退避策略重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "上游未能完成请求。重试前确认原请求和扣费。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务暂不可用或原请求待确认。保留原幂等键。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/images/generations": {
      "post": {
        "operationId": "images-alias",
        "tags": [
          "media"
        ],
        "summary": "同步生成图片兼容路径",
        "description": "请求体和结果与同步生成图片主接口一致。",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "每个新请求使用不同值，最长 128 个 ASCII 字符。",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "目录返回的完整模型 ID，须授权 image。"
                  },
                  "prompt": {
                    "type": "string",
                    "description": "图片的自然语言描述。"
                  }
                },
                "additionalProperties": true,
                "required": [
                  "model",
                  "prompt"
                ]
              },
              "examples": {
                "default": {
                  "value": {
                    "model": "kie/z-image",
                    "prompt": "A single red square on a blue background, no text."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "description": "HTTP trace ID",
                "schema": {
                  "type": "string"
                }
              },
              "X-LastAI-Usage-Id": {
                "description": "Present on requests that have a model reservation or media receipt",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "created": {
                      "type": "integer"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": true
                      }
                    }
                  },
                  "additionalProperties": true
                },
                "example": {
                  "created": 1795910400,
                  "data": [
                    {
                      "url": "https://example.com/media/result.png"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "检查字段、模型合同、媒体格式或钱包余额。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "检查 Bearer Key、有效期和是否撤销。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "核对套餐、Key 的模型及操作范围，或命名空间归属。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "先查原单。相同插件版本的内容有变时提高版本号。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "检查速率、并发和 UTC 日预算，再按退避策略重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "上游未能完成请求。重试前确认原请求和扣费。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务暂不可用或原请求待确认。保留原幂等键。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/proxy/v1/audio/transcriptions": {
      "post": {
        "operationId": "transcription",
        "tags": [
          "media"
        ],
        "summary": "转写音频",
        "description": "使用 JSON 携带 Base64 音频。选择目录中支持 transcription 的模型。",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "每个新请求使用不同值，最长 128 个 ASCII 字符。",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "目录返回的完整模型 ID，须授权 transcription。"
                  },
                  "input_audio": {
                    "type": "object",
                    "properties": {
                      "data": {
                        "type": "string",
                        "description": "原文件的 Base64 编码，无 data: 前缀。解码后上限见模型目录的 transcription_max_bytes。"
                      },
                      "format": {
                        "type": "string",
                        "description": "源文件格式，例如 wav 或 mp3。"
                      }
                    },
                    "additionalProperties": true,
                    "required": [
                      "data",
                      "format"
                    ]
                  },
                  "language": {
                    "type": "string",
                    "description": "可选语言提示，例如 en。"
                  }
                },
                "additionalProperties": true,
                "required": [
                  "model",
                  "input_audio"
                ]
              },
              "examples": {
                "default": {
                  "value": {
                    "model": "openrouter/openai/whisper-large-v3-turbo",
                    "input_audio": {
                      "data": "$LASTAI_AUDIO_BASE64",
                      "format": "wav"
                    },
                    "language": "en"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "description": "HTTP trace ID",
                "schema": {
                  "type": "string"
                }
              },
              "X-LastAI-Usage-Id": {
                "description": "Present on requests that have a model reservation or media receipt",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "text": {
                      "type": "string"
                    },
                    "model": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                },
                "example": {
                  "text": "The meeting starts at nine.",
                  "model": "openai/whisper-large-v3-turbo"
                }
              }
            }
          },
          "400": {
            "description": "检查字段、模型合同、媒体格式或钱包余额。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "检查 Bearer Key、有效期和是否撤销。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "核对套餐、Key 的模型及操作范围，或命名空间归属。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "先查原单。相同插件版本的内容有变时提高版本号。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "检查速率、并发和 UTC 日预算，再按退避策略重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "上游未能完成请求。重试前确认原请求和扣费。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务暂不可用或原请求待确认。保留原幂等键。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/tools/web-search": {
      "post": {
        "operationId": "web-search",
        "tags": [
          "search"
        ],
        "summary": "搜索网页",
        "description": "获取可引用的网页结果。搜索由 Cloud 当前配置的供应商执行，Key 须选中目录中的 search 模型。",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "每个新请求使用不同值，最长 128 个 ASCII 字符。",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "query": {
                    "type": "string",
                    "description": "搜索词或自然语言问题。"
                  },
                  "max_results": {
                    "type": "integer",
                    "description": "1–20，默认 5。"
                  },
                  "include_domains": {
                    "type": "array",
                    "items": {},
                    "description": "仅包含或排除指定域名。"
                  },
                  "provider": {
                    "type": "string",
                    "description": "省略时使用 Cloud 默认搜索服务。指定时须为账号可用的服务商。"
                  },
                  "intent": {
                    "type": "string",
                    "description": "默认 general。供应商支持的值见 supported_intents。"
                  },
                  "time_range": {
                    "type": "string",
                    "description": "时间范围或日期过滤，日期用 YYYY-MM-DD。支持情况依供应商。"
                  },
                  "start_date": {
                    "type": "string",
                    "description": "时间范围或日期过滤，日期用 YYYY-MM-DD。支持情况依供应商。"
                  },
                  "end_date": {
                    "type": "string",
                    "description": "时间范围或日期过滤，日期用 YYYY-MM-DD。支持情况依供应商。"
                  },
                  "language": {
                    "type": "string",
                    "description": "语言及地区提示。"
                  },
                  "country": {
                    "type": "string",
                    "description": "语言及地区提示。"
                  },
                  "exclude_domains": {
                    "type": "array",
                    "items": {},
                    "description": "仅包含或排除指定域名。"
                  },
                  "require_published_date": {
                    "type": "boolean",
                    "description": "要求可用的发布日期证据。"
                  }
                },
                "additionalProperties": true,
                "required": [
                  "query"
                ]
              },
              "examples": {
                "default": {
                  "value": {
                    "query": "PostgreSQL documentation",
                    "max_results": 3,
                    "include_domains": [
                      "postgresql.org"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "description": "HTTP trace ID",
                "schema": {
                  "type": "string"
                }
              },
              "X-LastAI-Usage-Id": {
                "description": "Present on requests that have a model reservation or media receipt",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "query": {
                      "type": "string"
                    },
                    "provider": {
                      "type": "string"
                    },
                    "backend": {
                      "type": "string"
                    },
                    "count": {
                      "type": "integer"
                    },
                    "charged_cents": {
                      "type": "integer"
                    },
                    "result_status": {
                      "type": "string"
                    },
                    "freshness_status": {
                      "type": "string"
                    },
                    "supported_intents": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "filter_notes": {
                      "type": "array",
                      "items": {}
                    },
                    "retrieved_at": {
                      "type": "string"
                    },
                    "intent": {
                      "type": "string"
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "title": {
                            "type": "string"
                          },
                          "url": {
                            "type": "string"
                          },
                          "snippet": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": true
                      }
                    }
                  },
                  "additionalProperties": true
                },
                "example": {
                  "request_id": "model_1c15239ca365ff2dd85d639eb025d2723939383bf26472ce2577c137f2de5183",
                  "query": "PostgreSQL documentation",
                  "provider": "bocha",
                  "backend": "real",
                  "count": 1,
                  "charged_cents": 1,
                  "result_status": "ok",
                  "freshness_status": "not_required",
                  "supported_intents": [
                    "general"
                  ],
                  "filter_notes": [],
                  "retrieved_at": "2026-11-29T00:00:00Z",
                  "intent": "general",
                  "results": [
                    {
                      "title": "PostgreSQL Documentation",
                      "url": "https://www.postgresql.org/docs/",
                      "snippet": "Manuals and reference material."
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "检查字段、模型合同、媒体格式或钱包余额。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "检查 Bearer Key、有效期和是否撤销。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "核对套餐、Key 的模型及操作范围，或命名空间归属。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "先查原单。相同插件版本的内容有变时提高版本号。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "检查速率、并发和 UTC 日预算，再按退避策略重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "上游未能完成请求。重试前确认原请求和扣费。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务暂不可用或原请求待确认。保留原幂等键。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/model-access/requests/{id}": {
      "get": {
        "operationId": "get-receipt",
        "tags": [
          "billing"
        ],
        "summary": "按请求 ID 查回执",
        "description": "用发出原请求的 Key 查询。同步调用见响应头 x-lastai-usage-id，媒体使用作业 ID。SSE 完结后可能仍在结算。",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "账单请求 ID 或媒体作业 ID。",
            "schema": {
              "type": "string"
            },
            "example": "model_1c15239ca365ff2dd85d639eb025d2723939383bf26472ce2577c137f2de5183"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "description": "HTTP trace ID",
                "schema": {
                  "type": "string"
                }
              },
              "X-LastAI-Usage-Id": {
                "description": "Present on requests that have a model reservation or media receipt",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "model_id": {
                      "type": "string"
                    },
                    "operation": {
                      "type": "string"
                    },
                    "state": {
                      "type": "string"
                    },
                    "held_cents": {
                      "type": "integer"
                    },
                    "charged_cents": {
                      "type": "integer"
                    },
                    "opened_at": {
                      "type": "string"
                    },
                    "finished_at": {
                      "type": "string"
                    },
                    "input_tokens": {
                      "type": "integer"
                    },
                    "output_tokens": {
                      "type": "integer"
                    },
                    "supplier_request_id": {},
                    "wallet_entries": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "user_id": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string"
                          },
                          "amount_cents": {
                            "type": "integer"
                          },
                          "balance_after_cents": {
                            "type": "integer"
                          },
                          "reference": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "created_at": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": true
                      }
                    }
                  },
                  "additionalProperties": true
                },
                "example": {
                  "id": "model_1c15239ca365ff2dd85d639eb025d2723939383bf26472ce2577c137f2de5183",
                  "model_id": "deepseek/deepseek-v4-flash",
                  "operation": "chat",
                  "state": "settled",
                  "held_cents": 1,
                  "charged_cents": 0,
                  "opened_at": "2026-11-29T00:00:00Z",
                  "finished_at": "2026-11-29T00:00:00Z",
                  "input_tokens": 13,
                  "output_tokens": 1,
                  "supplier_request_id": null,
                  "wallet_entries": [
                    {
                      "id": "txn_demo",
                      "user_id": "usr_demo",
                      "kind": "USAGE_REFUND",
                      "amount_cents": 1,
                      "balance_after_cents": 50,
                      "reference": "model_1c15239ca365ff2dd85d639eb025d2723939383bf26472ce2577c137f2de5183",
                      "description": "scoped model settlement",
                      "created_at": "2026-11-29T00:00:00Z"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "检查 Bearer Key、有效期和是否撤销。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "核对套餐、Key 的模型及操作范围，或命名空间归属。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "核对 ID 与签发该请求的 Key，确认记录是否已生成。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "检查速率、并发和 UTC 日预算，再按退避策略重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务暂不可用或原请求待确认。保留原幂等键。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/model-access/requests/original": {
      "get": {
        "operationId": "find-original",
        "tags": [
          "billing"
        ],
        "summary": "按幂等键查原请求",
        "description": "连接中断或没有收到响应头时使用。原请求必须携带 Idempotency-Key。异步媒体用原作业 ID 查询。",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "operation",
            "in": "query",
            "required": true,
            "description": "原同步操作，例如 chat、responses、embedding、transcription 或 search。",
            "schema": {
              "type": "string"
            },
            "example": "chat"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "必须与原请求完全相同。",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "description": "HTTP trace ID",
                "schema": {
                  "type": "string"
                }
              },
              "X-LastAI-Usage-Id": {
                "description": "Present on requests that have a model reservation or media receipt",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "model_id": {
                      "type": "string"
                    },
                    "operation": {
                      "type": "string"
                    },
                    "state": {
                      "type": "string"
                    },
                    "held_cents": {
                      "type": "integer"
                    },
                    "charged_cents": {
                      "type": "integer"
                    },
                    "opened_at": {
                      "type": "string"
                    },
                    "finished_at": {
                      "type": "string"
                    },
                    "input_tokens": {
                      "type": "integer"
                    },
                    "output_tokens": {
                      "type": "integer"
                    },
                    "supplier_request_id": {},
                    "wallet_entries": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "user_id": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string"
                          },
                          "amount_cents": {
                            "type": "integer"
                          },
                          "balance_after_cents": {
                            "type": "integer"
                          },
                          "reference": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "created_at": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": true
                      }
                    }
                  },
                  "additionalProperties": true
                },
                "example": {
                  "id": "model_1c15239ca365ff2dd85d639eb025d2723939383bf26472ce2577c137f2de5183",
                  "model_id": "deepseek/deepseek-v4-flash",
                  "operation": "chat",
                  "state": "settled",
                  "held_cents": 1,
                  "charged_cents": 0,
                  "opened_at": "2026-11-29T00:00:00Z",
                  "finished_at": "2026-11-29T00:00:00Z",
                  "input_tokens": 13,
                  "output_tokens": 1,
                  "supplier_request_id": null,
                  "wallet_entries": [
                    {
                      "id": "txn_demo",
                      "user_id": "usr_demo",
                      "kind": "USAGE_REFUND",
                      "amount_cents": 1,
                      "balance_after_cents": 50,
                      "reference": "model_1c15239ca365ff2dd85d639eb025d2723939383bf26472ce2577c137f2de5183",
                      "description": "scoped model settlement",
                      "created_at": "2026-11-29T00:00:00Z"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "检查字段、模型合同、媒体格式或钱包余额。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "检查 Bearer Key、有效期和是否撤销。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "核对套餐、Key 的模型及操作范围，或命名空间归属。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "核对 ID 与签发该请求的 Key，确认记录是否已生成。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "检查速率、并发和 UTC 日预算，再按退避策略重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务暂不可用或原请求待确认。保留原幂等键。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/harness/publishing/publish": {
      "post": {
        "operationId": "publish-plugin",
        "tags": [
          "plugins"
        ],
        "summary": "上传插件并送审",
        "description": "在开发者中心给 API Key 开启发布权限。上传成功进入 review，审核和签名后上架。相同版本、清单和字节可安全重试。 要求 API Key 具备 plugin:publish 权限。",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "X-LastAI-Plugin-Namespace",
            "in": "header",
            "required": false,
            "description": "所属的自定义命名空间。省略时用账号默认命名空间。",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "manifest": {
                    "type": "string",
                    "format": "binary",
                    "description": "multipart 清单文件，最多 16 KiB，包名和摘要须与 tgz 一致。"
                  },
                  "tarball": {
                    "type": "string",
                    "format": "binary",
                    "description": "npm pack 生成的 .tgz，最多 8 MiB。"
                  }
                },
                "required": [
                  "manifest",
                  "tarball"
                ]
              },
              "encoding": {
                "manifest": {
                  "contentType": "application/json"
                },
                "tarball": {
                  "contentType": "application/octet-stream"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "description": "HTTP trace ID",
                "schema": {
                  "type": "string"
                }
              },
              "X-LastAI-Usage-Id": {
                "description": "Present on requests that have a model reservation or media receipt",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "namespace": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "version": {
                      "type": "string"
                    },
                    "manifest": {
                      "type": "string"
                    },
                    "sha256": {
                      "type": "string"
                    },
                    "integrity": {
                      "type": "string"
                    },
                    "patch": {
                      "type": "string"
                    },
                    "size_bytes": {
                      "type": "integer"
                    },
                    "state": {
                      "type": "string"
                    },
                    "review_receipt": {},
                    "reviewer": {},
                    "signature": {},
                    "signing_key": {},
                    "created_at": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                },
                "example": {
                  "id": "018ca058-87cd-73d1-8f0a-ded18bcd929c",
                  "namespace": "@lastai-user-0123456789abcdef01234567",
                  "name": "@lastai-user-0123456789abcdef01234567/my-plugin",
                  "version": "1.0.0",
                  "manifest": "{\"schema\":\"lastai.harness.plugin.release/v1\"}",
                  "sha256": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
                  "integrity": "sha512-YWJj",
                  "patch": "cordis.patch.yml",
                  "size_bytes": 1842,
                  "state": "review",
                  "review_receipt": null,
                  "reviewer": null,
                  "signature": null,
                  "signing_key": null,
                  "created_at": "2026-11-29T00:00:00Z",
                  "updated_at": "2026-11-29T00:00:00Z"
                }
              }
            }
          },
          "201": {
            "description": "Created",
            "headers": {
              "X-Request-Id": {
                "description": "HTTP trace ID",
                "schema": {
                  "type": "string"
                }
              },
              "X-LastAI-Usage-Id": {
                "description": "Present on requests that have a model reservation or media receipt",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "namespace": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "version": {
                      "type": "string"
                    },
                    "manifest": {
                      "type": "string"
                    },
                    "sha256": {
                      "type": "string"
                    },
                    "integrity": {
                      "type": "string"
                    },
                    "patch": {
                      "type": "string"
                    },
                    "size_bytes": {
                      "type": "integer"
                    },
                    "state": {
                      "type": "string"
                    },
                    "review_receipt": {},
                    "reviewer": {},
                    "signature": {},
                    "signing_key": {},
                    "created_at": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                },
                "example": {
                  "id": "018ca058-87cd-73d1-8f0a-ded18bcd929c",
                  "namespace": "@lastai-user-0123456789abcdef01234567",
                  "name": "@lastai-user-0123456789abcdef01234567/my-plugin",
                  "version": "1.0.0",
                  "manifest": "{\"schema\":\"lastai.harness.plugin.release/v1\"}",
                  "sha256": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
                  "integrity": "sha512-YWJj",
                  "patch": "cordis.patch.yml",
                  "size_bytes": 1842,
                  "state": "review",
                  "review_receipt": null,
                  "reviewer": null,
                  "signature": null,
                  "signing_key": null,
                  "created_at": "2026-11-29T00:00:00Z",
                  "updated_at": "2026-11-29T00:00:00Z"
                }
              }
            }
          },
          "400": {
            "description": "检查字段、模型合同、媒体格式或钱包余额。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "检查 Bearer Key、有效期和是否撤销。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "核对套餐、Key 的模型及操作范围，或命名空间归属。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "先查原单。相同插件版本的内容有变时提高版本号。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "按该接口的大小上限重新打包。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "检查速率、并发和 UTC 日预算，再按退避策略重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务暂不可用或原请求待确认。保留原幂等键。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/harness/publishing/submissions": {
      "get": {
        "operationId": "list-plugin-submissions",
        "tags": [
          "plugins"
        ],
        "summary": "列出插件提交记录",
        "description": "读取当前命名空间最近提交的最多 200 条记录。 要求 API Key 具备 plugin:publish 权限。",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "X-LastAI-Plugin-Namespace",
            "in": "header",
            "required": false,
            "description": "所属的自定义命名空间。省略时用账号默认命名空间。",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "description": "HTTP trace ID",
                "schema": {
                  "type": "string"
                }
              },
              "X-LastAI-Usage-Id": {
                "description": "Present on requests that have a model reservation or media receipt",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "namespace": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "version": {
                        "type": "string"
                      },
                      "manifest": {
                        "type": "string"
                      },
                      "sha256": {
                        "type": "string"
                      },
                      "integrity": {
                        "type": "string"
                      },
                      "patch": {
                        "type": "string"
                      },
                      "size_bytes": {
                        "type": "integer"
                      },
                      "state": {
                        "type": "string"
                      },
                      "review_receipt": {},
                      "reviewer": {},
                      "signature": {},
                      "signing_key": {},
                      "created_at": {
                        "type": "string"
                      },
                      "updated_at": {
                        "type": "string"
                      }
                    },
                    "additionalProperties": true
                  }
                },
                "example": [
                  {
                    "id": "018ca058-87cd-73d1-8f0a-ded18bcd929c",
                    "namespace": "@lastai-user-0123456789abcdef01234567",
                    "name": "@lastai-user-0123456789abcdef01234567/my-plugin",
                    "version": "1.0.0",
                    "manifest": "{\"schema\":\"lastai.harness.plugin.release/v1\"}",
                    "sha256": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
                    "integrity": "sha512-YWJj",
                    "patch": "cordis.patch.yml",
                    "size_bytes": 1842,
                    "state": "review",
                    "review_receipt": null,
                    "reviewer": null,
                    "signature": null,
                    "signing_key": null,
                    "created_at": "2026-11-29T00:00:00Z",
                    "updated_at": "2026-11-29T00:00:00Z"
                  }
                ]
              }
            }
          },
          "400": {
            "description": "检查字段、模型合同、媒体格式或钱包余额。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "检查 Bearer Key、有效期和是否撤销。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "核对套餐、Key 的模型及操作范围，或命名空间归属。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "检查速率、并发和 UTC 日预算，再按退避策略重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务暂不可用或原请求待确认。保留原幂等键。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "create-plugin-draft",
        "tags": [
          "plugins"
        ],
        "summary": "仅保存插件草稿",
        "description": "需要将上传与送审拆开时使用。创建后状态为 draft，接着调用草稿送审。 要求 API Key 具备 plugin:publish 权限。",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "X-LastAI-Plugin-Namespace",
            "in": "header",
            "required": false,
            "description": "所属的自定义命名空间。省略时用账号默认命名空间。",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "manifest": {
                    "type": "string",
                    "format": "binary",
                    "description": "multipart 清单文件，最多 16 KiB，包名和摘要须与 tgz 一致。"
                  },
                  "tarball": {
                    "type": "string",
                    "format": "binary",
                    "description": "npm pack 生成的 .tgz，最多 8 MiB。"
                  }
                },
                "required": [
                  "manifest",
                  "tarball"
                ]
              },
              "encoding": {
                "manifest": {
                  "contentType": "application/json"
                },
                "tarball": {
                  "contentType": "application/octet-stream"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "description": "HTTP trace ID",
                "schema": {
                  "type": "string"
                }
              },
              "X-LastAI-Usage-Id": {
                "description": "Present on requests that have a model reservation or media receipt",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "namespace": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "version": {
                      "type": "string"
                    },
                    "manifest": {
                      "type": "string"
                    },
                    "sha256": {
                      "type": "string"
                    },
                    "integrity": {
                      "type": "string"
                    },
                    "patch": {
                      "type": "string"
                    },
                    "size_bytes": {
                      "type": "integer"
                    },
                    "state": {
                      "type": "string"
                    },
                    "review_receipt": {},
                    "reviewer": {},
                    "signature": {},
                    "signing_key": {},
                    "created_at": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                },
                "example": {
                  "id": "018ca058-87cd-73d1-8f0a-ded18bcd929c",
                  "namespace": "@lastai-user-0123456789abcdef01234567",
                  "name": "@lastai-user-0123456789abcdef01234567/my-plugin",
                  "version": "1.0.0",
                  "manifest": "{\"schema\":\"lastai.harness.plugin.release/v1\"}",
                  "sha256": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
                  "integrity": "sha512-YWJj",
                  "patch": "cordis.patch.yml",
                  "size_bytes": 1842,
                  "state": "draft",
                  "review_receipt": null,
                  "reviewer": null,
                  "signature": null,
                  "signing_key": null,
                  "created_at": "2026-11-29T00:00:00Z",
                  "updated_at": "2026-11-29T00:00:00Z"
                }
              }
            }
          },
          "201": {
            "description": "Created",
            "headers": {
              "X-Request-Id": {
                "description": "HTTP trace ID",
                "schema": {
                  "type": "string"
                }
              },
              "X-LastAI-Usage-Id": {
                "description": "Present on requests that have a model reservation or media receipt",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "namespace": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "version": {
                      "type": "string"
                    },
                    "manifest": {
                      "type": "string"
                    },
                    "sha256": {
                      "type": "string"
                    },
                    "integrity": {
                      "type": "string"
                    },
                    "patch": {
                      "type": "string"
                    },
                    "size_bytes": {
                      "type": "integer"
                    },
                    "state": {
                      "type": "string"
                    },
                    "review_receipt": {},
                    "reviewer": {},
                    "signature": {},
                    "signing_key": {},
                    "created_at": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                },
                "example": {
                  "id": "018ca058-87cd-73d1-8f0a-ded18bcd929c",
                  "namespace": "@lastai-user-0123456789abcdef01234567",
                  "name": "@lastai-user-0123456789abcdef01234567/my-plugin",
                  "version": "1.0.0",
                  "manifest": "{\"schema\":\"lastai.harness.plugin.release/v1\"}",
                  "sha256": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
                  "integrity": "sha512-YWJj",
                  "patch": "cordis.patch.yml",
                  "size_bytes": 1842,
                  "state": "draft",
                  "review_receipt": null,
                  "reviewer": null,
                  "signature": null,
                  "signing_key": null,
                  "created_at": "2026-11-29T00:00:00Z",
                  "updated_at": "2026-11-29T00:00:00Z"
                }
              }
            }
          },
          "400": {
            "description": "检查字段、模型合同、媒体格式或钱包余额。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "检查 Bearer Key、有效期和是否撤销。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "核对套餐、Key 的模型及操作范围，或命名空间归属。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "先查原单。相同插件版本的内容有变时提高版本号。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "按该接口的大小上限重新打包。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "检查速率、并发和 UTC 日预算，再按退避策略重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务暂不可用或原请求待确认。保留原幂等键。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/harness/publishing/submissions/{id}": {
      "get": {
        "operationId": "get-plugin-submission",
        "tags": [
          "plugins"
        ],
        "summary": "查询插件审核状态",
        "description": "查看指定版本的审核进度和可用审核回执。 要求 API Key 具备 plugin:publish 权限。",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "上传响应中的提交 ID。",
            "schema": {
              "type": "string"
            },
            "example": "018ca058-87cd-73d1-8f0a-ded18bcd929c"
          },
          {
            "name": "X-LastAI-Plugin-Namespace",
            "in": "header",
            "required": false,
            "description": "所属的自定义命名空间。省略时用账号默认命名空间。",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "description": "HTTP trace ID",
                "schema": {
                  "type": "string"
                }
              },
              "X-LastAI-Usage-Id": {
                "description": "Present on requests that have a model reservation or media receipt",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "namespace": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "version": {
                      "type": "string"
                    },
                    "manifest": {
                      "type": "string"
                    },
                    "sha256": {
                      "type": "string"
                    },
                    "integrity": {
                      "type": "string"
                    },
                    "patch": {
                      "type": "string"
                    },
                    "size_bytes": {
                      "type": "integer"
                    },
                    "state": {
                      "type": "string"
                    },
                    "review_receipt": {},
                    "reviewer": {},
                    "signature": {},
                    "signing_key": {},
                    "created_at": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                },
                "example": {
                  "id": "018ca058-87cd-73d1-8f0a-ded18bcd929c",
                  "namespace": "@lastai-user-0123456789abcdef01234567",
                  "name": "@lastai-user-0123456789abcdef01234567/my-plugin",
                  "version": "1.0.0",
                  "manifest": "{\"schema\":\"lastai.harness.plugin.release/v1\"}",
                  "sha256": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
                  "integrity": "sha512-YWJj",
                  "patch": "cordis.patch.yml",
                  "size_bytes": 1842,
                  "state": "review",
                  "review_receipt": null,
                  "reviewer": null,
                  "signature": null,
                  "signing_key": null,
                  "created_at": "2026-11-29T00:00:00Z",
                  "updated_at": "2026-11-29T00:00:00Z"
                }
              }
            }
          },
          "400": {
            "description": "检查字段、模型合同、媒体格式或钱包余额。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "检查 Bearer Key、有效期和是否撤销。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "核对套餐、Key 的模型及操作范围，或命名空间归属。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "核对 ID 与签发该请求的 Key，确认记录是否已生成。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "检查速率、并发和 UTC 日预算，再按退避策略重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务暂不可用或原请求待确认。保留原幂等键。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/harness/publishing/submissions/failures": {
      "get": {
        "operationId": "list-plugin-failures",
        "tags": [
          "plugins"
        ],
        "summary": "查询上传失败记录",
        "description": "查阅当前命名空间内最近被拒的上传及原因。 要求 API Key 具备 plugin:publish 权限。",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "X-LastAI-Plugin-Namespace",
            "in": "header",
            "required": false,
            "description": "所属的自定义命名空间。省略时用账号默认命名空间。",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "description": "HTTP trace ID",
                "schema": {
                  "type": "string"
                }
              },
              "X-LastAI-Usage-Id": {
                "description": "Present on requests that have a model reservation or media receipt",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "action": {
                        "type": "string"
                      },
                      "actor": {
                        "type": "string"
                      },
                      "at": {
                        "type": "string"
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "namespace": {
                            "type": "string"
                          },
                          "reason": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": true
                      }
                    },
                    "additionalProperties": true
                  }
                },
                "example": [
                  {
                    "id": "018ca31d-6731-7238-84bc-a25c8715be78",
                    "action": "harness.publishing.upload_rejected",
                    "actor": "usr_demo",
                    "at": "2026-11-29T00:00:00Z",
                    "data": {
                      "namespace": "@lastai-user-0123456789abcdef01234567",
                      "reason": "bad request: plugin tarball does not match the manifest SHA-256"
                    }
                  }
                ]
              }
            }
          },
          "400": {
            "description": "检查字段、模型合同、媒体格式或钱包余额。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "检查 Bearer Key、有效期和是否撤销。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "核对套餐、Key 的模型及操作范围，或命名空间归属。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "检查速率、并发和 UTC 日预算，再按退避策略重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务暂不可用或原请求待确认。保留原幂等键。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/harness/publishing/submissions/{id}/submit": {
      "post": {
        "operationId": "submit-plugin-draft",
        "tags": [
          "plugins"
        ],
        "summary": "将草稿送审",
        "description": "把此命名空间的 draft 转成 review。可重复查询或提交已在审核中的版本。 要求 API Key 具备 plugin:publish 权限。",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "上传响应中的提交 ID。",
            "schema": {
              "type": "string"
            },
            "example": "018ca058-87cd-73d1-8f0a-ded18bcd929c"
          },
          {
            "name": "X-LastAI-Plugin-Namespace",
            "in": "header",
            "required": false,
            "description": "所属的自定义命名空间。省略时用账号默认命名空间。",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "description": "HTTP trace ID",
                "schema": {
                  "type": "string"
                }
              },
              "X-LastAI-Usage-Id": {
                "description": "Present on requests that have a model reservation or media receipt",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "namespace": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "version": {
                      "type": "string"
                    },
                    "manifest": {
                      "type": "string"
                    },
                    "sha256": {
                      "type": "string"
                    },
                    "integrity": {
                      "type": "string"
                    },
                    "patch": {
                      "type": "string"
                    },
                    "size_bytes": {
                      "type": "integer"
                    },
                    "state": {
                      "type": "string"
                    },
                    "review_receipt": {},
                    "reviewer": {},
                    "signature": {},
                    "signing_key": {},
                    "created_at": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                },
                "example": {
                  "id": "018ca058-87cd-73d1-8f0a-ded18bcd929c",
                  "namespace": "@lastai-user-0123456789abcdef01234567",
                  "name": "@lastai-user-0123456789abcdef01234567/my-plugin",
                  "version": "1.0.0",
                  "manifest": "{\"schema\":\"lastai.harness.plugin.release/v1\"}",
                  "sha256": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
                  "integrity": "sha512-YWJj",
                  "patch": "cordis.patch.yml",
                  "size_bytes": 1842,
                  "state": "review",
                  "review_receipt": null,
                  "reviewer": null,
                  "signature": null,
                  "signing_key": null,
                  "created_at": "2026-11-29T00:00:00Z",
                  "updated_at": "2026-11-29T00:00:00Z"
                }
              }
            }
          },
          "400": {
            "description": "检查字段、模型合同、媒体格式或钱包余额。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "检查 Bearer Key、有效期和是否撤销。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "核对套餐、Key 的模型及操作范围，或命名空间归属。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "核对 ID 与签发该请求的 Key，确认记录是否已生成。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "先查原单。相同插件版本的内容有变时提高版本号。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "检查速率、并发和 UTC 日预算，再按退避策略重试。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务暂不可用或原请求待确认。保留原幂等键。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "details": {
            "type": "object"
          }
        }
      }
    }
  }
}
