Error format
Errors come back as JSON with anerror object:
On the Anthropic endpoint (
/v1/messages), errors from the model may use the Anthropic error format.
400 — invalid request
401 — invalid key
Send the key as
Authorization: Bearer YOUR_API_KEY. The Anthropic endpoint also accepts x-api-key: YOUR_API_KEY.
403 — not allowed or no credit
404 — wrong URL
429 — too many requests
5xx — server or model errors
Succeeded but looks wrong
Should I retry?
Every successful request is billed. Cap automatic retries so a request that actually succeeded is not sent again.
Contact support
Email support@refillapi.com with the time, model ID, endpoint, therequest id from the error, and the error message. Never send your full API key or Authorization header.