故障排除
认证类错误
| 错误信息 | HTTP 状态码 | 原因 | 解决方案 |
|---|---|---|---|
invalid api key | 401 | API Key 无效、已过期、已撤销或已禁用 | 请进入控制台 → API Keys 页面,确认 Key 状态为"活跃",如已过期请重新生成 |
路由与模型错误
| 错误信息 | HTTP 状态码 | 原因 | 解决方案 |
|---|---|---|---|
no model config found for: {model} | 404 | 请求的模型 ID 不存在 | 进入模型列表,确认模型 ID 拼写正确 |
model field is required | 400 | 请求体中缺少 model 字段 | 在请求 JSON 中添加 "model": "模型名称" |
invalid or empty requested model | 400 | 请求的模型名称为空或非法 | 进入模型列表,确认使用正确的模型 ID 格式 |
unknown api path | 404 | API 路径错误 | 请确认 Base URL 为 https://api.gate.ai/openai/v1 或 https://api.gate.ai/anthropic |
请求参数错误
| 错误信息 | HTTP 状态码 | 原因 | 解决方案 |
|---|---|---|---|
invalid JSON body | 400 | 请求体 JSON 格式不合法 | 检查请求体是否为合法的 JSON 格式 |
failed to read request body | 400 | 请求体读取失败 | 确认请求体未损坏,Content-Type 设置为 application/json |
failed to rewrite request body | 500 | 请求体重写失败(网关内部) | 请重试,若持续出现,请联系技术支持 |
images are not supported by this model | 400 | 目标模型不支持图片输入 | 更换支持多模态(图片)的模型,如 gpt-4o |
audio is not supported by this model | 400 | 目标模型不支持音频输入 | 更换支持音频输入的模型 |
unsupported parameter: max_tokens | 400 | 部分模型不支持 max_tokens 参数 | 改用 max_completion_tokens 参数 |
配额与限流错误
| 错误信息 | HTTP 状态码 | 原因 | 解决方案 |
|---|---|---|---|
api key budget quota exceeded | 429 | API Key 预算额度已用尽 | 进入控制台 → API Keys → 预算设置,提高预算上限或等待配额重置 |
guardrail budget limit exceeded | 429 | 护栏预算限制已超出 | 检查护栏配置中的预算限制,调高限额或降低使用频率 |
organization guardrail budget limit exceeded | 429 | 组织级护栏预算已超出 | 联系组织管理员调整组织级预算限制 |
model not allowed by guardrail policy | 403 | 模型不在护栏策略允许范围内 | 进入控制台 → 护栏设置,将目标模型添加到允许列表 |
The free model usage has reached its daily global limit today. | 429 | 免费模型全局日限额已达上限 | 等待次日重置,或升级到付费计划使用无限制模型 |
The free model usage has reached its daily limit today. | 429 | 个人免费模型日限额已达上限 | 等待次日重置,或升级到付费计划 |
Guest daily spending limit exceeded. Please try again tomorrow or upgrade to a paid plan. | 429 | 游客身份日累计限额已超出 | 注册账号并升级到付费计划,或等待次日重置 |
计费与余额错误
| 错误信息 | HTTP 状态码 | 原因 | 解决方案 |
|---|---|---|---|
Pending payment {amount} USD — Please top up... | 402 | 账户余额不足且存在欠费 | 前往 Gate Pay 完成充值 |
Insufficient balance and account in debt | 402 | 余额不足且账户处于欠费状态 | 前往 Gate Pay 完成充值 |
billing model info not found for model "{model}" | 400 | 模型的计费信息不存在 | 确认模型 ID 正确,若为新模型,请联系技术支持配置计费规则 |
billing model info is ambiguous for model "{model}" | 400 | 模型计费信息存在歧义(多条匹配) | 请联系技术支持排查模型计费配置 |
billing configuration error | 500 | 计费规则配置错误(服务端) | 请联系技术支持修复计费配置 |
上游服务错误
| 错误信息 | HTTP 状态码 | 原因 | 解决方案 |
|---|---|---|---|
bad gateway | 502 | 网关与上游服务通信失败 | 请重试,若持续出现,请检查服务状态页或联系技术支持 |
upstream service unavailable | 502 | 上游 AI Provider 不可用 | 稍后重试,或切换到其他可用模型 |
upstream service error | 502 | 上游 AI Provider 返回错误 | 检查请求参数是否符合目标模型要求;若持续出现请联系技术支持 |
request timeout | 504 | 请求上游超时 | 减少输入长度或增加超时时间后重试 |
no provider handler configured for protocol | 502 | 网关未配置对应的协议处理器 | 请联系技术支持检查网关配置 |
服务端内部错误
| 错误信息 | HTTP 状态码 | 原因 | 解决方案 |
|---|---|---|---|
internal server error | 500 | 网关内部错误 | 请重试,若持续出现,请携带 Request ID 联系技术支持 |
failed to record request log | 500 | 请求日志记录失败 | 不影响请求结果,可忽略;若频繁出现请联系技术支持 |
failed to list models | 500 | 模型列表查询失败 | 请重试,若持续出现,请联系技术支持 |
常见场景速查
Base URL 错误
bash
1# ❌ 错误2https://api.gate.ai/v1/chat/completions34# ✅ 正确5https://api.gate.ai/openai/v1/chat/completions # openai 协议6https://api.gate.ai/anthropic/v1/messages # anthropic 协议max_tokens 参数不兼容
javascript
1// ❌ 部分模型不支持2{ "model": "gpt-4o", "max_tokens": 100 }34// ✅ 使用 max_completion_tokens5{ "model": "openai/gpt-5.5", "max_completion_tokens": 100 }API Key 格式
bash
1# ✅ 正确的请求头2Authorization: Bearer sk-xxxxxxxxxxxxxxxxxxxx # openai 协议3X-api-key: sk-xxxxxxxxxxxxxxxxxxxx # anthropic 协议