moth docs
Guides Errors and rate limits

Errors and rate limits

Errors come back in the shape of the endpoint you called, with a status that says what to do next.

/chat/completions answers errors in OpenAI's shape and every other endpoint in Anthropic's, with the same status either way. Both carry a message that says what went wrong, and the Anthropic shape also carries the request id.

json
{"error": {"message": "Not enough credit for this request. Top up to continue.", "type": "insufficient_credit", "code": null, "param": null}}

{"type": "error", "error": {"type": "insufficient_credit", "message": "Not enough credit for this request. Top up to continue."}, "request_id": "req_4Gk9tQ2wXb7Lm1Pz8RcV"}

Statuses

400invalid_request_errorThe body isn't valid, the model can't take part of it, or the conversation is longer than its context
401authentication_errorThe key is missing, revoked or expired, or the endpoint takes a wallet session and was sent a key
402insufficient_creditThe balance or the key's cap can't cover the call's hold
403permission_errorThe key may not use this model
404not_found_errorThe model, job or endpoint doesn't exist
409invalid_request_errorA credit code was already used by this account, or is used up
410invalid_request_errorA credit code has ended, or isn't open yet
411invalid_request_errorThe upload was sent in chunks with no Content-Length
413invalid_request_errorThe body is larger than the endpoint takes
429rate_limit_errorToo many calls from the key or the account, or to the model, so wait for retry-after. A 429 saying the account is paused has no retry-after and lasts until midnight UTC
500api_errorSomething failed on our side, and the request id helps us find it
503overloaded_errorMoth is briefly at capacity, so wait for retry-after
529overloaded_errorThe model is busy or down at its host, so wait or choose another model

Rate limits

LimitPer minute
Calls per key60
Calls per account, across its keys120
Reads per key300

Calls are chat, token counts, jobs and file downloads, and reads are every GET. Each limit refills steadily through the minute rather than all at once, and a refusal carries retry-after in whole seconds.

When a model is busy

A chat call to a host that is busy or briefly down is retried twice before you see an error, while a job is sent once, so a 529 on a job means send it again later or choose another model. A model that fails for several callers within a few minutes rests for a minute or more and reads busy in the catalog, and calls to it get 529 with retry-after until it is tested again, while other models answer as usual.

Body sizes

EndpointLargest body
Chat and token counts32 MB
Jobs64 KB
Sign-in and credit codes8 KB
Everything else1 MB