錯誤碼與狀態碼規範
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) | 場景說明 |
|---|---|---|
400 | invalid_request_error | 缺少必填參數或欄位驗證失敗 |
401 | authentication_error | API Key 缺失或鑑權失敗 |
404 | not_found_error | 存取的資源路徑不存在 |
500 | api_error | 伺服器內部例外或引擎合成故障 |
