Errors
What a failed call looks like, before the work starts and inside a stream. A failed call is never billed.
HTTP status codes
Before any work starts, a failure is a plain HTTP error with a JSON body of the form {"detail": {"code": "…"}}. A request that fails field validation gets a 422 whose detail is instead a list of the fields at fault. Nothing is charged.
401invalid_key: Missing, unknown, revoked or expired key, or the team is archived, not active, or has had its API access turned off.402insufficient_credits: The team's balance is below the price of a run; the body also carries price and balance. No work was started.404model_not_found: Zoe only: a model other than "zoe" was requested.413file_too_large: Statement over 10 MB, or contracts over 20 MB in total.413too_many_contracts: More than 10 contract files.422invalid_request: Royalties: both or neither of contracts / contract_terms. Royalties or splits: a contract that isn't a PDF.422(no code): Any other validation failure: malformed contract_terms / expenses JSON, a missing contracts field on splits, an invalid split sheet body, or an empty, over-long or badly ordered Zoe messages list. detail is FastAPI's list of the fields at fault.429rate_limited: The key sent more than 60 requests in a minute; the response carries Retry-After: 60. The limit is per key, so parallel workloads are cleanest on separate keys. Refused attempts count toward the minute, so wait the full Retry-After before retrying.500internal_error: A split sheet couldn't be rendered. Quote request_id to support.502zoe_failed: Zoe didn't answer. Retry. On a Zoe stream this arrives as an error frame before [DONE] instead.
Stream error codes
Inside a calculation or splits stream, the failure arrives as an error event, because HTTP is already 200 by then. message and suggestion are safe to show a person; an error event is never billed.
error event Instead of a result. HTTP is already 200, so check type.
codestring: Stable, for your code to branch on (the list is below).message, suggestionstring: Safe to show a person.detailsobject: Structured context to fix the input without a person in the loop.billing.credits0: An error event is never billed, and says so.
STATEMENT_UNSUPPORTED_FORMAT: Not a CSV or Excel file.STATEMENT_EMPTY: No earnings rows could be read.STATEMENT_COLUMNS_UNDETECTABLEdetails: available_columns: The title or amount column could not be identified.NO_WORKS_IN_CONTRACT: The contract lists no songs.NO_ROYALTY_SHARES_IN_CONTRACT: The contract has no percentage splits.NO_STREAMING_EARNABLE_SHARESdetails: excluded_payor_count: Splits exist, but none are paid from streaming or master income.NO_SONG_MATCHESdetails: contract_works, statement_songs, statement_song_total_count, title_columns_tried: No contract work appears in the statement.CONTRACT_UNREADABLEdetails: reason: Splits only: a scanned image, an encrypted or empty file.internal_errorrequest_id: Something failed on Remediio's side. Quote the request id to support.