Skip to content

错误码与状态码规范 ​

OneTTS 全局使用标准 OpenAI 错误结构包裹所有异常响应。


🛑 统一错误响应结构 ​

json
{
  "error": {
    "message": "Incorrect API key provided or missing Authorization header.",
    "type": "invalid_request_error",
    "param": null,
    "code": "invalid_api_key"
  },
  "detail": "Incorrect API key provided or missing Authorization header."
}

📊 HTTP 状态码对照 ​

状态码错误类型 (type)场景说明
400invalid_request_error缺少必填参数或字段校验失败
401authentication_errorAPI Key 缺失或鉴权失败
404not_found_error访问的资源路径不存在
500api_error服务端内部异常或引擎合成故障

Released under the Apache-2.0 License.