error.message, fix authentication or configuration errors before resending, and retry only failures identified as temporary.
Before troubleshooting
Have your Model ID, Base URL, and failed response available. Check the Key status and current balance in the BetterToken Dashboard. If you have not completed a model request yet, start with the SDK examples or your tool setup guide.Read the error response
BetterToken returns API errors in a JSON envelope. For example, a request without a Key can return:error.message even when error.code is empty. The request ID in that message helps identify the failed attempt. A request to /v1/models without a Key returns 401; it does not test whether your model can generate a response.
Record these details before contacting support:
Keep your BetterToken API Key out of screenshots, support messages, and shared logs.
Check the HTTP status
The table uses general HTTP/API meanings and the linked setup guidance. It is not a list of BetterToken-specific error codes; read the actual response before choosing a fix.
For protocol and suffix mistakes, see the Base URL FAQ. For cache questions, use the cache billing FAQ.
Retry temporary failures
Use bounded exponential backoff with jitter after identifying a temporary429 or server failure. Honor Retry-After when returned; if it exceeds your retry budget, stop and wait outside the loop. SDK retries and your own loop share one attempt budget, so disable SDK retries when implementing your own policy.
Do not retry unchanged 400, 401, 403, balance, or configuration failures. A client timeout or broken stream does not prove the request failed before processing. Check the Dashboard first, especially for image generation or a workflow that can repeat an action.
The following examples make a non-streaming Chat Completions request with at most four attempts. They retry HTTP 500, 502, and 503. They leave 429 retries off until you confirm the response is a temporary rate limit, and stop on timeouts, network exceptions, and 504 so you can check completion. The maximum retry wait is 30 seconds per attempt.
Prepare the request
Copy a current Model ID from the model plaza and replace both placeholders. Use a text model available through Chat Completions..mjs file and run it with a Node.js version that provides fetch and AbortSignal.timeout.
- Python
- JavaScript

