API 指引 / 错误码

错误码

更新时间:2026-02-05

错误格式

所有错误响应均为 JSON 格式,包含 error 字段:

JSON
{
"error": {
"code": "invalid_api_key",
"message": "Invalid API key provided.",
"type": "authentication_error",
"request_id": "req_01H8XYZ..."
}
}

错误码列表

参数类型必需说明
400invalid_request_error可选请求参数错误,检查 JSON 结构与字段
401authentication_error可选API Key 缺失或无效,重新检查 Authorization Header
403permission_denied可选无权访问该资源或模型
404not_found可选资源不存在,检查模型 ID / 文件 ID
429rate_limit_exceeded可选触发速率限制,见速率限制章节
500server_error可选平台内部错误,可携带 request_id 联系支持
503service_unavailable可选模型上游暂时不可用,稍后重试

重试策略

对 429 与 5xx 错误建议实现指数退避重试(初始 1s,最大 30s,最多 5 次)。对 4xx 错误不应重试,优先修正参数。

没有找到想看的内容?联系我们 →