錯誤碼
HTTP 状態碼
| 状態碼 | 含義 | 處理方式 |
|---|---|---|
| 200 | 成功 | — |
| 400 | 請求錯誤 | 檢查請求參數 |
| 401 | 未授权 | 驗證 API 密钥 |
| 403 | 禁止訪問 | 檢查帳戶权限 |
| 404 | 未找到 | 確认端點或模型 ID |
| 429 | 超出速率限制 | 降低請求频率或升級帳戶等級 |
| 500 | 伺服器錯誤 | 稍作等待後重試 |
| 503 | 服務不可用 | 稍作等待後重試 |
錯誤類型
| 類型 | 說明 |
|---|---|
invalid_request_error | 請求格式錯誤或參數無效 |
authentication_error | API 密钥無效或缺失 |
rate_limit_error | 超出速率限制 |
model_not_found_error | 指定的模型不存在 |
context_length_exceeded | 輸入超出模型的上下文窗口 |
content_filter_error | 內容被安全策略攔截 |
server_error | 伺服器內部錯誤 |
錯誤響應格式
{
"error": {
"message": "Human-readable description",
"type": "error_type",
"code": "error_code",
"param": "parameter_name"
}
}常见錯誤
invalid_api_key
Status: 401
Message: "Invalid API key provided"請聯繫 support@linkastra.ai 驗證你的 API 密钥。
context_length_exceeded
Status: 400
Message: "This model's maximum context length is 128000 tokens"請减少輸入長度,或使用 max_tokens 限制輸出。
rate_limit_exceeded
Status: 429
Message: "Rate limit exceeded"請實現指數退避。详见速率限制。
model_not_found
Status: 404
Message: "Model 'gpt-5' not found"請在模型概览查看可用模型。