ModelsPricingAPI keys
  • Overview
  • Quickstart
  • Authentication
  • Errors and retries
  • Limits and billing
  • Client libraries

Reference

Errors and retries

Every error is an HTTP status and one error object. Branch on its code, show its message, quote its request_id to support.

Error format

400 Bad Request
{
  "error": {
    "code": "invalid_request",
    "message": "Invalid request body.",
    "request_id": "req_0ee311b4334e4b118a94c7d1c48577fd",
    "category": "validation",
    "stage": "validation",
    "retryable": false,
    "retry_after_seconds": null,
    "public_reason": "invalid_request",
    "next_action": "fix_input",
    "details": {
      "errors": [
        {
          "path": "prompt",
          "loc": [
            "prompt"
          ],
          "message": "must have required property 'prompt'",
          "type": "required"
        }
      ]
    }
  }
}
FieldMeaning
codeStable and machine-readable, one per cause. Branch on this, not on the message.
messageOne sentence for people.
request_idAlso in the x-sume-request-id header.
category, stageWhere it failed, such as validation, auth, quota, queue or job_state.
retryabletrue when the same request can succeed later, unchanged.
retry_after_secondsHow long to wait first. Every retryable error also sends it as the retry-after header.
next_actionfix_input, authenticate, add_funds, retry_later, poll_status, inspect_events or contact_support.
detailsExtra facts, such as the failing fields in details.errors[].

The status gives the class: 400 fix the request, 401 and 403 the key, 402 the balance, 404 nothing there, 409 the job's state, 429 slow down, 5xx Sume's side.

Codes

StatuscodeMeaningRetry
400bad_requestThe body is not valid JSON.No, fix the body
400invalid_requestA field, query value or header is missing or wrong; details.errors[] names it.No, fix it
400unknown_parameterThe job list got a query parameter it does not take.No, fix the query
401unauthorizedNo key, or the key is wrong or revoked.No
401session_not_acceptedA dashboard session was sent instead of a key.No, send a key
402insufficient_fundsThe balance cannot cover the price; details has required_usd and available_usd. Not charged.After a top-up, with a new Idempotency-Key
403insufficient_scopeThe key lacks the scope this route needs.No
403open_key_route_not_allowedThe route is outside the model API a Sume API key calls.No
403open_key_requiredA billing read got a key that is not a Sume API key.No, use one
404not_foundNo such route, job or model in your workspace.No
409idempotency_conflictThe Idempotency-Key was used for a different request.No, use a new key
409job_not_completedThe job is still queued or processing, so it has no result yet.Yes, poll its status first
409job_failedThe job failed; message says why. It has no result.No
409job_canceledThe job was canceled. It has no result.No
409job_generation_already_startedGeneration has started, so the job can no longer be canceled.No
409job_not_cancelableThe job has already ended.No
409webhook_not_configuredThe job was made without a webhook_url, so there is nothing to redeliver.No
409job_not_terminalThe job has not ended, so there is no webhook to redeliver yet.Yes, once it ends
409asset_upload_incompleteThe uploaded file has not arrived.After the PUT finishes
409top_up_in_dashboardTop-ups are made in the dashboard, not through the API.No
413payload_too_largeThe request body is too big.No
413asset_too_largeThe upload is over the limit; details.max_bytes says it.No
415unsupported_media_typeThe body is not application/json.No
429queue_fullThe workspace has as many jobs in flight as it may. Not charged.Yes, once a job ends, with the same Idempotency-Key
429rate_limitedToo many requests for this key in the window.Yes, after retry-after
500internal_errorA fault on Sume's side.Yes, with backoff
501billing_in_dashboardTransactions, receipts and usage are read in the dashboard.No
502provider_submission_failedThe model could not start the job. Refunded.Only when retryable is true, with the same Idempotency-Key
503provider_capacity_exceededThe model is at capacity right now. Refunded.Yes, after retry-after, with the same Idempotency-Key
503provider_not_configuredThis model is not available here.No
503database_busyA short overload.Yes, after retry-after
503deploy_drainingThis server is restarting for a deploy.Yes, after retry-after
503overloadedThis server has as many requests in flight as it takes.Yes, after retry-after
503replica_not_readyThis server has just started and cannot reach its database yet.Yes, after retry-after
503api_key_auth_unavailableKeys could not be checked for a moment.Yes, after retry-after

Retrying safely

  • Retry when retryable is true, after retry-after. Back off exponentially, with jitter, if it fails again.
  • Retry reads (status, result, list) after a network error too.
  • A retryable refusal frees its Idempotency-Key: send queue_full (once a job ends), provider_capacity_exceeded or a retryable provider_submission_failed again with the same key. A final refusal keeps its answer: after insufficient_funds, top up and send a new request with a new key. A refused submit is never charged.
  • Do not retry 401, 403, 404 or a 400 you have not fixed.

Idempotency

A network error after a submit leaves you unsure whether the job exists. Send an Idempotency-Key on every generate request and reuse it on retry:

Header
Idempotency-Key: 9816bc88-9791-43a1-86c2-876dc7c544e8
  • 1–255 printable ASCII characters. A UUID per request is the simple choice.
  • The same key with the same body returns the original job with idempotency_hit: true, charged once.
  • The same key with a different body answers 409 idempotency_conflict.

Failed jobs

A job that ends failed is not an HTTP error. The submit succeeded; the job's error object (same fields as above) says what went wrong, and its price is refunded. Reading its result answers 409 job_failed with the same reason. A model refusing a prompt on content grounds reports public_reason: "content_policy_rejected".

Related

  • Limits and billing
  • Jobs and polling
  • Authentication

On this page

  • Error format
  • Codes
  • Retrying safely
  • Idempotency
  • Failed jobs