错误响应格式
网关返回统一错误格式:
HTTP/1.1 400 Bad Request
{
"error": { "message": "model is required", "type": "invalid_request_error" }
}
创建任务错误
| HTTP 状态 | type | 含义 |
|---|---|---|
| 400 | invalid_request_error | 请求参数错误(如 model 为空)或上游 4xx 透传 |
| 401 | authentication_error | API Key 无效 |
| 403 | forbidden | API Key IP 白名单不允许当前请求 IP |
| 404 | not_found_error | 模型无可用路由 |
| 502 | upstream_error | 服务端错误 |
任务查询错误
HTTP/1.1 404 Not Found
{
"error": { "message": "Task not found", "type": "not_found_error" }
}
超时与中断
- 创建任务(POST):建议
curl --max-time 30。 - 查询任务(GET):按需轮询。SDK
.task()内部自动轮询。 - SDK 取消:传入
AbortSignal停止轮询。