文档 / 参考
错误
每个错误的响应体格式都一样。读 error.code 来决定下一步怎么做。
错误响应体
402 Payment Required
{
"detail": "Your balance is $0.40 and this request costs $1.75. Add funds at https://api.minicut.ai/console/billing.",
"error": {
"type": "billing_error",
"code": "insufficient_balance",
"message": "Your balance is $0.40 and this request costs $1.75. Add funds at https://api.minicut.ai/console/billing.",
"param": null,
"request_id": "req_01JA9Y7Q2K4M5N6P7R8S9T0V1W"
}
}422 validation_error 会在 detail 里列出所有有问题的字段,error.param 指出第一个:
422 Unprocessable Content
{ "detail": [{ "loc": ["body", "duration"], "msg": "must be one of 5, 10", "type": "enum" }] }每个响应都带有 X-Request-Id。询问任何一次调用时,请把它发给我们。
错误码
| HTTP | error.code | 何时出现 | 怎么做 |
|---|---|---|---|
| 400 | invalid_json | 请求体不是 JSON | 修正请求体 |
| 400 | request_in_progress | 任务还没结束你就请求了结果 | 轮询状态,或使用 webhook |
| 400 | already_completed | 你取消了一个已经结束的任务 | 无需处理 |
| 400 | invalid_webhook_url | webhook_url 不是 https,或指向私有地址 | 使用公网 https 地址 |
| 401 | missing_api_key | 没有 Authorization 请求头 | 发送 Authorization: Key <key> |
| 401 | invalid_api_key | API Key 错误、不存在或已被撤销 | 在控制台创建新的 API Key |
| 402 | insufficient_balance | 你的余额低于价格 | 充值 |
| 403 | account_frozen | 账户已被冻结 | 发邮件到 team@arkzero.ai |
| 404 | model_not_found | 没有这个 ID 的模型 | 查看 GET /v1/models |
| 404 | request_not_found | 你没有这个 ID 的请求 | 检查 ID 和模型 ID |
| 405 | method_not_allowed | 这个路径的 HTTP 方法不对 | 查看 Allow 请求头 |
| 409 | idempotency_conflict | Idempotency-Key 相同,请求体不同 | 新请求体用新的 Idempotency-Key |
| 410 | quote_expired | X-Quote-Id 超过 15 分钟,或属于另一个请求体 | 重新获取报价 |
| 413 | payload_too_large | 请求体超过 1 MB,或输入文件超过 50 MB | 用 URL 发送更小的文件 |
| 422 | validation_error | 某个字段不符合模型的设置 | 修正 detail 里的字段 |
| 422 | input_fetch_failed | 输入 URL 无法获取,或文件类型不对 | 检查 URL 是公开的,且文件类型正确 |
| 422 | content_refused | 内容检查拒绝了提示词或某个输入 | 修改提示词或输入 |
| 429 | rate_limited | 这一分钟请求太多 | 等待 Retry-After |
| 429 | key_spend_limit_reached | 这个 API Key 达到了你设置的消费上限 | 等到 reset_at,或调高上限 |
| 429 | monthly_cap_reached | 你所在档位的月度上限已用完 | 等到 reset_at,或充值升到更高档位 |
| 500 | internal_error | 我们这边出了问题 | 重试,并把请求 ID 发给我们 |
| 503 | model_unavailable | 模型暂时无法接任务 | 在 Retry-After(60 秒)之后重试。没有扣费 |
任务失败
一个已被接受但随后失败的任务,会在状态接口返回 state 和 error.code,在结果接口返回 422,在 webhook 里返回 data.error.code。这些情况都不会向你收费。
error.code | 含义 |
|---|---|
content_refused | 结果被内容检查拒绝 |
supplier_failed | 模型没能完成任务 |
supplier_unreachable | 很长时间无法连接到模型 |
output_unavailable | 结果无法保存 |
safety_check_unavailable | 无法对结果运行内容检查 |
internal_error | 任务在完成前于我们这边中止 |
expired | 24 小时内没有完成 |
cancelled | 你取消了它 |