{
  "openapi": "3.1.0",
  "info": {
    "title": "HEYIN 开放API",
    "version": "2026-11-07",
    "description": "按公开路由与请求模型生成的接入子集；动态能力/价格见目录，成功响应业务字段见网页说明。"
  },
  "servers": [
    {
      "url": "https://www.heyintts.cn/api/open"
    }
  ],
  "paths": {
    "/account": {
      "get": {
        "summary": "返回当前 Key 的只读账户、额度和计费信息。",
        "operationId": "open_account_account",
        "security": [
          {
            "ApiKey": []
          },
          {
            "BearerKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "成功响应；异步提交返回任务，下载返回音频，其余返回JSON",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "description": "错误响应（detail可能为字符串、对象或字段校验数组）",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "detail": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object"
                        },
                        {
                          "type": "array",
                          "items": {}
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/clone/register": {
      "post": {
        "summary": "注册克隆音色；按当前Key的有效音色配额原子占位。",
        "operationId": "open_clone_register",
        "security": [
          {
            "ApiKey": []
          },
          {
            "BearerKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "成功响应；异步提交返回任务，下载返回音频，其余返回JSON",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "description": "错误响应（detail可能为字符串、对象或字段校验数组）",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "detail": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object"
                        },
                        {
                          "type": "array",
                          "items": {}
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  },
                  "voice_name": {
                    "type": "string",
                    "description": "音色名称"
                  },
                  "model_key": {
                    "type": "string",
                    "default": "standard",
                    "description": "模型标识"
                  },
                  "prompt_text": {
                    "type": "string",
                    "default": "",
                    "description": "参考文本（可选）"
                  },
                  "prompt_lang": {
                    "type": "string",
                    "default": "zh",
                    "description": "参考文本语种"
                  },
                  "denoise": {
                    "type": "string",
                    "default": "false",
                    "description": "是否降噪（true/false）"
                  },
                  "request_id": {
                    "type": "string",
                    "default": "",
                    "maxLength": 64,
                    "description": "幂等键"
                  }
                },
                "required": [
                  "file",
                  "voice_name"
                ]
              }
            }
          }
        }
      }
    },
    "/clone/synthesize": {
      "post": {
        "summary": "使用当前 API Key 名下的克隆音色合成语音。",
        "operationId": "open_clone_synth_synthesize",
        "security": [
          {
            "ApiKey": []
          },
          {
            "BearerKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "成功响应；异步提交返回任务，下载返回音频，其余返回JSON",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "description": "错误响应（detail可能为字符串、对象或字段校验数组）",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "detail": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object"
                        },
                        {
                          "type": "array",
                          "items": {}
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OpenCloneSynthesizeRequest"
              }
            }
          }
        }
      }
    },
    "/clone/catalog": {
      "get": {
        "summary": "无需Key的只读脱敏目录；不调用鉴权、更新最后调用时间或消耗积分。",
        "operationId": "open_clone_manage_public_catalog",
        "security": [],
        "responses": {
          "200": {
            "description": "成功响应；异步提交返回任务，下载返回音频，其余返回JSON",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "description": "错误响应（detail可能为字符串、对象或字段校验数组）",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "detail": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object"
                        },
                        {
                          "type": "array",
                          "items": {}
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/clone/catalog/voices": {
      "get": {
        "summary": "公开目录复用正式Key目录的可用性/公开模型/价格筛选，不泄露私有音色。",
        "operationId": "open_clone_manage_catalog_voices",
        "security": [],
        "responses": {
          "200": {
            "description": "成功响应；异步提交返回任务，下载返回音频，其余返回JSON",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "description": "错误响应（detail可能为字符串、对象或字段校验数组）",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "detail": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object"
                        },
                        {
                          "type": "array",
                          "items": {}
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 1,
              "minimum": 1
            }
          },
          {
            "name": "keyword",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "",
              "maxLength": 200
            }
          },
          {
            "name": "model",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "",
              "maxLength": 30
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 50,
              "minimum": 1,
              "maximum": 50
            }
          }
        ]
      }
    },
    "/clone/voices": {
      "get": {
        "summary": "返回当前 API Key 名下注册的全部克隆音色。",
        "operationId": "open_clone_manage_voices",
        "security": [
          {
            "ApiKey": []
          },
          {
            "BearerKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "成功响应；异步提交返回任务，下载返回音频，其余返回JSON",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "description": "错误响应（detail可能为字符串、对象或字段校验数组）",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "detail": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object"
                        },
                        {
                          "type": "array",
                          "items": {}
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/clone/voices/{voice_id}": {
      "delete": {
        "summary": "删除当前 API Key 名下的克隆音色（同时删除云侧声音）。",
        "operationId": "open_clone_manage_delete",
        "security": [
          {
            "ApiKey": []
          },
          {
            "BearerKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "成功响应；异步提交返回任务，下载返回音频，其余返回JSON",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "description": "错误响应（detail可能为字符串、对象或字段校验数组）",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "detail": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object"
                        },
                        {
                          "type": "array",
                          "items": {}
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "voice_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/clone/models": {
      "get": {
        "summary": "返回可用克隆模型列表 + 情感指令预设（供客户端展示）。",
        "operationId": "open_clone_manage_models",
        "security": [
          {
            "ApiKey": []
          },
          {
            "BearerKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "成功响应；异步提交返回任务，下载返回音频，其余返回JSON",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "description": "错误响应（detail可能为字符串、对象或字段校验数组）",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "detail": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object"
                        },
                        {
                          "type": "array",
                          "items": {}
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/clone/balance": {
      "get": {
        "summary": "返回当前 API Key 的预付费余额（三块拆分）、单价与充值包目录。",
        "operationId": "open_clone_manage_balance",
        "security": [
          {
            "ApiKey": []
          },
          {
            "BearerKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "成功响应；异步提交返回任务，下载返回音频，其余返回JSON",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "description": "错误响应（detail可能为字符串、对象或字段校验数组）",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "detail": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object"
                        },
                        {
                          "type": "array",
                          "items": {}
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/library/voices": {
      "get": {
        "summary": "分页浏览网页端当前可见、已审核通过的声音库音色。",
        "operationId": "open_library_manage_voices",
        "security": [
          {
            "ApiKey": []
          },
          {
            "BearerKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "成功响应；异步提交返回任务，下载返回音频，其余返回JSON",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "description": "错误响应（detail可能为字符串、对象或字段校验数组）",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "detail": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object"
                        },
                        {
                          "type": "array",
                          "items": {}
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 1,
              "minimum": 1
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 20,
              "minimum": 1,
              "maximum": 50
            }
          },
          {
            "name": "keyword",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "",
              "maxLength": 200
            }
          },
          {
            "name": "category",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "",
              "maxLength": 50
            }
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "",
              "maxLength": 20
            }
          },
          {
            "name": "gender",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "",
              "maxLength": 10
            }
          },
          {
            "name": "age_group",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "",
              "maxLength": 10
            }
          },
          {
            "name": "scene",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "",
              "maxLength": 30
            }
          },
          {
            "name": "scene_key",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "",
              "maxLength": 50
            }
          },
          {
            "name": "model",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "",
              "maxLength": 30
            }
          },
          {
            "name": "grade",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "",
              "maxLength": 20
            }
          }
        ]
      }
    },
    "/library/synthesize": {
      "post": {
        "summary": "使用已审核、当前可见的公共音色合成，并按真实付费成本结算创作者收益。",
        "operationId": "open_library_synth_synthesize",
        "security": [
          {
            "ApiKey": []
          },
          {
            "BearerKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "成功响应；异步提交返回任务，下载返回音频，其余返回JSON",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "description": "错误响应（detail可能为字符串、对象或字段校验数组）",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "detail": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object"
                        },
                        {
                          "type": "array",
                          "items": {}
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OpenLibrarySynthesizeRequest"
              }
            }
          }
        }
      }
    },
    "/clone/jobs": {
      "post": {
        "summary": "提交Key私有音色任务；提交阶段不扣费。",
        "operationId": "open_jobs_clone_job",
        "security": [
          {
            "ApiKey": []
          },
          {
            "BearerKey": []
          }
        ],
        "responses": {
          "202": {
            "description": "成功响应；异步提交返回任务，下载返回音频，其余返回JSON",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "description": "错误响应（detail可能为字符串、对象或字段校验数组）",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "detail": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object"
                        },
                        {
                          "type": "array",
                          "items": {}
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OpenCloneSynthesizeRequest"
              }
            }
          }
        }
      }
    },
    "/library/jobs": {
      "post": {
        "summary": "公共音色审核、上下架与余额在执行时重新检查。",
        "operationId": "open_jobs_library_job",
        "security": [
          {
            "ApiKey": []
          },
          {
            "BearerKey": []
          }
        ],
        "responses": {
          "202": {
            "description": "成功响应；异步提交返回任务，下载返回音频，其余返回JSON",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "description": "错误响应（detail可能为字符串、对象或字段校验数组）",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "detail": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object"
                        },
                        {
                          "type": "array",
                          "items": {}
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OpenLibrarySynthesizeRequest"
              }
            }
          }
        }
      }
    },
    "/jobs/{job_id}": {
      "get": {
        "summary": "仅返回当前Key任务，成功结果使用历史鉴权URL。",
        "operationId": "open_jobs_get_job",
        "security": [
          {
            "ApiKey": []
          },
          {
            "BearerKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "成功响应；异步提交返回任务，下载返回音频，其余返回JSON",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "description": "错误响应（detail可能为字符串、对象或字段校验数组）",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "detail": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object"
                        },
                        {
                          "type": "array",
                          "items": {}
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/jobs/{job_id}/audio": {
      "get": {
        "summary": "同站点跳转，下载目标再次校验Key；不在URL里传密钥。",
        "operationId": "open_jobs_job_audio",
        "security": [
          {
            "ApiKey": []
          },
          {
            "BearerKey": []
          }
        ],
        "responses": {
          "307": {
            "description": "同源历史音频跳转，目标仍需鉴权"
          },
          "409": {
            "description": "任务尚未成功"
          },
          "404": {
            "description": "任务不存在或已过期"
          }
        },
        "parameters": [
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/history": {
      "get": {
        "summary": "列出当前 API Key 最近 7 天的合成历史。",
        "operationId": "open_history_list_history",
        "security": [
          {
            "ApiKey": []
          },
          {
            "BearerKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "成功响应；异步提交返回任务，下载返回音频，其余返回JSON",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "description": "错误响应（detail可能为字符串、对象或字段校验数组）",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "detail": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object"
                        },
                        {
                          "type": "array",
                          "items": {}
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 1,
              "minimum": 1
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 20,
              "minimum": 1,
              "maximum": 50
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "",
              "pattern": "^(|processing|succeeded|failed)$"
            }
          }
        ]
      }
    },
    "/history/{history_id}/audio": {
      "get": {
        "summary": "按当前 Key 鉴权下载历史音频，支持二进制或 Base64。",
        "operationId": "open_history_history_audio",
        "security": [
          {
            "ApiKey": []
          },
          {
            "BearerKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "成功响应；异步提交返回任务，下载返回音频，其余返回JSON",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "default": {
            "description": "错误响应（detail可能为字符串、对象或字段校验数组）",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "detail": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object"
                        },
                        {
                          "type": "array",
                          "items": {}
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "history_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "response_format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "binary",
              "pattern": "^(binary|base64)$"
            }
          }
        ]
      }
    },
    "/timeline/capabilities": {
      "get": {
        "summary": "按当前Key查询时间线资格；节点即时状态由受理时重新检查。",
        "operationId": "open_timeline_timeline_capabilities",
        "security": [
          {
            "ApiKey": []
          },
          {
            "BearerKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "成功响应；异步提交返回任务，下载返回音频，其余返回JSON",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "description": "错误响应（detail可能为字符串、对象或字段校验数组）",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "detail": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object"
                        },
                        {
                          "type": "array",
                          "items": {}
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "model",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "",
                "standard",
                "balanced",
                "emotion",
                "pro",
                "v3",
                "turbo",
                "premium",
                "v5"
              ],
              "default": ""
            }
          }
        ]
      }
    },
    "/history/{history_id}/timeline": {
      "get": {
        "summary": "实时读取时间线状态和公开文档，不把逐字数组放入合成回执。",
        "operationId": "open_timeline_get_timeline",
        "security": [
          {
            "ApiKey": []
          },
          {
            "BearerKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "成功响应；异步提交返回任务，下载返回音频，其余返回JSON",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "description": "错误响应（detail可能为字符串、对象或字段校验数组）",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "detail": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object"
                        },
                        {
                          "type": "array",
                          "items": {}
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "history_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/history/{history_id}/alignment": {
      "post": {
        "summary": "已有成功音频补对齐或重试，不重新合成及扣费。",
        "operationId": "open_timeline_alignment",
        "security": [
          {
            "ApiKey": []
          },
          {
            "BearerKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "成功响应；异步提交返回任务，下载返回音频，其余返回JSON",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "description": "错误响应（detail可能为字符串、对象或字段校验数组）",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "detail": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object"
                        },
                        {
                          "type": "array",
                          "items": {}
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OpenAlignmentRequest"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "history_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/history/{history_id}/subtitles": {
      "get": {
        "summary": "下载四种字幕，JSON仅含公开协议字段。",
        "operationId": "open_timeline_subtitles",
        "security": [
          {
            "ApiKey": []
          },
          {
            "BearerKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "成功响应；异步提交返回任务，下载返回音频，其余返回JSON",
            "content": {
              "application/json": {
                "schema": {
                  "type": "string"
                }
              },
              "application/x-subrip": {
                "schema": {
                  "type": "string"
                }
              },
              "text/vtt": {
                "schema": {
                  "type": "string"
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "description": "错误响应（detail可能为字符串、对象或字段校验数组）",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "detail": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object"
                        },
                        {
                          "type": "array",
                          "items": {}
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "history_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "srt",
                "vtt",
                "ass"
              ],
              "default": "srt"
            }
          },
          {
            "name": "allow_partial",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ]
      }
    },
    "/history/{history_id}/audio-with-timeline": {
      "get": {
        "summary": "在独占临时目录导出副本，保持原文件与合成账单。",
        "operationId": "open_timeline_embedded_audio",
        "security": [
          {
            "ApiKey": []
          },
          {
            "BearerKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "成功响应；异步提交返回任务，下载返回音频，其余返回JSON",
            "content": {
              "audio/mpeg": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "audio/wav": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "default": {
            "description": "错误响应（detail可能为字符串、对象或字段校验数组）",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "detail": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object"
                        },
                        {
                          "type": "array",
                          "items": {}
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "history_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "auto",
                "wav"
              ],
              "default": "auto"
            }
          },
          {
            "name": "allow_partial",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      },
      "BearerKey": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "OpenCloneSynthesizeRequest": {
        "description": "克隆音色合成请求。\n\nAttributes:\n    text: 要合成的文本（1-3000 字）。\n    voice_id: 克隆音色 ID（clone_xxx，需属于该 API Key）。\n    rate: 语速 0.5-2.0，默认 1.0。\n    instruction: 情感指令（仅支持情感指令的模型生效）。\n    language_type: 语种（Auto/Chinese/English/...）。\n    output_format: 输出格式（pcm/wav/mp3/opus）。\n    sample_rate: 采样率（24000/44100/48000，克隆音频最低 24kHz）。",
        "properties": {
          "text": {
            "description": "合成文本",
            "maxLength": 100000,
            "minLength": 1,
            "title": "Text",
            "type": "string"
          },
          "request_id": {
            "default": "",
            "description": "幂等键（重试传同一值不会重复扣费）",
            "maxLength": 64,
            "title": "Request Id",
            "type": "string"
          },
          "voice_id": {
            "description": "克隆音色 ID（clone_xxx）",
            "title": "Voice Id",
            "type": "string"
          },
          "rate": {
            "default": 1.0,
            "description": "语速 0.5-2.0",
            "maximum": 2.0,
            "minimum": 0.5,
            "title": "Rate",
            "type": "number"
          },
          "instruction": {
            "default": "",
            "description": "情感指令",
            "maxLength": 200,
            "title": "Instruction",
            "type": "string"
          },
          "language_type": {
            "default": "Auto",
            "description": "语种",
            "maxLength": 20,
            "title": "Language Type",
            "type": "string"
          },
          "output_format": {
            "default": "wav",
            "description": "输出格式 pcm/wav/mp3/opus",
            "enum": [
              "pcm",
              "wav",
              "mp3",
              "opus"
            ],
            "title": "Output Format",
            "type": "string"
          },
          "sample_rate": {
            "default": 24000,
            "description": "采样率 Hz（克隆音频最低 24kHz）",
            "enum": [
              24000,
              44100,
              48000
            ],
            "title": "Sample Rate",
            "type": "integer"
          },
          "response_format": {
            "default": "base64",
            "description": "返回音频编码或鉴权下载地址",
            "enum": [
              "base64",
              "url"
            ],
            "title": "Response Format",
            "type": "string"
          },
          "timeline_mode": {
            "default": "off",
            "description": "可选时间线模式，默认关闭",
            "enum": [
              "off",
              "native",
              "auto",
              "forced"
            ],
            "title": "Timeline Mode",
            "type": "string"
          },
          "pause_profile": {
            "default": "general",
            "description": "停顿预设：general/audiobook/broadcast/ad（见 ADR-0217）",
            "enum": [
              "general",
              "audiobook",
              "broadcast",
              "ad"
            ],
            "title": "Pause Profile",
            "type": "string"
          }
        },
        "required": [
          "text",
          "voice_id"
        ],
        "title": "OpenCloneSynthesizeRequest",
        "type": "object"
      },
      "OpenLibrarySynthesizeRequest": {
        "description": "声音库公共音色合成请求。",
        "properties": {
          "text": {
            "description": "合成文本",
            "maxLength": 100000,
            "minLength": 1,
            "title": "Text",
            "type": "string"
          },
          "request_id": {
            "default": "",
            "description": "可选幂等键",
            "maxLength": 64,
            "title": "Request Id",
            "type": "string"
          },
          "shared_voice_id": {
            "description": "声音库音色 ID",
            "exclusiveMinimum": 0,
            "title": "Shared Voice Id",
            "type": "integer"
          },
          "rate": {
            "default": 1.0,
            "description": "语速 0.5-2.0",
            "maximum": 2.0,
            "minimum": 0.5,
            "title": "Rate",
            "type": "number"
          },
          "instruction": {
            "default": "",
            "description": "情感指令",
            "maxLength": 200,
            "title": "Instruction",
            "type": "string"
          },
          "language_type": {
            "default": "Auto",
            "description": "语种",
            "maxLength": 20,
            "title": "Language Type",
            "type": "string"
          },
          "output_format": {
            "default": "wav",
            "description": "输出格式",
            "enum": [
              "pcm",
              "wav",
              "mp3",
              "opus"
            ],
            "title": "Output Format",
            "type": "string"
          },
          "sample_rate": {
            "default": 24000,
            "description": "采样率 Hz（克隆音频最低 24kHz）",
            "enum": [
              24000,
              44100,
              48000
            ],
            "title": "Sample Rate",
            "type": "integer"
          },
          "pause_profile": {
            "default": "general",
            "enum": [
              "general",
              "audiobook",
              "broadcast",
              "ad"
            ],
            "title": "Pause Profile",
            "type": "string"
          },
          "response_format": {
            "default": "base64",
            "enum": [
              "base64",
              "url"
            ],
            "title": "Response Format",
            "type": "string"
          },
          "timeline_mode": {
            "default": "off",
            "enum": [
              "off",
              "native",
              "auto",
              "forced"
            ],
            "title": "Timeline Mode",
            "type": "string"
          }
        },
        "required": [
          "text",
          "shared_voice_id"
        ],
        "title": "OpenLibrarySynthesizeRequest",
        "type": "object"
      },
      "OpenBalanceResponse": {
        "description": "余额查询响应。\n\nAttributes:\n    success: 是否成功。\n    balance: 总余额（积分包 + 赠送 + 按量）。\n    balance_detail: 三块余额拆分 {pack, bonus, metered, total}。\n    register_cost: 注册一次音色的积分单价。\n    synth_cost_per_char: 合成每字符的积分单价。\n    packs: 可充值的套餐目录（来自 core.openapi.packs）。",
        "properties": {
          "success": {
            "default": true,
            "title": "Success",
            "type": "boolean"
          },
          "balance": {
            "default": 0,
            "title": "Balance",
            "type": "integer"
          },
          "balance_detail": {
            "additionalProperties": true,
            "default": {},
            "title": "Balance Detail",
            "type": "object"
          },
          "register_cost": {
            "default": 0,
            "title": "Register Cost",
            "type": "integer"
          },
          "synth_cost_per_char": {
            "default": 0,
            "title": "Synth Cost Per Char",
            "type": "integer"
          },
          "synth_cost_per_char_by_model": {
            "additionalProperties": {
              "type": "integer"
            },
            "default": {},
            "title": "Synth Cost Per Char By Model",
            "type": "object"
          },
          "packs": {
            "default": [],
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Packs",
            "type": "array"
          }
        },
        "title": "OpenBalanceResponse",
        "type": "object"
      },
      "OpenAlignmentRequest": {
        "additionalProperties": false,
        "description": "时间线重试只接受布尔值，拒绝音频路径、任意URL、用户ID和替换原文。",
        "properties": {
          "retry": {
            "default": false,
            "title": "Retry",
            "type": "boolean"
          }
        },
        "title": "OpenAlignmentRequest",
        "type": "object"
      }
    }
  }
}
