錯誤碼

HTTP 状態碼

状態碼含義處理方式
200成功
400請求錯誤檢查請求參數
401未授权驗證 API 密钥
403禁止訪問檢查帳戶权限
404未找到確认端點或模型 ID
429超出速率限制降低請求频率或升級帳戶等級
500伺服器錯誤稍作等待後重試
503服務不可用稍作等待後重試

錯誤類型

類型說明
invalid_request_error請求格式錯誤或參數無效
authentication_errorAPI 密钥無效或缺失
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"

請在模型概览查看可用模型。

相關文件