百度千帆API错误码相关说明
百度千帆AI应用开发者中心的API在调用过程中,若出现异常会返回对应的错误码信息,开发者可以通过这些错误码快速定位问题所在,本文将对所有相关错误码及排查方法做详细说明。

错误码基础说明
当API请求出现错误时,服务端会以JSON格式返回错误信息,返回的内容包含三个核心参数,具体信息如下:
| 参数名 | 类型 | 说明 |
|---|---|---|
| code | String | 具体的错误码标识 |
| message | String | 错误描述信息,帮助开发者理解错误原因并找到解决方法 |
| type | String | 错误描述类型,用于区分不同类别的错误 |
以下是错误返回信息的示例结构:
{ "error": { "code":"malformed_json", "message":"Invalid Argument", "type":"invalid_request_error" }, "id":"as-****xi6mm8" }
通用错误码列表
以下是千帆API调用过程中常见的通用错误码,包含对应的HTTP状态码、错误类型、错误信息及解决说明:
| HTTP状态码 | 类型 | 错误码 | 错误信息 | 说明 |
|---|---|---|---|---|
| 400 | invalid_request_error | malformed_json | Invalid Argument | 入参格式有误,不是标准json格式,需要检查请求参数的格式是否符合要求 |
| 400 | invalid_request_error | invalid_model | model is empty | 未指定model参数,需要在请求中补充正确的模型参数 |
| 400 | invalid_request_error | invalid_messages | 返回的具体错误信息 | message格式不符合规范,可根据返回的具体说明调整message内容 |
| 400 | invalid_request_error | characters_too_long | the max input characters is xxx | 请求长度超过最大字符限制,即用户输入大模型内容过长,可适当缩短输入内容后重试 |
| 400 | invalid_request_error | tokens_too_long | Prompt tokens too long | 请求内容超过大模型内部限制,用户输入内容过长,可适当缩短输入后重试 |
| 400 | invalid_request_error | invalid_argument | 返回的具体错误信息 | 参数异常,参考返回的错误信息调整对应参数即可 |
| 400 | invalid_request_error | invalid_image_generation_prompt | prompt is invalid, please check parameter | 文生图相关的prompt不合法,需要检查prompt内容是否符合要求 |
| 400 | invalid_request_error | invalid_image_generation_refer_image | refer image is invalid, please check parameter | 传入的文生图参考图不合法,需要更换符合要求的参考图 |
| 400 | invalid_request_error | invalid_image_url | the image width and height are not within the allowed range | 图像尺寸超出限制范围,要求图像尺寸小于6000px*6000px,最短边不低于5px,需要调整图像尺寸后重试 |
| 400 | invalid_request_error | invalid_plugin_argument | 返回的具体错误信息 | 插件服务报错,参考返回的错误信息调整插件相关参数 |
| 400 | unsafe_request | image_url_unsafe | the content of image_url.url field is unsafe | image_url内容不合法,若调整后仍有问题,可在百度云控制台提交工单反馈 |
| 401 | access_denied | no_parameter_permission | 返回的具体错误信息 | 无参数使用权限,参考返回的错误信息排查权限问题 |
| 401 | invalid_request_error | invalid_model | The model does not exist or you do not have access to it. | 模型不存在或者当前用户没有使用该模型的权限,可检查模型名称或申请对应权限 |
| 401 | invalid_request_error | invalid_appid | No permission to use the appid | appid鉴权失败,该用户没有使用这个appid的权限,需要检查appid是否正确或申请对应权限 |
| 401 | invalid_request_error | invalid_iam_token | IAM Certification failed | iam鉴权失败,bearer token无效或过期,或者请求的Authorization没加Bearer,需要检查token及请求头格式 |
| 403 | unsafe_request | system_unsafe | the content of system field is invalid | system字段内容不安全,需要调整system字段的内容后重试 |
| 403 | unsafe_request | user_setting_unsafe | the content of user field is invalid | user_setting内容不合法,需要调整对应内容后重试 |
| 403 | unsafe_request | functions_unsafe | the content of functions field is invalid | function内容不合法,需要调整functions字段内容后重试 |
| 403 | access_denied | account_overdue | Access denied due to overdue account | 账号已欠费,余额小于0,如需继续调用,需前往百度智能云财务系统完成充值 |
| 403 | access_denied | model_offline | The model is offline | 请求的模型已下线,需要更换其他可用模型进行调用 |
| 405 | invalid_request_error | method_not_supported | Only POST requests are accepted | 此接口只支持POST请求,需要调整为POST方式发起请求 |
| 429 | rate_limit_exceeded | rpm_rate_limit_exceeded | Rate limit reached for RPM | Cloud ID下RPM超限额,可适当控制请求频率,也可在控制台购买更大的RPM/TPM配额,仍有问题可提交工单反馈 |
| 429 | rate_limit_exceeded | tpm_rate_limit_exceeded | Rate limit reached for TPM | Cloud ID下TPM超限额,可适当控制请求频率,也可在控制台购买更大的RPM/TPM配额,仍有问题可提交工单反馈 |
| 429 | rate_limit_exceeded | input_tpm_rate_limit_exceeded | Rate limit reached for Input TPM | Cloud ID下输入TPM超限额,可适当控制请求频率,也可在控制台购买更大的RPM/TPM配额 |
| 429 | rate_limit_exceeded | output_tpm_rate_limit_exceeded | Rate limit reached for Output TPM | Cloud ID下输出TPM超限额,可适当控制请求频率,也可在控制台购买更大的RPM/TPM配额 |
| 429 | rate_limit_exceeded | Offline_batch_reasoning_refused | Rate limit reached for offline batch reasoning | 批推流量被拒绝,请稍后重试,持续出现可提交工单反馈 |
| 429 | rate_limit_exceeded | preemptible_rate_limit_exceeded | Rate limit reached for preemptible resource | 混抢资源qps超限,包含可抢占接口、离线推理、离线评估请求,需控制请求频率 |
| 429 | rate_limit_exceeded | user_rate_limit_exceeded | qps request limit by APP ID reached | QPS超限额,可适当控制请求频率,仍有问题可提交工单反馈 |
| 429 | rate_limit_exceeded | cluster_rate_limit_exceeded | request limit by resouce cluster reached | 集群QPS超限额,可再次请求,持续出现可提交工单反馈 |
| 429 | rate_limit_exceeded | cluster_rpm_rate_limit_exceeded | Rate limit reached for Cluster RPM | 集群RPM超限额,可提交工单反馈处理 |
| 429 | rate_limit_exceeded | cluster_tpm_rate_limit_exceeded | Rate limit reached for Cluster TPM | 集群TPM超限额,可提交工单反馈处理 |
| 500 | Internal_error | internal_error | Internal error | 系统内部错误,请稍后重试 |
| 500 | Internal_error | dispatch_internal_error | Internal error | 系统内部错误,请稍后重试 |
| 500 | Internal_error | image_generation_interal_error | image generation service interal error | 文生图服务内部错误,请稍后重试 |
Coding Plan相关专属错误码
若你使用的是千帆的Coding Plan套餐,调用接口时可能会遇到以下专属错误码,具体信息如下:
| HTTP状态码 | 类型 | 错误码 | 错误信息 | 说明 |
|---|---|---|---|---|
| 401 | invalid_request_error | coding_plan_api_key_required | Coding Plan requires a dedicated API key | 当前请求未使用Coding Plan专属API Key,仅可使用专属API Key调用Coding Plan套餐 |
| 401 | invalid_request_error | coding_plan_api_key_not_allowed | Coding Plan API key is not allowed for non-Coding Plan requests | 当前使用的Coding Plan专属API Key无法调用非Coding Plan套餐相关接口 |
| 403 | access_denied | coding_plan_not_subscribed | Coding Plan subscription is missing | 当前账号未订阅Coding Plan套餐,如需使用请前往控制台完成订阅 |
| 403 | access_denied | coding_plan_subscription_expired | Coding Plan subscription is expired | 当前账号Coding Plan套餐已过期,如需使用请前往控制台完成续费 |
| 403 | access_denied | coding_plan_model_not_supported | The current model does not support Coding Plan | 当前模型不支持Coding Plan,请切换至支持Coding Plan的模型后重试 |
| 429 | quota_exceeded | coding_plan_hour_quota_exceeded | Coding Plan hour quota has been exceeded | 当前账号的Coding Plan5小时调用额度已用尽,请等待额度刷新或升级套餐 |
| 429 | quota_exceeded | coding_plan_week_quota_exceeded | Coding Plan week quota has been exceeded | 当前账号的Coding Plan周限额已用尽,请等待额度刷新或升级套餐 |
| 429 | quota_exceeded | coding_plan_month_quota_exceeded | Coding Plan month quota has been exceeded | 当前账号的Coding Plan月限额已用尽,请等待额度刷新或升级套餐 |
| 429 | rate_limit_exceeded | coding_plan_rate_limit_exceeded | Coding Plan request rate limit exceeded | Coding Plan套餐请求频率过高,请稍后再试 |
| 429 | rate_limit_exceeded | coding_plan_cluster_rate_limited | The current model is experiencing high demand | 当前模型资源紧张,请尝试使用Coding Plan的其他模型进行测试 |
当遇到上述错误码时,可先对照说明中的建议进行调整,若调整后仍无法解决问题,可前往百度云控制台提交工单,由官方技术人员协助排查。
百度千帆API错误码接口调用排查qianfan_apiCoding_Plan修改时间:2026-06-06 04:01:02