错误与速率限制
了解错误响应,安全重试并恢复失败的生成任务。
错误响应#
HTTP 错误表示请求被拒绝。已保存的操作可能稍后失败,而状态端点仍返回 HTTP 200。
{ "error": { "code": "REQUEST_INVALID", "message": "Check the request fields and try again.", "request_id": "e8aa0a87-6cd9-42eb-975a-b72bf43218c8", "retryable": false }, "request_id": "e8aa0a87-6cd9-42eb-975a-b72bf43218c8"}恢复#
| HTTP | 错误 | 恢复 |
|---|---|---|
400 | 无效请求REQUEST_INVALID | 重试前请修正错误指出的字段。 |
401 | 无效凭据CREDENTIAL_INVALID | 检查凭据、有效期以及是否已被撤销。 |
402 | 积分不足INSUFFICIENT_CREDITS | 为凭据所属账户充值积分,然后继续已保存的任务。 |
403 | 权限被拒绝SCOPE_REQUIRED | 使用具有所需权限且可访问所选资源的凭据。 |
404 | 资源不可用RESOURCE_UNAVAILABLE | 检查资源 ID,并确认其属于已授权账户。 |
409 | 操作意图冲突IDEMPOTENCY_CONFLICT | 仅为原始请求复用意图标识。不同操作请使用新的 UUID。 |
429 | 已达速率限制RATE_LIMITED | 等待 Retry-After 指定的时间后再重试同一请求。 |
503 | 暂时不可用DEPENDENCY_UNAVAILABLE | 等待 Retry-After 指定时间并使用同一意图重试。超时后检查已保存的操作。 |
错误#
{ "REQUEST_INVALID": "Check the request fields and try again.", "TOOL_INPUT_INVALID": "The tool input does not match its public schema.", "IDEMPOTENCY_KEY_REQUIRED": "Supply a UUID Idempotency-Key for this action.", "IDEMPOTENCY_CONFLICT": "This intent was already used for different details.", "CREDENTIAL_INVALID": "The credential is invalid, expired or revoked.", "AUTHENTICATION_REQUIRED": "A valid credential is required.", "SCOPE_REQUIRED": "The credential does not permit this action.", "ACTION_FORBIDDEN": "This action is not permitted.", "ORIGIN_DENIED": "This origin is not registered for the credential.", "RESOURCE_UNAVAILABLE": "The requested resource is unavailable.", "TOOL_UNAVAILABLE": "This tool is unavailable.", "CURSOR_INVALID": "Refresh the list and try again.", "ACTION_CHANGED": "The action or its target changed. Read its current state.", "HUMAN_REVIEW_REQUIRED": "Review this action in the authenticated Tong dashboard.", "REVIEW_EXPIRED": "This review expired. Read the current operation.", "INSUFFICIENT_CREDITS": "Add credits to continue.", "PAID_FEATURE_DEPOSIT_REQUIRED": "Complete the account deposit requirement to use this tool.", "POLICIES_REQUIRED": "Accept the current account policies to continue.", "ACCOUNT_UNAVAILABLE": "This account is unavailable.", "RATE_LIMITED": "Too many requests. Retry after the indicated interval.", "QUEUE_FULL": "The account work queue is full. Retry later.", "WEBHOOK_LIMIT": "The account webhook limit has been reached.", "WEBHOOK_DESTINATION_INVALID": "Use an allowed public HTTPS webhook destination.", "QUOTE_INVALID": "The quote is invalid or does not match this request.", "QUOTE_UNAVAILABLE": "The requested quote is unavailable.", "EXPORT_NOT_READY": "The export is not ready for download.", "EXPORT_TOO_LARGE": "Narrow the export interval or filters.", "QUERY_TOO_LARGE": "Narrow the query interval or filters.", "INTERVAL_INVALID": "Use a valid interval of at most 90 days.", "UPLOAD_TOO_LARGE": "The upload exceeds the media purpose limit.", "DEVELOPER_ACCESS_UNAVAILABLE": "Developer access is unavailable.", "DEPENDENCY_UNAVAILABLE": "A required service is temporarily unavailable.", "CATALOG_UNAVAILABLE": "The current model catalog is temporarily unavailable.", "CONFIGURATION_INVALID": "Developer service configuration is unavailable."}重试与超时#
每项操作保留一个 UUID,超时或重试时重复使用。同一 UUID 对应不同输入会被拒绝。
curl 'https://platform.tongai.io/v1/operations/by-intent/45be69f1-c266-4a09-a82c-bf3c6303eb03' \ -H "Authorization: Bearer $TONG_API_KEY"配置
curl --version速率限制#
Retry-After: {seconds}active_queue_per_account: 100admissions_per_minute: owner=500, credential=180, client=1000HTTP_per_minute: owner=5000, credential=2000, client=10000, IP=1000query_interval_max_days: 90export_max_rows: 100000export_max_bytes: 33554432webhooks_per_account: 10webhook_delivery_attempts: 12遵守 Retry-After。等待后使用相同意图重试临时失败,不要创建第二次付费操作。